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 2005-09-14 15:41:47-07 by bob
Accessing contents of headers and footers
I'm puzzled as to how I can take a header(or footer) from a sxw file and then modify it.
I tried:
==== my $style_file="/varsav/office/dictation/templates/oodoc_guide.sxw"; my $doc = ooDocument(file => $style_file, member=>CONTENT); my $para = $doc->getHeaderParagraph(1,1); print "$para"; exit; ====
I tried various combinations for the page/number values to getHeaderParagraph without any luck. I tried calling ooDocument with
member=>STYLE
as well.
[ The motivation for this is to have a standard header that might contain the token 'TOPIC' and then replace it with the actual topic for a particular document. ]
Thanks for any help.
Bob
Direct Responses: 989 | 1006 | Write a response
Posted on 2005-09-14 19:43:35-07 by bob in response to 988
Re: Accessing contents of headers and footers
Perhaps I can around this by altering the META information.
Direct Responses: Write a response
Posted on 2005-09-16 21:59:07-07 by jmgdoc in response to 988
Re: Accessing contents of headers and footers

Caution ! Up to 2.007, getHeaderParagraph() and getFooterParagraph() are buggy. They work in 2.008, to be released soon (it's a matter of days, maybe hours).

But your code will never work as is. The first argument og getPageHeader() is a master page, not a page number. In text documents, the printable pages are dynamically generated by the office software; they are not persistent objects stored in the files. Headers and footers belong to page masters (which are persistent objects, used by the rendering software to dynamically build the printable pages).

Knowing that object numeric positions are zero-based, the number of the 1st patragraph is 0.

In addition, the master pages are generally described in the 'styles' workspace (neither in 'content' not in 'meta').

So, in order to get, say, the 1st paragraph of the header of the "Standard" (default) master page, you can write:
my $para = $doc->getHeaderParagraph("Standard", 0);

But you should wait 2.008 to try that.

Last remark: print $para will never print the text of the paragraph. getParagraphHeader() returns a paragraph element, which is a text container and not a text content. To print the content you should use write something like
print $doc->getText($para);
Direct Responses: Write a response