|
Forget my previous answer. There is a simpler and more convenient solution, using setTextBoxContent in order to attach a customized text paragraph to an existing frame.
my $doc = ooDocument(file => "C:\\macros\\OOSjablonen\\test.odt");
# create the needed style
$doc->createStyle(
"ComicMS11",
family => 'frame',
parent => "Standard",
properties => {
-area => 'text',
'style:font-name' => 'Comic Sans MS',
'fo:font-size' => '12pt'
}
);
# declare the font used by the style
$doc->importFontDeclaration(
'<style:font-face ' .
'style:name="Comic Sans MS" ' .
'svg:font-family="Comic Sans MS"/>'
);
# create a paragraph using this style
$paragraph = $doc->createParagraph(
"TEST INSERT TEXT", "ComicMS11"
);
# use this paragraph as the text
# of the target frame
$doc->setTextBoxContent('test', $paragraph);
$doc->save("C:\\macros\\OOSjablonen\\test-out.odt");
|