|
I was trying to programmatically create some basic styles for OOCalc.
While the styles are created correctly (they show in the Styles box
in Calc) none of them has any required properties set (i.e. font
face is always set to Arial rather than Times New Roman and there
is no bold).
What am I doing wrong? The example below shows several calls to
styleCreate, none of which works.
#!/usr/bin/perl
use strict;
use warnings;
use OpenOffice::OODoc;
my $container = odfContainer( "aaa.ods", create => 'spreadsheet' );
my $doc = odfDocument( container => $container, part => 'content' );
my $styles = odfDocument( container => $container, part => 'styles' );
$doc->expandTable( 0, 40, 40 );
my $idx=0;
printf "-- %s --\n", $styles->createStyle
(
"style_$idx",
"name" => "style_$idx",
"family" => 'text',
"properties" => {
"fo:font-weight" => "bold",
"style:font-name" => "Times New Roman",
},
);
$idx += 1;
printf "-- %s --\n", $styles->createStyle
(
"style_$idx",
"name" => "style_$idx",
"family" => 'table-cell',
"properties" => {
"fo:font-weight" => "bold",
"style:font-name" => "Times New Roman",
},
);
$idx += 1;
printf "-- %s --\n", $styles->createStyle
(
"style_$idx",
"name" => "style_$idx",
"family" => 'table-cell',
"properties" => {
"text-properties" => {
"fo:font-weight" => "bold",
"style:font-name" => "Times New Roman",
},
},
);
$idx += 1;
printf "-- %s --\n", $styles->createStyle
(
"style_$idx",
"name" => "style_$idx",
"family" => 'table-cell',
"properties" => {
"font-weight" => "bold",
"font-name" => "Times New Roman",
},
);
$idx += 1;
printf "-- %s --\n", $styles->createStyle
(
"style_$idx",
"name" => "style_$idx",
"family" => 'table-cell',
"text-properties" => {
"fo:font-weight" => "bold",
"style:font-name" => "Times New Roman",
},
);
$idx += 1;
printf "-- %s --\n", $styles->createStyle
(
"style_$idx",
"name" => "style_$idx",
"family" => 'table-cell',
"text-properties" => {
"font-weight" => "bold",
"font-name" => "Times New Roman",
},
);
$idx += 1;
printf "-- %s --\n", $styles->createStyle
(
"style_$idx",
"name" => "style_$idx",
"family" => 'table-cell',
"style:text-properties" => {
"fo:font-weight" => "bold",
"style:font-name" => "Times New Roman",
},
);
$idx += 1;
printf "-- %s --\n", $styles->createStyle
(
"style_$idx",
"name" => "style_$idx",
"family" => 'table-cell',
"style:text-properties" => {
"font-weight" => "bold",
"font-name" => "Times New Roman",
},
);
for ( 0 .. $idx ) {
my $cell;
$cell = $doc->getTableCell(0, 0, $_ );
$doc->updateCell( $cell, "style_$_" );
$doc->style( $cell, "style_$_" );
}
$container->save();
|