Subject: | If HTML cell contains Font tags, Excel ignores row format |
When I generate the following Excel XML file, and view it in Excel (I
have Excel 2010), the first row is colored blue (because I set the
format for that row), except the first cell, which still has white
background.
#!/usr/bin/perl
use warnings;
use strict;
use Spreadsheet::WriteExcelXML;
my $workbook = Spreadsheet::WriteExcelXML->new('test.xml');
my $worksheet = $workbook->add_worksheet;
my $blue_format = $workbook->add_format(bg_color => 'blue');
$worksheet->set_row(0, 15, $blue_format);
# Excel ignores row format for cell that contains Font tag
$worksheet->write_html_string(0, 0, '<Font
html:Color="#000000">f</Font><Font html:Color="#FF0000">oo</Font>');
# however, an HTML cell that does not contain HTML is displayed fine
$worksheet->write_html_string(0, 1, 'bar');
# you need to explicitly specify the format in order for it to work as
intended
$worksheet->write_html_string(0, 2, '<Font
html:Color="#000000">b</Font><Font html:Color="#FF0000">az</Font>',
$blue_format);
$workbook->close;