in reply to write_rich_string Excel::Writer::XLSX
You seem to be treating $red like it is a scalar value that contains a string. This is not the case. Your $red variable contains a Excel::Writer::XLSX::Format object. The write_rich_string function takes a mixed list of strings and Excel::Writer::XLSX::Format references as arguments and then constructs the formatted string that is placed in the worksheet.
In your code, this line:
will result in the string contained in $row_markup being placed in the worksheet verbatim. Here is a bit of code that might help clear things up:$worksheet->write_rich_string($i, $j, $row_markup);
Output:#!/usr/bin/env perl use strict; use warnings; use Excel::Writer::XLSX; my $workbook = Excel::Writer::XLSX->new( 'test.xlsx' ); my $red = $workbook->add_format( color => 'red' ); print "\$red is a: ", ref($red), "\n"; print "\$red stringifies to: ", $red, "\n"; exit;
$red is a: Excel::Writer::XLSX::Format $red stringifies to: Excel::Writer::XLSX::Format=HASH(0x7f8c741a4f78)
In Section
Seekers of Perl Wisdom