in reply to Adding Borders to Excel Data (Excel::Writer)

If you have the prerequisite VB fu, create an Excel macro and convert that to Perl. Not guaranteed to be easy if starting from ground zero, but if you have some relevant experience with VB, conversion should be almost painless (... or so say some :-) experts ).


check Ln42!

  • Comment on Re: Adding Borders to Excel Data (Excel::Writer)

Replies are listed 'Best First'.
Re^2: Adding Borders to Excel Data (Excel::Writer)
by GuiPerl (Acolyte) on Jul 04, 2014 at 20:45 UTC
    I would really appreciate an example as to how the above can be accomplished with one of the suggested modules if not otherwise.

      Take a look at Using Win32::OLE and Excel - Tips and Tricks.

      This code demo shows how to remove the borders around a cell. You could adapt this to scan down the columns and use some logic around previous cell,next cell to remove the borders you don't want.

      #!perl use strict; use Win32::OLE::Const 'Microsoft Excel'; Win32::OLE->Option(Warn => 3); my $ex = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); # change filename to suit my $wb = $ex->Workbooks->Open('c:\\temp\\border.xls') ; my $ws = $wb->sheets(1); my $cell = $ws->Cells(7,2); # b7 $cell->Borders(7)->{LineStyle} = xlNone; #left $cell->Borders(8)->{LineStyle} = xlNone; #top $cell->Borders(9)->{LineStyle} = xlNone; #bottom $cell->Borders(10)->{LineStyle} = xlNone; #right # save and exit $wb->SaveAs( 'c:\\temp\\changedborder.xls' );
      poj