Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to align a given cell using Win32::OLE (either center, left, right).
$worksheet->Cells($cell,2)->{Value} = "$myvariable"; $worksheet->Cells(1,2)->Font->{Bold} = "True"; $worksheet->Cells(1,2)->Font->{Size} = 15; $worksheet->Cells(1,2)->Font->{ColorIndex} = 5;

And now I would like to add a property to right align this row

Thankyou


Will donate when graduate in 3 weeks ;-)

Janitored by Arunbear - added code tags, as per Monastery guidelines

Replies are listed 'Best First'.
Re: Win32::OLE alignment
by NetWallah (Canon) on Nov 01, 2004 at 20:44 UTC
    Untested:
    my $xlRight = -4152; $worksheet->Cells(1,2)->{HorizontalAlignment} = $xlRight;

        Earth first! (We'll rob the other planets later)

      That is correct. However I would reccomend importing the Excel constants via

      #Load a hash reference to Excel's constants in the scalar ref $xlC +onst my $xlConst = Win32::OLE::Const->Load('Microsoft Excel 8.0 Object +Library');
      and using $worksheet->Cells(1,2)->{HorizontalAlignment} = $xlConst->{'xlRight'};
Re: Win32::OLE alignment
by Anonymous Monk on Nov 02, 2004 at 02:52 UTC
    Thankyou very much.Exactly what I wanted. ;)