Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: Adding Borders to Excel Data (Excel::Writer)

by poj (Priest)
on Jul 05, 2014 at 08:58 UTC ( #1092353=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Adding Borders to Excel Data (Excel::Writer)
in thread Adding Borders to Excel Data (Excel::Writer)

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


Comment on Re^3: Adding Borders to Excel Data (Excel::Writer)
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1092353]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2014-09-16 06:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (157 votes), past polls