OpenOffice-OODoc - Re: Changing style of a cell in a table

Posted on Wed Nov 23 22:20:57 2005 by jmgdoc in response to 1394 (See the whole thread of 4)
Re: Changing style of a cell in a table

It's not very easy to know where is the issue without the code and the document ;-)... but, in general terms:
Style of a cell could have 2 different meanings.

"External" layout properties such as border, background color, ... belong to "table-cell" styles. A table cell style may be linked to a given cell using
$doc->cellStyle($cell, "stylename")

"Internal" layout properties, such as font or text alignment belong to an ordinary paragraph style, knowing that the display text of a cell is stored in one or more paragraphs.
The text paragraphs of a given cell may be selected using getCellParagraphs(), then it's easy to give each of them an appropriate style using
$doc->textStyle($para, "stylename")

Note: creating a table cell style from scratch may require a lot of attributes and the presently available createStyle() method is not really designed to hide the complexity of cell styles. The best approach consists of extracting style definitions from a previously hand-written template document (used as a style database). The "prototype" option of createStyle() could be helpful to do that.
Direct Responses: 1397 | Write a response