Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

How to use Spreadsheet-ParseExcel-0.2602 to extract the bgcolor of each cell

by Anonymous Monk
on Dec 10, 2003 at 10:20 UTC ( [id://313681]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
How can I use Spreadsheet-ParseExcel-0.2602 to extract the bgcolor of each cell.
There is a option "Fill" given in Spreadsheet::ParseExcel::Format but I am unable to use it to extract the bgcolor of each cell.
Can you let me know on how I can retrieve the bgcolor of each cell in the excel file.
Thankyou !
  • Comment on How to use Spreadsheet-ParseExcel-0.2602 to extract the bgcolor of each cell

Replies are listed 'Best First'.
Re: How to use Spreadsheet-ParseExcel-0.2602 to extract the bgcolor of each cell
by Aragorn (Curate) on Dec 10, 2003 at 11:51 UTC
    According to the documentation, Fill returns an arrayref [ Pattern, Front Color, Back Color ] where the color elements are some kind of index. The module also provides a method ColorIdxToRGB which accepts a color index.

    I've only read the documentation (I don't even use Windows or Excel :-), but it seems to me that it should be possible. What are you trying now in your code?

    Arjen

Re: How to use Spreadsheet-ParseExcel-0.2602 to extract the bgcolor of each cell
by young_david (Friar) on Dec 10, 2003 at 17:52 UTC

    Sorry, this piece of code is untested.

    foreach my $oWkS (@{$oBook->{Worksheet}}) { for(my $iR = $oWkS->{MinRow} ; defined $oWkS->{MaxRow} && $iR <= +$oWkS->{MaxRow} ; $iR++) { for(my $iC = $oWkS->{MinCol} ; defined $oWkS->{MaxCol} && $i +C <= $oWkS->{MaxCol} ; $iC++) { $oWkC = $oWkS->{Cells}[$iR][$iC]; my $Fill = $oWkC-{Format}->{Fill}; } } }

    $Fill will contain an array ref to a fill pattern.

    According to the documentation: $Fill->[0] = *Pattern* $Fill->[1] = *Front Color* $Fill->[2] = *Color*

    You can access other things like Border, Font, etc.

    my $Border = $oWkC-{Format}->{BdrStyle}; my $Font = $oWkC-{Format}->{Font}; . . . and so on

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://313681]
Approved by EvdB
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-26 04:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found