G'day ieeedino,

Welcome to the Monastery.

I do use the OpenOffice application a lot but have never used OpenOffice::OODoc (so I just installed it).

My system: Apache OpenOffice 4.1.1; OpenOffice::OODoc 2.125; Perl 5.22.0; Mac OS X 10.10.3

To test, I fired up the OpenOffice application, started a new text document, typed "Just a test.", saved as pm_1150577_odt_corruption.odt, and closed. I opened and closed this a couple of times: no problems; none were expected.

I then ran this code:

#!/usr/bin/env perl use strict; use warnings; use autodie qw{:all}; use OpenOffice::OODoc; my $document = odfDocument(file => 'pm_1150577_odt_corruption.odt');

Again, via the application, I opened and closed the file a couple of times. All good.

I then added this line (to the end of the code shown above) and ran the script again:

$document->save;

No errors or warnings were emitted on the command line; however, when I then attempted to open the file from the application, I got a popup with a message which starts:

The file 'pm_1150577_odt_corruption.odt' is corrupt and therefore cannot be opened. ...

I can't see anything in "Active bugs for OpenOffice-OODoc" relating to file corruption. I suggest you raise a bug report.

— Ken


In reply to Re: modify odt file with perl OpenOffice::OODoc will corrupt the file by kcott
in thread modify odt file with perl OpenOffice::OODoc will corrupt the file by ieeedino

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.