Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: spreadsheet writeexcel

by jmcnamara (Monsignor)
on Sep 26, 2011 at 14:55 UTC ( #927891=note: print w/replies, xml ) Need Help??

in reply to spreadsheet writeexcel

If you mean "all the combinations" in one cell then you can't do it with Spreadsheet::WriteExcel since it only allows one format object per cell and features like super/subscript are mutually exclusive.

You can add multiple formats to text with Excel::Writer::XLSX which is (more or less) a drop in replacement for Spreadsheet::WriteExcel.

See the example in the distro.


Replies are listed 'Best First'.
Re^2: spreadsheet writeexcel
by virtuemart1 (Initiate) on Oct 12, 2011 at 09:45 UTC
    I am new to Perl and hope where is the right place to post.
    What I want is simply update Excel file. The following code is by jmcnamara.
    Source was this link:
    #!/usr/local/bin/perl -wT print "Content-type: text/html\n\n"; use strict; use Spreadsheet::ParseExcel; use Spreadsheet::ParseExcel::SaveParser; my $parser = Spreadsheet::ParseExcel->new(); my $workbookR = $parser->parse('file2.xls'); my $worksheetR = $workbookR->worksheet(0); my ( $row_min, $row_max ) = $worksheetR->row_range(); my ( $col_min, $col_max ) = $worksheetR->col_range(); print "row min:$row_min row_max:$row_max col_max:$col_max\n\n"; # Open the template with SaveParser my $parser2 = new Spreadsheet::ParseExcel::SaveParser; my $template = $parser2->Parse('file2.xls'); my $sheet = 0; my $row = 0; my $col = 0; # Get the format from the cell my $format = $template->{Worksheet}[$sheet] ->{Cells}[$row][$col] ->{FormatNo}; my $workbook; { # SaveAs generates a lot of harmless warnings about unset # Worksheet properties. You can ignore them if you wish. local $^W = 0; # Rewrite the file or save as a new file $workbook = $template->SaveAs('file2.xls'); } # Use Spreadsheet::WriteExcel methods my $worksheet = $workbook->sheets(0); if($row_max == -1){ for my $i (0..4){ $worksheet->write(0, $i, "A$i", $format); }} for my $i (0..$col_max){ $worksheet->write($row_max+1, $i, "B$i", $format); # not work } $workbookR->close(); $workbook->close();

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://927891]
[james28909]: well i have officially wore my brains out on hash refs and array refs and hash of arrays
[james28909]: push @{$hash{$ref}}, $this, $that, $the_other;
[james28909]: for 0 .. 3 {print $hash{$ref}}$_;
[james28909]: or i guess that is a hash ref
[james28909]: hash of array ref <.<
[james28909]: im also about to embark on porting the discord api to perl, without having to have 400 dependencies...
[james28909]: would be nice to link doscord to irc and other services

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2017-05-01 03:40 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (544 votes). Check out past polls.