Skip Menu |

This queue is for tickets about the OpenOffice-OODoc CPAN distribution.

Report information
The Basics
Id: 54754
Status: resolved
Priority: 0/
Queue: OpenOffice-OODoc

People
Owner: Nobody in particular
Requestors: rlauer6 [...] comcast.net
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 2.112
Fixed in: (no value)



Subject: user defined fields
Not sure if this is a bug or intended behavior, but an ooStyle XPath object does not have the userFieldValue method...read on... While working with your package we discovered some interesting things about OO docs, namely that user defined field declarations can be in either the styles.xml, or the content.xml depending on how they are defined. Specifically we have found differences in how OO inserts declarations when you first define them while working with headers and footers (i.e. in the styles section of the document) - what's even odder is that is OO behaves differently (where it puts the decls) depending on whether the user defined fields are in tables or not. This appears to be a bug in OO itself...however back to the userFieldValue issue... It is possible to have user defined fields in headers & footers, yet the styles object instantiated with ooStyle does not have that method. We've gotten around it by using the XPath object itself, however, I thought you might like to know...
Le Jeu 18 Fév 2010 08:59:12, rlauer6@comcast.net a écrit : Show quoted text
> It is possible to have user defined fields in headers & footers, yet the > styles object instantiated with ooStyle does not have that method. > > We've gotten around it by using the XPath object itself, however, I > thought you might like to know...
Hm... while it's probably not so clear in the documentation, the explicit invocation of Style, XPath, Text and other OODoc submodules is not recommended. You should "use OpenOffice::OODoc" and instantiate the document objects through the common odfDocument() constructor. This constructor allows you to create objects that inherit all the features of ooStyle, ooText, ooImage and ooXPath. As a consequence, all the methods are available for the styles.xml part as well as for the content.xml part. Example: my $oofile = odfContainer("myfile.odt"); my $styles = odfDocument( container => $oofile, part => "styles" ); my $text = odfDocument( container => $oofile, part => "content" ); # ...process... # and save the changes $oofile->save(); Knowing that page styles, which are stored in the styles.xml part, may contain headers and footers that may contain image and text objects, an application that uses Styles, Text and/or Image separately is not practical. The Document compound module is intended to avoid such an issue. (For other explanations see http://search.cpan.org/dist/OpenOffice-OODoc/OODoc/Intro.pod#Dealing_with_styles_AND_content) Could you please try that and let me know the result ? I'm interested in any feed back about the user field issues with OODoc.
Hi, Could you please provide me with more details and code so I'll try to reenact the issue ? Or may I suppose it's resolved ?
Subject: Re: [rt.cpan.org #54754] user defined fields
Date: Sun, 28 Feb 2010 13:14:31 -0500
To: bug-OpenOffice-OODoc [...] rt.cpan.org
From: Rob Lauer <rlauer6 [...] comcast.net>
The issue is really not "a bug" as I indicated, it's more an omission. There is not UserFieldValue method on ::Style object although, as it turns out, there certainly can be user defined fields defined there. On Sun, Feb 28, 2010 at 12:57 PM, Jean-Marie Gouarné via RT <bug-OpenOffice-OODoc@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=54754 > > > Hi, > > Could you please provide me with more details and code so I'll try to > reenact the issue ? > > Or may I suppose it's resolved ? > >
-- Rob
Le Dim 28 Fév 2010 13:15:27, rlauer6@comcast.net a écrit : Show quoted text
> > There is not UserFieldValue method on ::Style object although, as it > turns out, there certainly can be user defined fields defined there. >
You are right; the user fields related to page styles are presently not supported by the OODoc user field method. I'll turn the issue into a wishlist item.
Now the following program works: my $styles = odfDocument ( file => "odftest.odt", part => 'styles' ); print $doc->userFieldValue("Toto") . "\n"; In addition, with 'styles' document part, the user is allowed to restrict the search context of getUserField() and userFieldValue() to a given master page. Example: my $styles = odfDocument(file => "odftest.odt", part => 'styles'); my $uf = $styles->getUserField("Foo", $styles->getMasterpage("Standard")); The last instruction returns the user field whose name is "Foo" if and only if it's declared with the definition of a master page (i.e. included in the definition of the page header or footer). So, the odfStyles() or ooStyles() constructor should not be used; the odfDocument() constructor creates an object that inherit all the features of ::Text, ::Styles, and others.