Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: write_rich_string Excel::Writer::XLSX

by kevbot (Vicar)
on Jul 04, 2016 at 00:27 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1167097]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-19 05:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found