How to access the spreadsheet with name in Openoffice - Using roo gem

12 views
Skip to first unread message

Preci

unread,
May 14, 2009, 2:46:08 AM5/14/09
to ruby-roo
I am able to access the first worksheet using "oo.sheets.first". Can
anyone help me in accessing the rest of the worsheet in ods file.


Thanks
Preci

Thomas Preymesser

unread,
May 27, 2009, 8:31:36 AM5/27/09
to ruby-roo


On May 14, 8:46 am, Preci <precilla.j...@gmail.com> wrote:
> I am able to access the first worksheet using "oo.sheets.first". Can
> anyone help me in accessing the rest of the worsheet in ods file.

"oo.sheets.first" is the same as "oo.sheets[0]", which is the first
element of the "sheets"-array.
The second sheet is "oo.sheets[1]".

'.first' and '.last' are methods from the class Array, but there is no
such thing as 'second', 'third', ...



-Thomas

Hugh McGowan

unread,
May 27, 2009, 8:33:16 AM5/27/09
to ruby...@googlegroups.com
You can specify a sheet with:

oo.default_sheet = 'Sheet2'
oo.default_sheet = oo.sheeets(3)
oo.sheets.each { |sheet|  ...do stuff ...}

See the rdoc here: http://roo.rubyforge.org/rdoc/index.html

Thanks!
Hugh
Reply all
Reply to author
Forward
0 new messages