Posted on 2010-01-02 12:01:58-08 by benctphilip
Why are styles in content part additive and styles in styles part non-additive?
Please consider the sample script below.

If the "SmallCaps" style is created in the content part then $t2 ("idem") appears in OOWriter as italicized small-caps, but if the "SmallCaps" style is created in the styles part then $t2 appears in OOWriter as non-small-caps italics, i.e. styles defined in the content part are additive but styles defined in the styles part are not. The resulting office:text tree in content.xml seems to look the same in both cases. I guess this is by design, but is there any way to make styles created in the styles part additive?

Cheers,

/BP
use OpenOffice::OODoc; my $archive = odfContainer('nihil.odt'); my $content = odfDocument( container => $archive, part => 'content' ); my $styles = odfDocument( container => $archive, part => 'styles' ); $content->createStyle("SmallCaps", # Style becomes additive # $styles->createStyle("SmallCaps", # Style becomes non-additive family => 'text', parent => 'Standard', properties => { 'fo:font-variant' => 'small-caps' } ); my $p = $content->appendParagraph(); my $t = $content->extendText($p,"alienus","SmallCaps"); my $t1 = $content->extendText($t,"12","Superscript"); my $t2 = $content->extendText($t," idem","Emphasis"); my $t3 = $content->extendText($t," autem"); my $t4 = $content->extendText($p," however"); $archive->save();
Direct Responses: 12081 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.