|
The "Heading_20_1" style is probably not defined in the target document. While a "Heading_20_1" style is silently generated (with default properties) as soon as its selected and used through OpenOffice.org, it's not predefined in the OpenOffice::OODoc library. So, this style can be either replicated from an existing document which owns it, or explicitly created by program.
The following example (which works with "content" and "styles" in the same session) creates a new document from scratch, then creates a "Heading_20_1" style (with arbitrary text properties) in the "styles" part and a level 1 heading (using the new style) in the "content" part.
my $container = odfContainer("test.odt", create => 'text');
my $content = odfDocument
(
container => $container,
create => "text"
);
my $styles = odfDocument
(
container => $container,
part => "styles"
);
$content->appendHeading
(
text => "A level one title",
level => 1,
style => 'Heading_20_1'
);
$styles->createStyle
(
'Heading_20_1',
display-name' => "Heading 1",
family => "paragraph",
properties =>
{
area => 'text',
'fo:font-size' => "115%",
'fo:font-weight' => "bold"
}
);
$container->save;
|