in reply to OLE & Excel

with $sheet->Columns($Range) { ColumnWidth =>1; }
Is the correct syntax I believe... It's untested.... and as a rule I agree.. don't use with... its just a fancy proprietary way of setting attributes.

Grygonos

Replies are listed 'Best First'.
Re: Re: OLE & Excel
by Saadat_saeed (Initiate) on Mar 11, 2004 at 13:20 UTC
    I am a newcommer to Perl & programming in general - but if not use "with" then what do I use?

      Set the attributes manuslly like this

      $sheet->Range("A1:J18")->Font->{Size} = 9; #Center the sheet $sheet->Range("A1:J18")->{HorizontalAlignment} = $$xlConst{'xlHAli +gnCenter'}; #Label Averages and Totals $sheet->Range("A17")->{Value} = "Sums"; $sheet->Range("A18")->{Value} = "Averages"; #Put the values in $sheet->Range("A1")->{Value} = "Performance:"; $sheet->Range("C1")->{Value} = $client; #Format the fonts $sheet->Range("A1")->Font->{Bold} = TRUE; $sheet->Range("A17:A18")->Font->{Bold} = TRUE; $sheet->Range("C1")->Font->{Italic} = TRUE;
      That is a snippet from an Win32::OLE report I did. with is just a fancy way of saying set the following parameters for this object...

      To explain this in natural language, you could say

      take my dog and{ wash ; dry ; feed ; }
      which would be like using a with block as opposed to
      wash my dog; dry my dog; feed my dog;
      which is just setting those things explicitly. the with block is syntacticaly tyrrany I tell you !!!!!


      Grygonos