Posted on 2008-11-24 14:18:57-08 by dhoworth in response to 9399
Re: finding elements by type
I've nearly got it working now :) Thanks to your help. I can extract the column number:
my $table_cell = $note->parent; my $col = $table_cell->pos - 1;
and that works but when I try to get the row number:
my $table_row = $table_cell->parent; my $row = $table_row->pos - 2;
I get strange numbers. I have normalized the table - thanks for the warning :) I've printed
$table_row->getName
so I know it's definitely a table:table-row but if I print out
$table_row->prev_siblings
I see a whole bunch of table:table-column elements as well as the expected preceding table:table-row elements.

If I look at the content.xml, I see this:
<office:spreadsheet> <table:table table:name="Sheet1" table:print="false" table:style-name="ta1"> <table:table-column table:default-cell-style-name="Default" table:number-columns-repeated=" +28" table:style-name="co1"/> <table:table-row table:style-name="ro1"> <table:table-cell>
So the extra elements are undoubtedly that strange table:table-column element. Is there some way to get the correct row number, short of iterating and counting siblings?

Thanks again, Dave
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.