Posted on 2007-05-04 11:57:51-07 by jonb19871
userFieldValue: Does it work for user defined variables?
I am trying to access user defined variables, and cannot! These are defined in openoffice via the menus...

Insert-Fields-Other

then selecting the "Variables" tab, and the Type "User Field".

My perl to access it is...

#!/usr/bin/perl use OpenOffice::OODoc; my $docpath = shift; my $archive = ooFile($docpath); my $doc = ooDocument(archive => $archive); ## For user defined variable fields my $meta = ooMeta(archive => $archive); ## For document properties my $f; foreach $fname qw(MyTestfield ReleaseDate MyOtherField) { if ($f = $doc->userFieldValue($fname)) { ## Got it print "Got it: $f\n"; } else { print "FAILED $fname\n"; } }
Yet when I run this I get

FAILED MyTestfield
FAILED ReleaseDate
FAILED MyOtherField

I have also tried the function "variableValue()", but it also returns nothing.

I have placed my test document here

Thanks in advance!

Jon B
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.