Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1167097]
[marto]: I really should have stayed in bed today
[choroba]: exceptions to this rule are rare

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2018-03-20 10:44 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (250 votes). Check out past polls.