Question

I'm trying to take a one column open office spreadsheet as input to a ruby script and write a result for each cell in that column in the column next to it. so, to illustrate:

input:

   A
--------
1| XXX |
--------
2| YYY |

output:

     A |  B
-------------------
1| XXX | result1  |
-------------------
2| YYY | result 2 |

I'm trying to use rodf rubygem to accomplish this but I can't figure out how to creat a new column.

 ss.table 'My first table from Ruby' do
   row { cell 'Hello, rODF world!' }
   row { cell 'next?'
 end

will write 'next?' to the cell below the first one (i.e A2).

And I get an exception when I try this:

ss.table 'My first table from Ruby' do
   row { cell 'Hello, rODF world!' }
   column { row { cell 'wtf?' } }
end
NoMethodError: undefined method `row' for #<ODF::Column:0x00000000f4c2c0 @elem_attrs={}>
from (irb):35:in `block (2 levels) in irb_binding'
from (eval):4:in `instance_eval'
from (eval):4:in `column'
from (irb):35:in `block in irb_binding'
from (eval):4:in `instance_eval'
from (eval):4:in `table'
from (irb):33
from /usr/bin/irb:12:in `<main>'

How do I access the cells in column B??

the documentation is unclear and I can't tell from the sourcecode if column.rb is actually doing anything.

Was it helpful?

Solution 2

so it's actually like this:

ss.table 'My first table from Ruby' do
  row do
    cell 'This goes into A1'
    cell 'This goes into B1'
    cell 'This goes into C1'
    cell 'And on, and on, and on...'
  end
  row do # this starts a new row
    cell 'This goes into A2'
    cell 'This goes into B2'
    cell 'Got it? ;-)'
  end
end

OTHER TIPS

Total guess here:

ss.table 'My first table from Ruby' do
   row { cell 'Hello, rODF world!', 'next?' }
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top