I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2006-09-14 19:24:22-07 by jeunice in response to 3030
Re: create a new empty odt file and change the style properties

So, two problems that I see:

(1) OpenOffice has both internal and external (display) style names. The main difference is that spaces are replaced with '_20_', so that 'Text body' becomes 'Text_20_body' in the XML representation. Given your request, the updateStyle code eventually asks for a style with attribute style:name="Text body"--and there is no such style. There is, however, a style with style:display-name="Text body" and style:name="Text_20_body" attributes. Solution: Ask for the internal style name (which you can easily arrive at with a simple substitution).

(2) I don't know where your variable $content is defined, but it isn't properly initialized in the code you provided.

Try this code, instead:

use OpenOffice::OODoc; $document = ooDocument ( file => 'test.odt', create => 'text' ) or print " can not create $filename! \n"; $document->save; $style = ooDocument ( file => 'test.odt', member => 'styles', ) or print " can not open document.odt styles ! \n"; $style->updateStyle ( 'Text_20_body', properties => { 'area' => 'text', 'fo:font-size' => "8pt", 'style:font-name' => 'Verdana' } ) or print " can't updateStyle $LINE!\n" ; $style->save("test.odt"); $document = ooDocument ( file => 'test.odt', ) or print " can not create $filename! \n"; $document->appendParagraph ( text => 'Text body content', style => 'Text_20_body' ); $document->save("test.odt");
Direct Responses: 3035 | Write a response