in reply to How can I use Spreadsheet::WriteExcel to write a url label without formatting it (turning ints to floats)
As chilledham points out it is Excel that is converting the number to a floating point format.
The way to avoid this (in Excel and Spreadsheet::WriteExcel) is to specify a cell format to ensure that the number is displayed in the way you want. You will also need to add some link style formatting to ensure it also looks like a link. Here is a working example:
#!/usr/bin/perl use warnings; use strict; use Spreadsheet::WriteExcel; my $workbook = Spreadsheet::WriteExcel->new( 'example.xls' ); my $worksheet = $workbook->add_worksheet(); my $link_format = $workbook->add_format( color => 'blue', underline => 1, num_format => 1, ); $worksheet->set_column( 'B:B', 20 ); $worksheet->write_url( 'A1', 'www.perl.com', 270751343164, $link_forma +t ); $worksheet->write_url( 'B1', 'www.perl.com', 270751343164, $link_forma +t ); __END__
The set_column() method call is there to show how to display the number since it is now larger than the cell.
--
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How can I use Spreadsheet::WriteExcel to write a url label without formatting it (turning ints to floats)
by uG (Scribe) on May 26, 2011 at 02:11 UTC |