Can't use ruby-rtf gem

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:inrequire’
from rtf.rb:2
This is all happening on a Windows PC.

Can someone tell me what I’ve done wrong?

Joshua Levy

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs