in reply to Re: OLE & Excel
in thread OLE & Excel

I am a newcommer to Perl & programming in general - but if not use "with" then what do I use?

Replies are listed 'Best First'.
Re: Re: Re: OLE & Excel
by Grygonos (Chaplain) on Mar 11, 2004 at 15:10 UTC

    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