in reply to Re: Getting the background color of a cell in an existing Excel spreadsheet
in thread Getting the background color of a cell in an existing Excel spreadsheet

There is no "ColorIdxToRGB" ... the correct syntax is:
$workbook->color_idx_to_rgb( $format->{Fill}[1] )
  • Comment on Re^2: Getting the background color of a cell in an existing Excel spreadsheet
  • Download Code

Replies are listed 'Best First'.
Re^3: Getting the background color of a cell in an existing Excel spreadsheet
by thanos1983 (Parson) on Apr 19, 2017 at 22:28 UTC

    Hello duyet,

    Just to add both methods can be used, I just test it:

    my $sRGB = $parser->ColorIdxToRGB($format->{Fill}->[2]); my $sRGB_2 = $workbook->color_idx_to_rgb($format->{Fill}->[2]);

    Also from the source code of the Spreadsheet::ParseExcel:

    #--------------------------------------------------------------------- +--------- # ColorIdxToRGB (for Spreadsheet::ParseExcel) # # Returns for most recently opened book for compatibility, use # Workbook::color_idx_to_rgb instead # #--------------------------------------------------------------------- +--------- sub ColorIdxToRGB { my ( $sPkg, $iIdx ) = @_; unless( defined $currentbook ) { return ( ( defined $aColor[$iIdx] ) ? $aColor[$iIdx] : $aColor[0] +); } return $currentbook->color_idx_to_rgb( $iIdx ); }
    Seeking for Perl wisdom...on the process of learning...not there...yet!