I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2010-05-05 03:04:55.398989-07 by jmgdoc in response to 12679
Re: Problems inserting a blank new Row into a table in OpenOffice Writer

The insertRow method creates a row that replicates an existing row; it's a design choice, in order to avoid requiring a lot of parameters specifying the configuration of the new row.


The text content of a cell is hosted in one or more paragraphs. The cellValue (or setText, when applied to a table cell) method updates the first paragraph of the target cell. The subsequent paragraphs, if any, remain unchanged. Note that this feature allows the user to individually select/update/delete a particular paragraph in a cell.

As a consequence, all the embedded paragraphs must be explicitly removed in order to clear a cell as soon as it's suspected to be a multi-paragraph one.

We can use getCellParagraphs in order to get the list, then delete each paragraph using removeElement. Example:

$doc->removeElement($_) for $doc->getCellParagraphs($table, $row, $position);

Alternatively, we can use cut_children from the cell element. This method is not documented with OpenOffice::OODoc, but it's inherited from XML::Twig. It deletes all the elements contained in the calling element; so when used from a cell element it removes everything in the cell. Example:

$doc->getCell($table, $row, $position)->cut_children;
Direct Responses: 12681 | Write a response