读书人

perl 写下excel文件时字符集

发布时间: 2012-10-25 10:58:57 作者: rapoo

perl 写入excel文件时字符集
#这个比默认utf8字更多,否则个别中文字会有乱码

my $maps=new  Unicode::Map("CP936");my $workbook = Spreadsheet::WriteExcel->new("/home/perl/report/test.xls");my $format = $workbook->add_format();$format->set_align('center');#设置对齐方式



my $totalworksheet = $workbook->add_worksheet(decode('gb2312',"$forum统计"));$totalworksheet->set_column('A:A',30);  $totalworksheet->set_column('B:B',15);  $totalworksheet->set_column('C:C',10);$totalworksheet->set_column('L:L',20);  $totalworksheet->set_column('M:M',20); $ps = $conn->prepare("SELECT DISTINCT .. ");$ps->execute;$totalworksheet->write_unicode(0, 0, $maps->to_unicode("名称"),$format);$totalworksheet->write_unicode(0, 1, $maps->to_unicode("总量"),$format);...

读书人网 >perl python

热点推荐