jmcnamara/excel-writer-xlsx

Unable to set font color for text

rfulbrig opened this issue · 3 comments

When I run the code below I get the error message "Unknown method: Excel::Writer::XLSX::Format::set_font_color".

I am running Strawberry Perl 5.24.1 on Windows 10 and module version 1.03.

#!/usr/bin/perl
use strict;
use warnings;
use Excel::Writer::XLSX;

my $workbook = Excel::Writer::XLSX->new( 'test.xlsx' );
my $worksheet = $workbook->add_worksheet("Sheet1");
my $format = $workbook->add_format();

$format->set_font_color( 'red' );
$worksheet->write( 'A1', 'test' );
$workbook->close() if defined $workbook;

The method you are looking for is set_color(): https://metacpan.org/pod/Excel::Writer::XLSX#set_color()

It might be helpful to remove "set_font_color()" from the docs.

Thanks. Done.