codeacrobat has asked for the wisdom of the Perl Monks concerning the following question:
*Solved*use OpenOffice::OODoc; my $document = ooDocument( file => 'outputfile.odp', create => 'presentation' ); $document->createStyle( "TB", family => "paragraph", parent => "objectwithshadow", properties => { 'style:vertical-pos' => 'from-top', 'style:horizontal-pos' => 'from-left', 'style:vertical-rel' => 'page', 'style:horizontal-rel' => 'page', 'style:font-size' => '36pt', 'style:font-weight' => 'bold', } ); $document->createStyle ( "Colour", family => 'paragraph', parent => 'Standard', properties => { 'fo:margin-left' => '2cm', 'fo:margin-right' => '1.5cm', 'fo:text-align' => 'justify', 'fo:background-color' => '#ff00ff' 'fo:font-size' => '36pt', } ); $para = $document->createParagraph( "hello world", "Colour" ); $slide = $document->getDrawPage(0); $document->createTextBox( attachment => $slide, size => '10cm, 10cm', position => '4cm,4cm', content => $para, style => 'TB', ); $document->save;
We could provide this new style with additional properties related to the text content of the paragraph. But, in a paragraph style definition, the "text" properties are not stored in the same logical area than the "paragraph" properties, and we can't set both in the same instruction. Fortunately, we can enrich any existing style at any time through the updateStyle() method
It has to be splitted into two statements. I just tested something similar successfully.$document->createStyle ( "Colour", family => 'paragraph', parent => 'Standard' ); $document->updateStyle( "Colour", family => 'paragraph', parent => 'Standard', properties => { 'fo:margin-left' => '2cm', 'fo:margin-right' => '1.5cm', 'fo:text-align' => 'justify', 'fo:background-color' => '#ff00ff' 'fo:font-size' => '36pt', } );
print+qq(\L@{[ref\&@]}@{['@'x7^'!#2/"!4']});
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: OpenOffice::OODoc howto set size for textboxes
by Anonymous Monk on Jun 05, 2009 at 15:28 UTC | |
by codeacrobat (Chaplain) on Jun 05, 2009 at 16:23 UTC | |
by Anonymous Monk on Jun 05, 2009 at 19:55 UTC |