OpenOffice-OODoc - merged cells in a spreadsheet

Posted on Tue Sep 6 23:19:41 2005 by mlcohen
merged cells in a spreadsheet
There seems to be an issue with handling merged cells in a calc (spreadsheet) document. For example, if I have a file with the following content:

A1: "This is A1"
B1-E1 (merged): "This is B1"
F1-K1 (merged): This is F1"
L1: "This is L1"

then capturing A1 and B1 with getCellValue gives the correct data, but all the other cells come out in the wrong place - when I read D1, instead of getting null I get "This is F1", and when I read F1 I get "This is L1". It seems that each group of merged cells is interpreted as 2 cells wide. I expected normalizeSheet to fix this - looking at the underlying xml, each merged cell does only take up 2 entries, and this seems like the kind of thing normalizeSheet was intended for. Only there's no difference whether or not I've used normalizeSheet. Sample code:
my $inFile = ooDocument(file => $fileName); my $sheet = $inFile->normalizeSheet('Sheet1', 20, 20); # extra large to be safe my $value = $inFile->getCellValue($sheet,"F1"); print "G1: $value\n"; # Prints "This is L1", should say "This is F1"

I've only been using perl for a few weeks, so it's possible I'm doing something stupid, but I've looked this over again and again.

I don't think it makes a difference, but I'm using StarOffice 7, not openoffice. Any ideas?
Direct Responses: 981 | 986 | Write a response