Hi Monks How do i get text from a frame and ad text into a frame with OpenOffice::OODoc I started with a code to select te frame by name but got errors
use strict; use OpenOffice::OODoc; use OpenOffice::OODoc::Meta; use OpenOffice::OODoc::XPath ; use OpenOffice::OODoc::Image; &test; sub test { my $doc = ooDocument(file => "C:\\macros\\OOSjablonen\\test.odt") ; my $element = getFrameElement('frame_name'); print "el: $element text:\n"; }
gives error: Undefined subroutine &main::getFrameElement called at C:\scripts\test1.pl line 10. what is wrong ?
use strict; use OpenOffice::OODoc; use OpenOffice::OODoc::Meta; use OpenOffice::OODoc::XPath ; use OpenOffice::OODoc::Image; &test; sub test { my $doc = ooDocument(file => "C:\\macros\\OOSjablonen\\test.odt") ; my $element = OpenOffice::OODoc::XPath::getFrameElement('frame_name'); print "el: $element text:\n"; }
gives: Use of uninitialized value $element in concatenation (.) or string at C:\scripts\test1.pl line 11.
This is correct because i do not give a certain two values to the subroutine getFrameElement
i need to give someting like $self ?
sub getFrameElement { my $self = shift; my $frame = shift; return undef unless defined $frame; my $tag = shift || 'draw:frame'; my $element = undef; if (ref $frame) { $element = $frame; } else { if ($frame =~ /^[\-0-9]*$/) { return $self->getElement("//$tag", $frame, @_); } else { return $self->selectFrameElementByName ($frame, $tag, @_); } } }
thks for giving me a answer

In reply to OpenOffice::OODoc I need to add text into a frame by harryC

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.