代码是这样写的,为啥是乱码?
#!/usr/bin/perl
use warnings;
use strict;
use Spreadsheet::WriteExcel;
use Encode qw/decode/;
my $excel_object = Spreadsheet::WriteExcel->new("test.xls");
# sheet1
my $sheet1 = $excel_object->add_worksheet("test_sheet");
# 设置格式
my $cell_fmt = $excel_object->add_format();
$cell_fmt->set_size('10'); # 字号
$cell_fmt->set_align('center'); # 对齐方式
$cell_fmt->set_font('Tahoma'); # 字体
$cell_fmt->set_bg_color('13'); # 背景色
# 填充内容
my $A1 = decode("utf8", "山西");
my $B1 = decode("utf8", "太原");
$sheet1->write("A1", $A1, $cell_fmt);
$sheet1->write("B1", $B1, $cell_fmt);
#关闭excel的对象
$excel_object->close();
【 在 callmebbser (BBSer) 的大作中提到: 】
: 永中Office 2016打开也乱码。
: `
--
FROM 124.78.12.*