|
This program doesn't work for several reasons...
First: "Times New Roman" is not declared in the target document. A corresponding font face declaration should be provided (in both the styles and content workspaces for more safety). OODoc doesn't presently provide a high-level font face declaration method, but it's possible to import such a declaration from another document or from an XML font spec string; In your current example, the following code should work:
my $xmlfont =
'<style:font-face style:name="Times New Roman" ' .
'svg:font-family="Times New Roman" ' .
'style:font-family-generic="roman" style:font-pitch="variable"/>';
$doc->importFontDeclaration($xmlfont);
$styles->importFontDeclaration($xmlfont);
Second: The right way to set the text properties of a cell style is the use of the 'area' selector in the 'properties' section.
Every cell style creation in your example should be reworked according to the following template:
printf "-- %s --\n", $styles->createStyle
(
"style_$idx",
"name" => "style_$idx",
"family" => 'table-cell',
"properties" => {
area => 'text',
"font-weight" => "bold",
"font-name" => "Times New Roman",
},
);
Third: The right instruction to set a cell style is:
$doc->cellStyle($cell, $stylename);
and not:
$doc->style($cell, $stylename);
|