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);

.
.
.

你可能感兴趣的:(java,C++,c,Excel,perl)