|
Changing a full table layout programmatically is very tricky and sleeveless.
To do so, you have to affect a style to every cell, every row, every column. The style of the table object controls a few global properties only. Using templates is a good idea.
See createStyle() in the OpenOffice::OODoc::Styles manual page. There is an example of style creation with an explicit "Times" font selection. Caution, only the fonts which are "declared" in the current document are effective. If you want to use a font which doesn't belong to the default set, you have to import its declaration. See importFontDeclaration() in OpenOffice::OODoc::Style.
Any regular document can be used as a template. Example:
my $doc = ooDocument(file => "template.odt");
# update the document
$doc->save("target.odt");
As long as a file name is provided to the save() method, the original file in unchanged, so it's used as a template and the result is saved to the target file. An alternative option consists of using one or more documents in order to extract a few selected styles, font declarations or text containers (such as tables) and use them in a target document. As an example, a single document could play the role of styles database. Of course, the user can customize the OpenOffice::OODoc installation in order to replace the default templates which are used by ooDocument() each time the "create" option is set, but it's seldom required.
|