Unable to set font color for text
rfulbrig opened this issue · 3 comments
rfulbrig commented
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;
jmcnamara commented
The method you are looking for is set_color()
: https://metacpan.org/pod/Excel::Writer::XLSX#set_color()
rfulbrig commented
Thank you, John. Works fine now. And thank you for this marvelous module! I have found so many uses for it (home, work, church, etc). It might be helpful to remove "set_font_color()" from the docs. Thanks again.
Best regards,
Roy
…________________________________
From: John McNamara <notifications@github.com>
Sent: Thursday, March 12, 2020 8:17 PM
To: jmcnamara/excel-writer-xlsx <excel-writer-xlsx@noreply.github.com>
Cc: rfulbrig <rfulbrig@hotmail.com>; Author <author@noreply.github.com>
Subject: Re: [jmcnamara/excel-writer-xlsx] Unable to set font color for text (#253)
The method you are looking for is set_color(): https://metacpan.org/pod/Excel::Writer::XLSX#set_color()<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmetacpan.org%2Fpod%2FExcel%3A%3AWriter%3A%3AXLSX%23set_color()&data=02%7C01%7C%7Ce00b364bc5674ff5dca008d7c6e3e9c6%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637196554482746504&sdata=znzrlKKbmu0UOQ5yLINevCXRvD701HmkOXgPT%2FF8D98%3D&reserved=0>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjmcnamara%2Fexcel-writer-xlsx%2Fissues%2F253%23issuecomment-598487596&data=02%7C01%7C%7Ce00b364bc5674ff5dca008d7c6e3e9c6%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637196554482756499&sdata=i6o9FhQ9gCY6BW9z11eI2Yd7qZhRpHk9Lgu%2BIkMAxv8%3D&reserved=0>, or unsubscribe<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAB5KZVL7RLXUVCA6RDXYXLRHF3RNANCNFSM4LGXC5MQ&data=02%7C01%7C%7Ce00b364bc5674ff5dca008d7c6e3e9c6%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637196554482766500&sdata=1SqT7J%2B0eaCKRA7yjZr%2FR7vUUWgZpf5os8iYvQmynfc%3D&reserved=0>.
jmcnamara commented
It might be helpful to remove "set_font_color()" from the docs.
Thanks. Done.