use Spreadsheet::WriteExcel;
my $path="E:\\speakRecognize\\experiment\\data\\Result\\emotion_speaker"; #设置查询的目录
opendir(TEMPDIR, $path) or die "can't open it:$!";
my @dir = readdir TEMPDIR;#print join "\n",@dir;
close TEMPDIR;
#生成excel&设置输出格式
my $xlName = "Statistic.xls";
my $xl = Spreadsheet::WriteExcel->new($xlName);
my $xlsheet = $xl->add_worksheet("Sheet1"); #引号中为excel工作簿中表的名称
$xlsheet->freeze_panes(2, 0); #冻结首行
# Add a format
my @headFormat = ($xl->add_format(size=>'15',bg_color=>'21',align=>'center'), $xl->add_format(size=>'15',bg_color=>'25',align=>'center'));
my @dataFormat = ($xl->add_format(bg_color=>'22',align=>'right'), $xl->add_format(bg_color=>'23',align=>'right'));
my @staticFormat = ($xl->add_format(bg_color=>'21',align=>'right'), $xl->add_format(bg_color=>'25',align=>'right'));
my $bgColor = 0;
my @columns = qw(A B C D E F G H I J K L M N O P Q R S T);
使用perl创建Excel表格统计数据
最新推荐文章于 2024-06-16 17:46:30 发布