I can work around the issue by making use of nbsp:

use warnings; use strict; use OpenOffice::OODoc; use File::Copy; use Encode; my ($i, $my_text); my @Fnames = ('test.php'); # files to read into document copy "test.odt.tmpl", "test.odt"; my $doc_out = odfDocument(file => 'test.odt'); # setup output # ====== add files into output document ====== foreach(@Fnames) # process each php file { open(my $file, "<", $_) or die "Error reading $_: $!"; $my_text = ""; # init for (<$file>) { # \x{A0} is &nbsp; s/^( +)/"\x{A0}"x(length($1))/e; $my_text .= $_; } $doc_out -> appendParagraph(text => encode('UTF-8',$my_text), style => "Default"); # write a full php + file to odt } $doc_out -> save; # done

I also made a few perly and safety changes. The heart of the solution is the s/// and the encode(). My openoffice draws the non-breaking spaces with a different background color which is a bit distracting. I'm not sure if that can be worked around.

Good Day,
    Dean


In reply to Re: OODoc Document Formatting Problems by duelafn
in thread OODoc Document Formatting Problems by Bruce32903

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.