用perl写了个脚本处理excel文件将其生成为.scs文件,其中在excel文件里有一些文字被加上删除线,在处理时候不需要被处理,因为权限关系不可以修改excel。
想问有什么方法可以让perl自动过滤掉带删除线的文字。
感谢~!
俄谢谢你的回答。我无知了。。只知道怎么用perl写excel时候怎么设置font,不知道读excel时候怎么获取font。
还麻烦您指教了。foreach后面应该怎么写呢。
谢谢。
#!/usr/bin/perl -w
use strict;
use Spreadsheet::ParseExcel;
my $parser = Spreadsheet::ParseExcel->new(
CellHandler => \&cell_handler,
NotSetCell => 1
);
my $workbook = $parser->parse('test.xls');
sub cell_handler {
my $workbook = $_[0];
my $sheet_index = $_[1];
my $row = $_[2];
my $col = $_[3];
my $cell = $_[4];
# Do something useful with the formatted cell value
#print $cell->value(), "\n";
print $cell->get_format()->{Font}->{Strikeout},"\n";
}
test.xls: