문제

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.

도움이 되었습니까?

해결책 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

다른 팁

Total guess here:

ss.table 'My first table from Ruby' do
   row { cell 'Hello, rODF world!', 'next?' }
end
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top