I am trying to understand Excel::Writer::XLSX module by study the samples at CPAN site.
One of the sample code is at this link:
The implementation I am trying to understand listed below (my comments are in blue):
If I modified the code above in red like below:
then the width of the first column will be overwritten.
Is this the way supposed to be?
In general, please take a look at a block of codes below:
I feel a bit odd. To me, both implementations should work.
Could someone explain it to me? Many thanks.
One of the sample code is at this link:
The implementation I am trying to understand listed below (my comments are in blue):
Code:
my $worksheet = $workbook->add_worksheet( 'Fonts' );
$worksheet->set_column( 0, 0, 30 ); [COLOR=blue]# First row, First column, width is 30[/color]
[COLOR=red]$worksheet->set_column( 1, 1, 10 );[/color] [COLOR=blue]# Second row, Second column, width is 10[/color]
If I modified the code above in red like below:
Code:
[b]$worksheet->set_column( 0, 1, 10 );[/b]
Is this the way supposed to be?
In general, please take a look at a block of codes below:
Code:
for(my $i = 0, $i < 10; $i++) {
my $width = 20 + $i;
[COLOR=red]$worksheet->set_column( 0, $i, $width ); # This line does not work. All columns will have the same width! [/color]
[b]#$worksheet->set_column( $i, $i, $width ); # This is the correct implementation.[/b]
}
I feel a bit odd. To me, both implementations should work.
Could someone explain it to me? Many thanks.