#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2010
    Posts
    81
    Rep Power
    5

    Using the OpenOffice::OODoc module


    Does anyone have any experience with this module??

    I'm having a hard time trying to wrap my head around the syntax.
    Namely the substituteText and replaceText parts.

    Basically I want to read a list of names and addresses from a CSV or
    OPen Office spreadsheet and put them in a .odt file.

    I figured I start small and see if I could just replace some text in an .odt file, but after reading the docs on CPAN and trying it myself, i'n not suree if I understand how the syntax should be. specially the paragraph value $p, using the docs at OpenOffice::OODoc::Text

    http://search.cpan.org/dist/OpenOffice-OODoc/

    This is the error Im getting:
    Name "main:" used only once: possible typo at ChangeName.pl line 8.
    Use of uninitialized value in lc at /usr/local/share/perl/5.14.2/OpenOffice/OODoc/File.pm line 378.

    This is the code I tried:
    Code:
    #!usr/binperl -w  
    use OpenOffice::OODoc;  
    my $contact = "New Name";
    my $doc = odfText(file => 'Thank_You_Testing.odt');
     $doc->substituteText($p,"C(LIENT|USTOMER)", $contact);
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    1
    Rep Power
    0
    Have you tried it to relocate from the .odt file? I guess there is remedy which prominently works for you..
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2010
    Posts
    81
    Rep Power
    5
    What do you mean 'relocate'?
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2012
    Posts
    836
    Rep Power
    496
    The warning tells you that the $p variable is used only once. This is likeky to be an error, since a variable should pr'=esumably be initialized at one place and used at another one (at least).
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2010
    Posts
    81
    Rep Power
    5
    Originally Posted by Laurent_R
    The warning tells you that the $p variable is used only once. This is likeky to be an error, since a variable should pr'=esumably be initialized at one place and used at another one (at least).
    Ahh Ok.
    This is where I didn't understand the docs on this module.

    According to the docs the $p value is the paragraph variable, Or at least I think so.

    Exactly what should the value of $p should be?
    How do I assing a paragarph to the variable $p??

IMN logo majestic logo threadwatch logo seochat tools logo