|
Hi all,
though using the OODoc already for quite a while this is my first post here.
I run into an issue when creating styles.
I have an application that needs to write certain elements into an .odt.
The elements are (in some form) stored in a database. The output document may or may not have any content when my application is used.
Therefor I cannot be sure that the output document has all the styles that I need. I try to determine this with the following routine (getStylesRef() is refers to the ::Styles and getContentRef to the ::Text):
my %styleStore = ();
sub getStyleElement {
if (not exists ($styleStore{$styleName}))
{
$styleStore{$styleName} = $self->getStylesRef()->getStyleElement($styleName);
}
if (not defined $styleStore{$styleName})
{
$styleStore{$styleName} = $self->getContentRef()->getStyleElement($styleName);
}
if (not defined ($styleStore{$styleName})
{
$styleStore{$styleName} = $self->getStylesRef()->createStyle($styleName,
#category => 'named',
#namespace => ...,
#type => ...,
family => "paragraph",
#class => ...,
check => 'true',
parent => $self->getStyleElement('SomeParentStyle'),
next => $self->getStyleElement('SomeNextStyle'),
properties => {
'fo:margin-top' => "0mm",
'fo:margin-bottom' => "0mm",
'fo:font-style' => "italic"
});
}
}
of course the real application will use some more logic to determine what the new style should look like.
When I execute this piece of code I get an error "[OpenOffice::OODoc::Styles::createStyle] Style MyStyle exists"
I use this same routine for both paragraph style as for list-styles. In the case of failure the style is a list-style.
Can anyone tell me why getStyleElement returns undef though the style does exist?
|