2009年6月4日星期四

[PerlChina] Re: errors in Spreadsheet::ParseExcel

要支持中文,应该要做字符集的转换吧。
Spreadsheet::ParseExcel;
Spreadsheet::ParseExcel::FmtUnicode;
看这两个模块。
http://blog.chinaunix.net/u/22837/showart.php?id=1953315

On 6月2日, 上午7时03分, Michael Zeng <galaxy2...@gmail.com> wrote:
> 照cpan的例子用的,怎么回报error呢:
> can not use an undefined value as an array reference at
> c:/Perl/site/lib/Spreadsheet/ParseExcel/Workbook.pm at line 70
>
> 这个问题,我打开那个excel,把那个sheetname 改成Sheet1 ,就好了
>
> 改回去(改成任意一个名字)也是好的, 这个不是模块的bug啊
>
> 2009/6/2 Michael Zeng <galaxy2...@gmail.com>
>
>
>
>
>
> > 还有 里面很多中文 被读出了 成了乱码
>
> > 怎么办?
>
> > 2009/6/2 Michael Zeng <galaxy2...@gmail.com>
>
> > 照cpan的例子用的,怎么回报error呢:
> >> can not use an undefined value as an array reference at
> >> c:/Perl/site/lib/Spreadsheet/ParseExcel/Workbook.pm at line 70
>
> >> Spreadsheet::ParseExcel 是用ppm 安装的, perl 5.8 。8 或5.10, winxp
>
> >> 脚本如下:
>
> >> use strict;
> >> use Spreadsheet::ParseExcel;
> >> my $parser = Spreadsheet::ParseExcel->new();
> >> my $workbook = $parser->Parse('1.xls');
> >> for my $worksheet ( $workbook->worksheets() ) {
> >> my ( $row_min, $row_max ) = $worksheet->row_range();
> >> my ( $col_min, $col_max ) = $worksheet->col_range();
> >> for my $row ( $row_min .. $row_max ) {
> >> for my $col ( $col_min .. $col_max ) {
> >> my $cell = $worksheet->get_cell( $row, $col );
> >> next unless $cell;
> >> print "Row, Col = ($row, $col)\n";
> >> print "Value = ", $cell->value(), "\n";
> >> print "Unformatted = ", $cell->unformatted(), "\n";
> >> print "\n";
> >> }
> >> }
> >> }
>
> >> --
> >> Yours Sincerely
> >> Zeng Hong
>
> > --
> > Yours Sincerely
> > Zeng Hong
>
> --
> Yours Sincerely
> Zeng Hong
--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛"PerlChina Mongers 讨论组"论坛。
要在此论坛发帖,请发电子邮件到 perlchina@googlegroups.com
要退订此论坛,请发邮件至 perlchina+unsubscribe@googlegroups.com
更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛
-~----------~----~----~----~------~----~------~--~---

没有评论: