use $workbook->addformat() to setup the format.  Then
$worksheet->set_column() to apply it to the spreadsheet.



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gary
Nielson
Sent: Saturday, May 08, 2004 4:36 PM
To: 'Gary Nielson'; [EMAIL PROTECTED]
Subject: RE: Help with Spreadsheet::WriteExcel


Here's an update... I have been playing around with the spreadsheet
converted by Spreadsheet::WriteExcel from an ASCII tab-delimited file.
The
first column is a date, yet I notice when checking cell formatting that
it
is in general format. I think this is my problem, but I do not know how
to
dictate in my script that the first column of every row be in date
format as
in 3/14/2004. Any help appreciated. 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gary
Nielson
Sent: Saturday, May 08, 2004 11:09 AM
To: [EMAIL PROTECTED]
Subject: Help with Spreadsheet::WriteExcel

I am using Spreadsheet::WriteExcel to get all files in a directory and
convert them from tab-delimited text to xls format. When I import them
manually, my subsequent formula works fine. However, when I use the same
formula on the converted file, I get a #DIV/0!. I notice that in the
last
cell on each line (not used in the formula) contains an "empty box"
ASCII
character, so I am wondering, do I have hidden ASCII characters in these
converted files that are interfering with the formula? Or is there
another
problem that is causing the problem? How do I get around this?

my @lines =`ls -1 $tc2000`;
print @lines;
foreach $file (@lines) {

    chomp($file);
    print "$file...\n";
    # Open the tab-delimited file
    open (HISTFILE, "$tc2000$file") or die "$tc2000$file: $!";
    $excel = $file;
    $excel =~ s/\.txt/\.xls/;
    # Create a new Excel workbook

    my $workbook  = Spreadsheet::WriteExcel->new("$tc2000$excel");
    my $worksheet = $workbook->addworksheet();
    # Row and column are zero indexed
    my $row = 0;

    while (<HISTFILE>) {
       chomp;
       # Split on single tab
       my @Fld = split('\t', $_);

       my $col = 0;
       foreach my $token (@Fld) {
           $worksheet->write($row, $col, $token);
           $col++;
       }
       $row++;
    }




}

close HISTFILE;


_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to