in reply to OODoc Document Formatting Problems
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 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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: OODoc Document Formatting Problems
by Bruce32903 (Scribe) on Apr 13, 2011 at 15:33 UTC |