|
"world" doesn't appear because the cell that should contain it doesn't exist!
In a newly created ods document, the number and the size of the predefined sheets depends on the document template in use in the OpenOffice::OODoc installation. The default template provides a single sheet with a single cell. Such a configuration, of course, is never convenient, so the user must resize the existing sheet, or create a new one.
In this example, the (20,20) size arguments given with getTable() as useless; such arguments just tell getTable() that we need a normalized 20x20 area, but don't instruct the API to resize the table accordingly. So getTable() should be replaced by expandTable() with the same arguments, and everything should work.
The autoSheetNormalization() instruction is useless in this context, knowing that every table created or expanded by OpenOffice::OODoc is always fully normalized.
So the whole program (assuming that the default spreadsheet template is used) should be like below:
use OpenOffice::OODoc;
my $doc = odfDocument(
file=>'ttab.ods',
create=>'spreadsheet',
part=>'content' );
my $sheet = $doc->expandTable(0, 20, 20);
$doc->cellValue($sheet,0,0,"hello");
$doc->cellValue($sheet,0,1,"world");
$doc->save;
|