[英]Usage of set_row in Excel module in perl
I am learning to write in Excel with a script in perl.我正在学习用 perl 中的脚本在 Excel 中编写。 I am using set_row to increase height of a cell.
我正在使用 set_row 来增加单元格的高度。 Currently i am using below to increase the height
目前我正在使用下面来增加高度
$worksheet->set_row(0,40);
$worksheet->set_row(1,40);
...
Is there any way to do for all rows.有没有办法为所有行做。 Also is it possible to increase assymnetric height.
也有可能增加不对称高度。 like 1 row 20, second row 40, third row 15 etc
比如1排20,第二排40,第三排15等
Thanks in Advance提前致谢
To automate the configuration of row heights, you could store all of your height information in a hash, then loop over the hash keys (ie. row numbers) and call the set_row()
method using the row number along with the corresponding value in the hash (ie. row height).要自动配置行高,您可以将所有高度信息存储在哈希中,然后遍历哈希键(即行号)并使用行号以及相应的值调用
set_row()
方法哈希(即行高)。
my %row_height_map = (
0 => 40,
1 => 25,
2 => 30
);
for my $row_number (keys %row_height_map) {
$worksheet->set_row($row_number, $row_height_map{$row_number});
}
Note that you could also use an array to store the values, but with a hash you can arbitrarily leave out row numbers you don't want modified.请注意,您也可以使用数组来存储值,但是使用散列可以任意省略您不想修改的行号。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.