Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: write_rich_string Excel::Writer::XLSX

by kevbot (Priest)
on Jul 04, 2016 at 00:27 UTC ( #1167097=note: print w/replies, xml ) Need Help??


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:

$worksheet->write_rich_string($i, $j, $row_markup);

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:
#!/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;
Output:
$red is a: Excel::Writer::XLSX::Format $red stringifies to: Excel::Writer::XLSX::Format=HASH(0x7f8c741a4f78)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1167097]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2018-07-18 14:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (393 votes). Check out past polls.

    Notices?