# Can't use ruby-rtf gem

**URL:** <https://www.ruby-forum.com/t/cant-use-ruby-rtf-gem/118243>\
**Category:** Rails\
**Created:** [October 25, 2007, 3:02am UTC](https://www.ruby-forum.com/t/cant-use-ruby-rtf-gem/118243 "2007-10-25T03:02:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joshualevy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@joshualevy](https://www.ruby-forum.com/u/joshualevy)\
**Post date:** [October 25, 2007, 3:02am UTC](https://www.ruby-forum.com/t/cant-use-ruby-rtf-gem/118243/1 "2007-10-25T03:02:02Z")

</div>

I’m new to ruby, rails, and gems, and trying to add an feature to a  
RoR’s app so users can export a file, and then edit it using  
Microsoft’s Word. (This is an app where telling folks to use  
OpenOffice or some other editor isn’t really an option). So I  
researched a little and think that using ruby-rtf to create rtf files  
is the best way to go. However, I can not use this gem; and I’m not  
sure if I did not install it properly or what.

I downloaded the rtf-0.1.0.gem file and ran “gem install rtf-0.1.0”  
and now if I do a “gem list” I see it in the list. So I create a file  
called rtf.rb which contains this:  
require ‘rubygems’  
require ‘rtf’  
include RTF  
document = Document.new(Font.new(Font::ROMAN, ‘Times New Roman’))  
document.paragraph \<\< “This is a short paragraph of text.”  
File.open(‘my\_document.rtf’) {|file| file.write(document.to\_rtf)}  
and then run it with “ruby rtf.rb”, and get this:  
./rtf.rb:3: uninitialized constant RTF (NameError)  
from C:/ror/InstantRails/ruby/lib/ruby/site\_ruby/1.8/rubygems/  
custom\_require.rb:27:in `gem_original_require' from C:/ror/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:27:in`require’  
from rtf.rb:2  
This is all happening on a Windows PC.

Can someone tell me what I’ve done wrong?

Joshua Levy
