# Generating Microsoft word document using ruby or rails

**URL:** <https://www.ruby-forum.com/t/generating-microsoft-word-document-using-ruby-or-rails/160839>\
**Category:** Ruby\
**Created:** [February 20, 2009, 6:48am UTC](https://www.ruby-forum.com/t/generating-microsoft-word-document-using-ruby-or-rails/160839 "2009-02-20T06:48:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jprabu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/51bf81/32.png) [@jprabu](https://www.ruby-forum.com/u/jprabu)\
**Post date:** [February 20, 2009, 6:48am UTC](https://www.ruby-forum.com/t/generating-microsoft-word-document-using-ruby-or-rails/160839/1 "2009-02-20T06:48:14Z")

</div>

I have some record formatted in table. For that, I need to convert the  
table data into Microsoft word document or Open office document. what  
method I have to use?,

Is there any class or gems or library in ruby?

kindly help me?..

Thanks,

Prabu J

---

<div class="post-metadata">

**Author:** ![jprabu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/51bf81/32.png) [@jprabu](https://www.ruby-forum.com/u/jprabu)\
**Post date:** [February 20, 2009, 11:09am UTC](https://www.ruby-forum.com/t/generating-microsoft-word-document-using-ruby-or-rails/160839/2 "2009-02-20T11:09:50Z")

</div>

- Prabu J., 2009-02-20, 14:47:

> I have some record formatted in table. For that, I need to convert the  
> table data into Microsoft word document or Open office document. what  
> method I have to use?,

The easiest way is to write a CSV and then import it into the target  
application. With Openoffice this simply means that you write the data  
(using file access or simple redirect) to a file with the name ending in  
“.csv” then open the file. You will be presented with an import  
dialogue. Choose ‘Separated by Tab’. The Data will be converted into a  
spreadsheet. The same method should work for MS Office but I am not  
familiar with that software.

Josef ‘Jupp’ Schugt

---

<div class="post-metadata">

**Author:** ![jprabu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/51bf81/32.png) [@jprabu](https://www.ruby-forum.com/u/jprabu)\
**Post date:** [February 20, 2009, 11:52am UTC](https://www.ruby-forum.com/t/generating-microsoft-word-document-using-ruby-or-rails/160839/3 "2009-02-20T11:52:06Z")

</div>

2009/2/20 Josef ‘Jupp’ Schugt [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> dialogue. Choose ‘Separated by Tab’. The Data will be converted into a  
> spreadsheet. The same method should work for MS Office but I am not  
> familiar with that software.

Another easy way I can think of is this: create a document with the  
desired contents, write it as RTF. Analyze the RTF and write a program  
that outputs the same content (with multiple table rows of course).

Cheers

robert
