Reading a merged cell

209 views
Skip to first unread message

Anton Lukashchuk

unread,
May 14, 2014, 7:39:26 AM5/14/14
to jopend...@googlegroups.com
Hi,
I faced a problem while reading a text cell-by-cell with jopenDocument. If a cell consists of a few merged cells, I can only read the text from the first one, all other cells in this group give me an exception when trying to read them

Exception in thread "main" java.lang.IllegalArgumentException: invalid cell <table:covered-table-cell xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" table:number-columns-repeated="2" />

I understand, that other cells, except first in a merged group, are non-existent, but how do I now that, how to skip them? Is there a special way around in a lib or I have to catch this exception and move to the next cell?

donal...@gmail.com

unread,
May 30, 2014, 3:47:03 PM5/30/14
to jopend...@googlegroups.com


On Wednesday, May 14, 2014 7:39:26 AM UTC-4, Anton Lukashchuk wrote:
[...]

I understand, that other cells, except first in a merged group, are non-existent, but how do I now that, how to skip them? Is there a special way around in a lib or I have to catch this exception and move to the next cell?

(Not tested): Have you tried using getColumnsSpanned() to find out how "wide" the cell is? Instead of advancing from one column number to the next with `col++', perhaps `col += cell.getColumnsSpanned()' would do the trick. (Similarly for `row++' and `row += cell.getRowsSpanned()'.)

Just a guess...

Anton Lukashchuk

unread,
May 31, 2014, 7:17:31 AM5/31/14
to jopend...@googlegroups.com
Thanks, i will try this. Now I solved the problem with sheet.getImmutableCellAt() instead of getCellAt, it works without trowing exception, no matter if the cell is merged or not, I only read anyway.
> --
>
> ---
> You received this message because you are subscribed to a topic in the Google Groups "jOpenDocument" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/jopendocument/99WFQVkdbRg/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to jopendocumen...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
Reply all
Reply to author
Forward
0 new messages