ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-win32-users
perl-win32-users
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved