in reply to Re: Style problem with Word/OLE
in thread Style problem with Word/OLE
I tried numerous ways but the only one I found that preserved the style was to store it on a first pass and re-apply it on a second pass like this.
pojmy $paragraphs = $file->Paragraphs(); my $n = $paragraphs->Count(); my @style=(); # add for my $p (1..$n) { my $paragraph = $paragraphs->Item( $p ); print "paragraph $p\n"; print "before: $paragraph->{Style}->{NameLocal}\n"; $style[$p] = $paragraph->{Style}->{NameLocal}; # add my $text = $paragraph->{Range}->{Text}; $paragraph->{Range}->{Text} = $text; } for my $p (1..$n) { my $paragraph = $paragraphs->Item( $p ); $paragraph->{Style} = $style[$p]; # add print "after: $paragraph->{Style}->{NameLocal}\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Style problem with Word/OLE
by IlanB (Initiate) on Jul 08, 2013 at 07:58 UTC |