Spread***::Parse & Write Excel
- From: Justin C <justin.0711@xxxxxxxxxxxxxx>
- Date: Tue, 30 Oct 2007 15:30:45 -0000
I get the following error when running my script:
Can't locate object method "get_xf_index" via package
"Spread***::ParseExcel::Format" at
/usr/local/share/perl/5.8.8/Spread***/WriteExcel/Work***.pm line
1453
It looks odd to me. It's saying it can't locate an object method from
one module in the second module. The two modules are un-related (apart
from the fact that they both deal with Excel files), neither is
dependant on the other.
This is probably due to the way I'm using ...::WriteExcel, and stems
from my not understanding the documentation for ...::ParseExcel. It
looks like it's written very much for OO coding, I'm not that advanced
and have been, probably, banging my head against it too hard.
Here is some code:
#!/usr/bin/perl
use warnings;
use strict;
use Spread***::ParseExcel;
use Spread***::WriteExcel;
my $inFile = "some.xls";
my $outFile = "output.xls";
my $lastCol = 9; # We don't want the data beyond this point
my $firstRow = 4;# counting from 0, 0-3 are the front page for printing
my $lastRow;
my $inBook = Spread***::ParseExcel::Workbook->Parse($inFile);
my $outBook = Spread***::WriteExcel->new($outFile);
my $out*** = $outBook->add_work***();
foreach my $in***(@{$inBook->{Work***}}) { # there's only one
$lastRow = $in***->{MaxRow};
foreach my $row ( $firstRow .. $lastRow) {
foreach my $col ( 0 .. $lastCol) {
# get contents of cell
my $cellcontent = $in***->{Cells}[$row][$col]->{_Value};
my $cellFormat = $in***->{Cells}[$row][$col]->{Format};
# write contents of cell to new work***
$out***->write_string($row-3, $col-5, $cell, $cellFormat);
}
}
}
*** END ***
$cellFormat contains a hash reference, AFAICT. I was hoping that that
would be accepted by the ...::WriteExcel and generate what I want.
Can anyone spot anything obviously wrong with the above that may help
me? Are there any Spread***::[Parse|Write]Excel experts here who have
suggestions?
I thank you for your help with this.
Justin.
--
Justin C, by the sea.
.
- Follow-Ups:
- Re: Spread***::Parse & Write Excel
- From: Jim Gibson
- Re: Spread***::Parse & Write Excel
- Prev by Date: FAQ 8.25 How can I capture STDERR from an external command?
- Next by Date: Perl and modifying a PDF document
- Previous by thread: FAQ 8.25 How can I capture STDERR from an external command?
- Next by thread: Re: Spread***::Parse & Write Excel
- Index(es):