# Generating RTF documents?

**URL:** <https://www.ruby-forum.com/t/generating-rtf-documents/101365>\
**Category:** Rails\
**Created:** [August 4, 2006, 3:00pm UTC](https://www.ruby-forum.com/t/generating-rtf-documents/101365 "2006-08-04T15:00:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jetienne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d2c977/32.png) [@jetienne](https://www.ruby-forum.com/u/jetienne)\
**Post date:** [August 4, 2006, 3:00pm UTC](https://www.ruby-forum.com/t/generating-rtf-documents/101365/1 "2006-08-04T15:00:07Z")

</div>

Hi,

I need to implement some RTF export for a customer. According to some  
“templates”, i generate RTF documents, filling data coming from models.  
It’s pretty much like a mailmerge, but in \*nix/ruby world.  
Also, customer would like (in the future) to upload himself the  
templates, so he can modify them by his own.

Can anyone advice me on an elegant solution?

Thank you,  
Jean-Etienne

---

<div class="post-metadata">

**Author:** ![jetienne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d2c977/32.png) [@jetienne](https://www.ruby-forum.com/u/jetienne)\
**Post date:** [August 4, 2006, 3:15pm UTC](https://www.ruby-forum.com/t/generating-rtf-documents/101365/2 "2006-08-04T15:15:17Z")

</div>

Don’t know of any rtf libraries. But the format is simple if you are  
doing simple things. Here is an example of a document from

> **[Rich Text Format](https://en.wikipedia.org/wiki/Rich_Text_Format)**
>
> The Rich Text Format (often abbreviated RTF) is a proprietary document file format with published specification developed by Microsoft Corporation from 1987 until 2008 for cross-platform document interchange with Microsoft products. Prior to 2008, Microsoft published updated specifications for RTF with major revisions of Microsoft Word and Office versions.
> Most word processors are able to read and write some versions of RTF. There are several different revisions of RTF specification; portability...

{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0  
Hello!\par  
This is some {\b bold} text.\par  
}

If all you need is some basic formatting such as bold and font sizes  
you should be able to make a basic parser in no time.

On 8/4/06, Jean-Etienne D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Thank you,  
> Jean-Etienne
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–

---

<div class="post-metadata">

**Author:** ![jetienne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d2c977/32.png) [@jetienne](https://www.ruby-forum.com/u/jetienne)\
**Post date:** [August 4, 2006, 4:55pm UTC](https://www.ruby-forum.com/t/generating-rtf-documents/101365/3 "2006-08-04T16:55:57Z")

</div>

Jean-Etienne D. wrote:

> Hi,
> 
> I need to implement some RTF export for a customer. According to some  
> “templates”, i generate RTF documents, filling data coming from models.  
> It’s pretty much like a mailmerge, but in \*nix/ruby world.  
> Also, customer would like (in the future) to upload himself the  
> templates, so he can modify them by his own.
> 
> Can anyone advice me on an elegant solution?
> 
> Thank you,  
> Jean-Etienne

Check this lib [http://ruby-rtf.rubyforge.org/docs/index.html](http://ruby-rtf.rubyforge.org/docs/index.html)
