Skip Menu |

This queue is for tickets about the Spreadsheet-WriteExcelXML CPAN distribution.

Report information
The Basics
Id: 60258
Status: resolved
Priority: 0/
Queue: Spreadsheet-WriteExcelXML

People
Owner: Nobody in particular
Requestors: justincase [...] yopmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.11
Fixed in: (no value)



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;
On Wed Aug 11 17:15:37 2010, justincase wrote: Show quoted text
> 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; >
Hi, In general, in Excel, the cell format overrides the row format which in turn overrides the column format. So, the effect that you are seeing is Excel's default behaviour. WriteExcelXML has no influence on it. John. --
From: justincase [...] yopmail.com
On Mon Aug 16 04:10:25 2010, JMCNAMARA wrote: Show quoted text
> On Wed Aug 11 17:15:37 2010, justincase wrote:
> > 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; > >
> > Hi, > > In general, in Excel, the cell format overrides the row format which in > turn overrides the column format. > > So, the effect that you are seeing is Excel's default behaviour. > WriteExcelXML has no influence on it. > > John.
But there is no cell format for the first cell.
On Mon Aug 16 20:43:38 2010, justincase wrote: Show quoted text
> > In general, in Excel, the cell format overrides the row format which in > > turn overrides the column format. > > > > So, the effect that you are seeing is Excel's default behaviour. > > WriteExcelXML has no influence on it. > >
> > But there is no cell format for the first cell.
Hi Justin, It would seen that Excel interprets the Html code as formatting and uses it to override the row format. As such there isn't anything that WriteExcelXML can do to change this behavioiur. So if you don't have any objections I will close this issue. John. --
Closing this issue for the reasons given in the RT system and since there were no objections. John. --