Posted on 2005-09-15 13:59:21-07 by dan
Nasted text paragraph question
hi till now i was writing odt's with pure xml. today i found this nice module :-) maybe somone is willing to help me? i would like to produce the following code:
<style:style style:auto-update="true" style:class="text" style:family="paragraph" style:name="Code" style:parent-style-name="Standard"> <style:paragraph-properties fo:background-color="#e6e6ff" fo:border-bottom="0.002cm solid #000000 +" fo:border-left="0.002cm solid #000000" fo:border-right="none" fo:border-top="0.002cm solid #000000" fo:padding="0.25cm" style:shadow="none"> </style:paragraph-properties> <style:text-properties fo:font-size="8pt" style:font-name="Bitstream Vera Sans Mono"/> </style:style>
Any ideas? The following didn't worked:
$content->createStyle('Code', family=>'paragraph', properties =>; { 'fo:background-color' => "#e6e6ff", 'fo:border-bottom' => "0.002cm solid #000000", 'fo:border-left' => "0.002cm solid #000000", 'fo:border-right' => "none", 'fo:border-top' => "0.002cm solid #000000", 'fo:padding' => "0.25cm", 'style:shadow' => "none", 'fo:font-size' => "8pt", 'style:font-name' => "Bitstream Vera Sans Mono", } );
any idea? thanks dan
Direct Responses: 993 | Write a response
Posted on 2005-09-15 15:45:05-07 by jmgdoc in response to 991
Re: Nasted text paragraph question

I don't know the full context, but you must care with two kinds of concerns:

1) If you want to produce a persistent, reusable style, you must explicitly open the styles-focused workspace of the document, through the 'member' option. The default workspace is the content and not the styles. (If you want to process both text content and styles, look at the documentation, for ex. OpenOffice::OODoc::Intro).

2) Whith ODT documents, you can't set the container properties (i.e. the properties of the paragraph "box") and the content properties (i.e. the properties of the text in the paragraph, for ex. font-related properties) in the same instruction. (It's possible with SXW documents.) So, you must create the style and select, say, the paragraph properties area, then update the style in order to deal with the text area properties.

Could you try this sequence:

# open the styles side of the document $doc->ooDocument(file => "myfile.odt", member => "styles"); # create the style as a child of "Standard" # and set the 'paragraph' properties $doc->createStyle ( 'Code', family=>'paragraph', parent => "Standard", properties => { 'area' => 'paragraph', 'fo:background-color' => "#e6e6ff", 'fo:border-bottom' => "0.002cm solid #000000", 'fo:border-left' => "0.002cm solid #000000", 'fo:border-right' => "none", 'fo:border-top' => "0.002cm solid #000000", 'fo:padding' => "0.25cm", 'style:shadow' => "none" } ); # update the style in order to set # the 'text' properties (ex: font) separately $doc->updateStyle ( 'Code', properties => { 'area' => 'text', 'fo:font-size' => "8pt", 'style:font-name' => "Bitstream Vera Sans Mono" } ); # commit the changes $doc->save("targetfile.odt");
Direct Responses: 994 | Write a response
Posted on 2005-09-15 16:22:41-07 by dan in response to 993
Re: Nasted text paragraph question
Thanx verry much for your help. I'm trying.... ... Yeah it works now (partialy). I can change the font-size so the 'updateStyle' is working. I think I have to declare the Font some more. Anyway, thanx for helping. The whole OpenDocument-thing feels like voodoo for me, especialy if it comes to tables. I'm shure it gets easier with the (your?) perl-module :-) dan
Direct Responses: 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.