barathbr has asked for the wisdom of the Perl Monks concerning the following question:
set style sub:sub create_style { my $document = shift; my $fontname = shift; my $font_size = shift; my $bold = shift; my $italic = shift; my $style = $document->Styles->Add($cur_style); my $style_font = $style->{Font}; $style_font -> {Name } = $fontname; $style_font -> {Size } = $font_size; $style_font -> {Bold } = $bold; $style_font -> {Italic} = $italic; my %style; $style{name} = $cur_style++; return \%style; }
create style with:sub set_style { my $document = shift; my $style_arg = shift; $document->ActiveWindow->Selection -> {Style} = $style_arg -> {name} +; }
I set the actual font like so:my $st_normal_10_trebuchetMS = create_style($document, "Trebuchet MS +", 10, 0, 0); my $st_italic_10_trebuchetMS = create_style($document, "Trebuchet MS +", 10, 0, 1);
But during execution, it sets "ER:" to bold and immediately afterwards when I throw in the other style arg, it converts "ER:" also to NOT bold.elsif ($col == 10) { set_style($document, $st_bold_10_trebuchetMS); text ($document, "ER: "); set_style($document, $st_normal_10_trebuchetMS); text ($document, "$value"); }
I "think" the context is a global one dont know for sure. And I dont know exactly what to fix. Pl. note that this is the first time I am playing with OLE objects and perl.my $document = $Word->Documents->Add; my $selection = $Word->Selection;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl & Word (OLE objects query not exactly on perl)
by PodMaster (Abbot) on Feb 01, 2005 at 11:56 UTC | |
by barathbr (Scribe) on Feb 01, 2005 at 12:10 UTC | |
by PodMaster (Abbot) on Feb 01, 2005 at 12:23 UTC | |
by barathbr (Scribe) on Feb 02, 2005 at 06:27 UTC |