ParseExcel $font->{Color} Question?

T

T

Greetings,

I'm using the CPAN package Spreadsheet::parseExcel to try and get
values of the cells. This works fine until I try to get the color of
the font. I'm using the examples provide in the docs:

use Spreadsheet::parseExcel;

my $parser = Spreadsheet::parseExcel->new();
my $workbook = $parser->Parse('MyExcel.xls');

for my $worksheet ( $workbook->worksheets() ) {

my ( $row_min, $row_max ) = $worksheet->row_range();
my ( $col_min, $col_max ) = $worksheet->col_range();

for my $row ( $row_min .. $row_max ) {
for my $col ( $col_min .. $col_max ) {

my $cell = $worksheet->get_cell( $row, $col );
next unless $cell;
print "Row, Col = ($row, $col)\n";
print "Value = ", $cell->value(), "\n";
print "Unformatted = ", $cell->unformatted(), "\n";
print "\n";

my $formats = $cell->get_rich_text();

for my $aref (@$formats) {
my $font = $aref->[1];
print "Color = ", $font->{Color}, "\n";
}
}
}
}

Not sure what I'm doing wrong here, It looks like the get_rich_text
(), isn't returning anything. I'm just not sure why. Thanks for any
help in advance!

Tom
 
J

Justin C

Greetings,
Hello.

[snip]
my $formats = $cell->get_rich_text();

Not sure what I'm doing wrong here, It looks like the get_rich_text
(), isn't returning anything. I'm just not sure why. Thanks for any
help in advance!

I don't see get_rich_text() as an available method in the
Spreadsheet::parseExcel package. Ah, I see, you're using get_rich_text()
which is available in Spreadsheet::parseExcel::Cell, maybe you should
specify that module?

Justin.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top