If the second column of the old first Row, which is Cell (0,1) consists of a multiline entry, for example:
Line1
Line2
Line3
this entry is duplicated by insertRow, but when I try to blank the new Cell with(blank line)
Line2
Line3
How can I blank the whole new cell?
Have I missed something?
Siegfried
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:
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:
Thanks for the explanation.
Since my first post, I found out thatSiegfried