RE: XL column width
by Ken Cornetet other posts by this author
Nov 5 2002 7:39PM messages near this date
view in the new Beta List Site
RE: Disabling the x in a window.
|
Win32::TieRegistry Question
How about an alternate method.
Write your file as an HTML table and use WIDTH keywords in your columns.
Name your output file WhatEver.XLS and viola! Excel (and windows) treats it
pretty much like any other Excel file.
No OLE needed.
-----Original Message-----
From: Al Caraciolo [mailto:al.caraciolo@[...].com]
Sent: Tuesday, November 05, 2002 1:44 PM
To: Perl Users
Subject: XL column width
Hi guys,
I'm trying to build a PERL routine that creates and formats an excel CSV
file so when it opens on the users desk top, all the columns etc. are
properly shown. Below is a sampling of that part of the code responsible
for processing the excel file. The line
"$worksheet-> Columns("D:D")->{'Select'};" does a selection of the entire
column but then I don't know how to construct the statement that would set
the Column Width to 15. The VBA code to accomplish this is:
Columns("D:D").Select
Selection.ColumnWidth = 15
Would greatly appreciate if anyone can show me how to convert the VBA
'Selection.ColumnWidth = 15' to an acceptable PERL Win32::OLE statement.
As always thank you
Al
#!perl -w
#
# Excel select test
use strict;
use Win32::OLE;
my $xlfile ='c:\perl\894.csv';
my $xlapp = Win32::OLE-> new("Excel.Application");
$xlapp-> {'Visible'} = 1;
my $workbook = $xlapp-> Workbooks->Open($xlfile);
my $worksheet = $workbook-> Worksheets(1);
$worksheet-> Columns("D:D")->{'Select'}; # Entire column is selected
### - how do I construct the ColumnWidth statement
.
.
.
.
.
.
.
$xlapp-> ActiveWorkbook->Close(0);
$xlapp-> Quit();
_______________________________________________
Perl-Win32-Users mailing list Perl-Win32-Users@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
|