I was able to get most of the code working, but am running into a few issues.
Here is the code:
CPAN::Forum
OpenOffice-OODoc - Working with headers and footers
| Posted on Wed Nov 15 10:22:34 2006 by budman |
| Working with headers and footers |
|
Hi,
I was able to get most of the code working, but am running into a few issues. Here is the code:
my $c = ooDocument(file => $filename, member => 'content', create => 'text');
my $s = ooDocument(file => $c, member => 'styles');
my $layout = $s->pageLayout("Standard");
my $master = $s->createMasterPage("NewStylePage",layout=>$layout);
my $header = $s->createParagraph("",style=>"Header");
$s->appendElement($header,$s->textField("title"));
$s->extendText($header,chr(160) x 30);
$s->appendElement($header,$s->textField("chapter"));
$s->masterPageExtension($master,"header",$header);
my $footer = $s->createParagraph("- ",style=>"Footer");
$s->appendElement($footer,$s->textField("page-number"));
$s->extendText($footer,' -');
$s->masterPageExtension($master,"footer",$footer);
This worked great so far. One problem, I can't seem to get the page-number to center. I tried updateStyle, and tried creating a new style, but it doesn't seem to apply. The header is working okay, but I would like to change it into a 1x2 Table, with border only on the bottom (maybe thickness 2), cell 1 left-justified, and cell 2 right-justified. I tried append table, but that didn't work. What would be the best way to go about this. This last question deals with setPageBreak. Currently, I have it working on Heading 1 and Heading 3, but I see an error msg when its executed. The breaks do occur, just wondering if the syntax is correct.
my $p = $c->appendParagraph(text=>$cat, style=>"Heading 1");
$c->setPageBreak($p,style=>'Heading 1',page=>"NewStylePage");
[OpenOffice::OODoc::Styles::createStyle] Style Heading 1 exists [OpenOffice::OODoc::Document::setPageBreak] Style Heading 1 creation failure [OpenOffice::OODoc::Styles::createStyle] Style Heading 3 exists [OpenOffice::OODoc::Document::setPageBreak] Style Heading 3 creation failure I tried using a different name, but the style didn't exist. Does this mean I should create a style 'xyz' just for page breaks? Can the page break attribute be applied to Heading1 and Heading3 styles? Lastly, is there a manual or doc site that has more examples setting attributes and styles? The module works great so far. My wife thanks you - I'm able to automate database entries into a document for her now. Saves her hours of formatting and layout. Thanks! :) Thanks, Rich |
| Direct Responses: 3563 | Write a response |
(4)
]