Skip Menu |

This queue is for tickets about the OpenOffice-OODoc CPAN distribution.

Report information
The Basics
Id: 131524
Status: new
Priority: 0/
Queue: OpenOffice-OODoc

People
Owner: Nobody in particular
Requestors: jdchaygdal [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: getTableCell bug in OpenOffice::OODoc 2.125
Date: Mon, 20 Jan 2020 12:34:52 -0700
To: bug-OpenOffice-OODoc [...] rt.cpan.org
From: John Campbell <jdchaygdal [...] gmail.com>
It looks like this package is not actively supported. If that's so and you have a moment, please just reply saying no one can or will work on this issue. It's fine; my work is unimportant and I have a work around. Package OpenOffice::OODoc 2.125 has a problem probably in OpenOffice::OODoc::XPath 2.237 where selectChildElement does not work right with a request of -1 as the column. First encountered when trying to understand why expandTable was adding columns to column 0 instead of column -1. My perl: This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux-gnu-thread-multi My OS: 5.3.0-7625-generic #27~1576774585~18.04~c7868f8~dev-Ubuntu SMP Thu Dec 19 20:37:32 x86_64 x86_64 x86_64 GNU/Linux Here's a program that demonstrates the bug ---cut for bug.pl----- #!/usr/bin/perl use OpenOffice::OODoc; use strict; # Program to demonstrate a bug/difference in two seemingly # equivalent calls to getTableCell. Problem appears to be # passing -1 for last column to selectChildElement in XPath.pm. # my $fname = &make_temp_spreadsheet; # Open temp file and read last row, last column value my $doc = odfDocument(file => $fname) or die "can't open $fname"; my $value = $doc->getCellValue(0, 2, 3); print "$fname of size (3,4) found with cell value $value at (2,3)\n"; # Now read same data two different ways (first method used in expandTable) my ($row, $cell, $value); $row = $doc->getTableRow(0, 2); $cell = $doc->getTableCell($row, -1); $value = $doc->cellValue($cell); print "Value using getTableCell with (row,-1) args -> $value **WRONG**\n"; $cell = $doc->getTableCell(0, 2, -1); $value = $doc->cellValue($cell); print "Value using getTableCell with (sheet, row, -1) -> $value\n"; print "\nThe problem seems to be selectChildElement in XPath does not\n"; print "handle -1 as a column position while selectChildElements in XPath\n"; print "allows -1 to work as a column position\n"; unlink ($fname); exit; # create a temporary OOo spreadsheet sub make_temp_spreadsheet { my $tmpfile = "bug-$$.ods"; my $doc = odfDocument(file => $tmpfile, create => 'spreadsheet'); # set a 1st sheet in the document (expandTable actually buggy but works here) my ($maxrow, $maxcol) = (3,4); my $sheet = $doc->expandTable(0, $maxrow, $maxcol); # Populate the cells. my ($rownum, $colnum); for ($rownum = 0; $rownum < $maxrow; ++$rownum) { for ($colnum = 0; $colnum < $maxcol; ++$colnum) { $doc->cellValue($sheet, $rownum, $colnum, "R$rownum,C$colnum"); } } $doc->save; return $tmpfile; } ----end of bug.pl------- Sorry, I have a couple of thoughts on fixing this but it's in XPath.pm and I'm worried I don't understand the impact of changes there as well as in Text.pm. If interested, I do have a simple patch for Text.pm to support boolean data [add ($value_type eq 'boolean') under 'date' in fieldValueAttributeName].