jruby and roo error?

140 views
Skip to first unread message

leftfieldhero

unread,
Jun 9, 2012, 4:25:23 PM6/9/12
to ruby-roo
I looked for this in the group, google, and stackoverflow. I'm new to
programing in general. Ruby is my first language that I have actually
attempted to learn fully.

I am attempting to use roo(1.10.1) in jruby(1.6.7). It installs and I
am able to "require" it. When I load an Open Office document I get a
mess that looks nothing like what roo loads in ruby(1.9.3).

1) Is roo able to be used with jruby? This seems elementary but I just
could not find this for the life of me.

2)If roo is suppose to work with jruby:

#my code in jirb looks like the following:
jruby-1.6.7.2 :001 > require "RubyGems"
=> true
jruby-1.6.7.2 :002 > require "roo"
=> true
jruby-1.6.7.2 :003 > oo = Openoffice.new("Test.ods")
=> #<Openoffice:0xa574b2 @header_line=1, @last_column={},
@cell_type={}, @style={}, @first_column={},
@tmpdir="oo_54678_9733824226", @file_nr=1, @first_row={},
@style_definitions={}, @cells_read={}, @filename="Test.ods",
@last_row={}, @formula={}, @file_warning=:error, @labels_read=false,
@comment={}, @cell={}, @comments_read={}, @style_defaults={},
@doc=#<Nokogiri::XML::Document:0xa60 name="document"
children=[#<Nokogiri::XML::Element:0xa5e name="document-content"
namespace=#<Nokogiri::XML::Namespace:0x7d0 prefix="office"
href="urn:oasis:names:tc:opendocument:xmlns:office:1.0">
attributes=[#<Nokogiri::XML::Attr:0x7d4 name="transformation"
namespace=#<Nokogiri::XML::Namespace:0x7d2 prefix="grddl"

#The mess continues but i didn't want to fill up space needlessly if
you would like the rest of the object definition let me know.

jruby-1.6.7.2 :004 > oo.sheets
=>[nil, nil, nil, nil]
jruby-1.6.7.2 :005 > oo.cell(1,1)
ArgumentError: Error: sheet 'nil' not valid
from /Users/leftfieldhero/.rvm/gems/jruby-1.6.7.2/gems/roo-1.10.1/lib/
roo/openoffice.rb:337:in `read_cells'
from /Users/leftfieldhero/.rvm/gems/jruby-1.6.7.2/gems/roo-1.10.1/lib/
roo/openoffice.rb:76:in `cell'
from (irb):4:in `evaluate'
from org/jruby/RubyKernel.java:1083:in `eval'
from /Users/leftfieldhero/.rvm/rubies/jruby-1.6.7.2/lib/ruby/1.8/
irb.rb:158:in `eval_input'
from /Users/leftfieldhero/.rvm/rubies/jruby-1.6.7.2/lib/ruby/1.8/
irb.rb:271:in `signal_status'
from /Users/leftfieldhero/.rvm/rubies/jruby-1.6.7.2/lib/ruby/1.8/
irb.rb:155:in `eval_input'
from org/jruby/RubyKernel.java:1410:in `loop'
from org/jruby/RubyKernel.java:1183:in `catch'
from /Users/leftfieldhero/.rvm/rubies/jruby-1.6.7.2/lib/ruby/1.8/
irb.rb:154:in `eval_input'
from /Users/leftfieldhero/.rvm/rubies/jruby-1.6.7.2/lib/ruby/1.8/
irb.rb:71:in `start'
from org/jruby/RubyKernel.java:1183:in `catch'
from /Users/leftfieldhero/.rvm/rubies/jruby-1.6.7.2/lib/ruby/1.8/
irb.rb:70:in `start'
from /Users/leftfieldhero/.rvm/rubies/jruby-1.6.7.2/bin/jirb:17:in
`(root)'

#Here's what ruby does aka the right thing:

1.9.3p194 :001 > require "RubyGems"
=> true
1.9.3p194 :002 > require "roo"
=> true
1.9.3p194 :003 > oo = Openoffice.new("Test.ods")
=> {[1, 1]=>"Test", [1, 2]=>nil, [2, 1]=>"First Name:", [2,
2]=>"Steve", [3, 1]=>"Last Name:", [3, 2]=>"Ashton", [4, 1]=>"Your
Email:", [4, 2]=>"Sas...@email.com", [5, 1]=>"New Password:", [5,
2]=>"password1", [6, 2]=>nil, [7, 1]=>"First Name:", [7, 2]=>"Mary",
[8, 1]=>"Last Name:", [8, 2]=>"Masters", [9, 1]=>"Your Email:", [9,
2]=>"Them...@email.org", [10, 1]=>"New Password:", [10,
2]=>"Iamthemaster", [11, 2]=>nil, [12, 1]=>"First Name:", [12,
2]=>"Gary", [13, 1]=>"Last Name:", [13, 2]=>"Gaston", [14, 1]=>"Your
Email:", [14, 2]=>"Gass...@email.gov", [15, 1]=>"New Password:",
[15, 2]=>"Thegaseous1"}
1.9.3p194 :004 > oo.sheets
=> ["TEST", "Sheet2", "Sheet3", "Sheet4"]
1.9.3p194 :005 > oo.cell(1,1)
=> "Test"

so roo is working here.

Thanks for any answers/help/direction in advance.

LFH

t.pickett66

unread,
Jul 11, 2012, 4:16:12 PM7/11/12
to ruby...@googlegroups.com
LHF,

I'm having trouble using roo and JRuby too. I'm going to bet that there won't be any official support for it anytime soon w/o someone taking the bull by the horns and getting it straightened out. I've started down the road to fixing it but would certainly welcome any contributions to the process.

-T
Reply all
Reply to author
Forward
0 new messages