#!/usr/bin/perluse Spreadsheet::WriteExcel;use Encode;#(这里增加Encode)#************生成Excel文档****************my $xl = Spreadsheet::WriteExcel->new("TEST.xls");#生成Excel表my $xlsheet = $xl->add_worksheet(decode('utf8' ,“测试写入Excel”));#(中文名称)#添加格式(表头)$rptheader = $xl->add_format(); # Add a format$rptheader->set_bold();$rptheader->set_size('12');$rptheader->set_align('center');#添加格式(表内容)$normcell = $xl->add_format(); # Add a format$normcell->set_size('9');$normcell->set_align('center');$normcell->set_bg_color('22');#设置列的宽度$xlsheet->set_column('A:A',10);$xlsheet->set_column('B:B',12);$xlsheet->set_column('C:C',17);#写表头(格式是使用上面添加的表头格式)(这里是输入中文)$xlsheet->write("A2",decode(‘utf8’,"号码"), $rptheader);$xlsheet->write("B2", decode(‘utf8’,"名称"),$rptheader);$xlsheet->write("C2", decode(‘utf8’,"语言"),$rptheader);#写内容(格式是使用上面添加的表内容格式)(这里是输入中文)$xlsheet->write("A3", decode(‘utf8’,"1"), $normcell);$xlsheet->write("B3", decode(‘utf8’,"测试"),$normcell);$xlsheet->write("C3", decode(‘utf8’,"Perl"),$normcell);#关闭操作excel的对象.$xl->close();#!/usr/bin/perluse Spreadsheet::WriteExcel;use Enc 你的当前访问异常,请进行认证后继续阅读剩余内容。 提交