# Is there a way to parse ruby code and generate a word doc?

**URL:** <https://www.ruby-forum.com/t/is-there-a-way-to-parse-ruby-code-and-generate-a-word-doc/110439>\
**Category:** Ruby\
**Created:** [July 26, 2007, 11:29am UTC](https://www.ruby-forum.com/t/is-there-a-way-to-parse-ruby-code-and-generate-a-word-doc/110439 "2007-07-26T11:29:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![neha-rohan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/34f0e0/32.png) [@neha-rohan](https://www.ruby-forum.com/u/neha-rohan)\
**Post date:** [July 26, 2007, 11:29am UTC](https://www.ruby-forum.com/t/is-there-a-way-to-parse-ruby-code-and-generate-a-word-doc/110439/1 "2007-07-26T11:29:01Z")

</div>

Hi,

Is there a way by which we can parse ruby code to generate a word file  
just the way there is a way to generate PDF, Excel or CSV files.

Neha

---

<div class="post-metadata">

**Author:** ![neha-rohan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/34f0e0/32.png) [@neha-rohan](https://www.ruby-forum.com/u/neha-rohan)\
**Post date:** [July 26, 2007, 11:48am UTC](https://www.ruby-forum.com/t/is-there-a-way-to-parse-ruby-code-and-generate-a-word-doc/110439/2 "2007-07-26T11:48:23Z")

</div>

2007/7/26, Neha C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Is there a way by which we can parse ruby code to generate a word file  
> just the way there is a way to generate PDF, Excel or CSV files.

Open your Ruby script with Word then Menu-\>File-\>Save As and save as  
Word.

Or did you want something different?

Kind regards

robert

---

<div class="post-metadata">

**Author:** ![neha-rohan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/34f0e0/32.png) [@neha-rohan](https://www.ruby-forum.com/u/neha-rohan)\
**Post date:** [July 26, 2007, 11:52am UTC](https://www.ruby-forum.com/t/is-there-a-way-to-parse-ruby-code-and-generate-a-word-doc/110439/3 "2007-07-26T11:52:44Z")

</div>

Robert K. wrote:

> 2007/7/26, Neha C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
> 
> > Is there a way by which we can parse ruby code to generate a word file  
> > just the way there is a way to generate PDF, Excel or CSV files.
> 
> Open your Ruby script with Word then Menu-\>File-\>Save As and save as  
> Word.
> 
> Or did you want something different?
> 
> Kind regards
> 
> robert

I want the ability to generate a word document by parsing through my  
code.  
As we do using PDF::Writer or CSV::Writer

---

<div class="post-metadata">

**Author:** ![neha-rohan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/34f0e0/32.png) [@neha-rohan](https://www.ruby-forum.com/u/neha-rohan)\
**Post date:** [July 26, 2007, 12:03pm UTC](https://www.ruby-forum.com/t/is-there-a-way-to-parse-ruby-code-and-generate-a-word-doc/110439/4 "2007-07-26T12:03:24Z")

</div>

2007/7/26, Neha C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> > Kind regards
> > 
> > robert
> 
> I want the ability to generate a word document by parsing through my  
> code.

I’m not sure why you talk about “parsing”. Parsing is done by the  
Ruby interpreter when executing your programs.

> As we do using PDF::Writer or CSV::Writer

So you want a library with which you can create Word documents  
programmatically. There might be tools to create RTF:  
[http://raa.ruby-lang.org/search.rhtml?search=rtf](http://raa.ruby-lang.org/search.rhtml?search=rtf)

An alternative would be to use Win32Ole when on a Windows-System with  
MS Word installed.

Last alternative I can think of, create a HTML doc and convert it with  
Word.

Kind regards

robert

---

<div class="post-metadata">

**Author:** ![neha-rohan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/34f0e0/32.png) [@neha-rohan](https://www.ruby-forum.com/u/neha-rohan)\
**Post date:** [July 30, 2007, 6:43am UTC](https://www.ruby-forum.com/t/is-there-a-way-to-parse-ruby-code-and-generate-a-word-doc/110439/5 "2007-07-30T06:43:37Z")

</div>

Can anyone tell me whether the RTF Writer works for Unix or not?

Regards  
Neha
