Excel(一)Spreadsheet::ParseExcel
来源:互联网 发布:linux oracle查看实例 编辑:程序博客网 时间:2024/05/01 23:38
例子:
#usr/bin.perl -wuse strict;use SpreadSheet::ParseExcel;#Be used to read excel informationuse SpreadSheet::ParseExcel::FmtUnicode;use Unicode::Map;my $formatter = Spreadsheet::ParseExcel::FmtUnicode -> new(Unicode_Map=>"CP936"); my $parser = Spreadsheet::ParseExcel->new(); my $workbook = $parser->parse('example.xls',$formatter); if ( !defined $workbook ) { die $parser->error(), ".\n"; } 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"; } } }
结果:
要点:
中文处理:
unicode::Map, spreadsheet::ParseExcel::FmtUnicode -> new(Unicode_Map => "CP936")
对象的理解:
workbook, worksheet, cell, format
详细请参照 http://search.cpan.org/~jmcnamara/Spreadsheet-ParseExcel-0.59/lib/Spreadsheet/ParseExcel.pm
- Excel(一)Spreadsheet::ParseExcel
- Spreadsheet::ParseExcel
- Spreadsheet::ParseExcel
- Spreadsheet::ParseExcel::SaveParser 和 Spreadsheet::ParseExcel的内存问题
- 使用perl Spreadsheet::ParseExcel 来解析xml
- 使用parseexcel Ruby读取Excel
- 使用parseexcel Ruby读取Excel
- 使用Spreadsheet操作Excel
- Excel(二)Spreadsheet::WriteExcel
- Excel比较工具SpreadSheet
- Generate Excel Spreadsheet from PeopleCode
- Generate Excel Spreadsheet from PeopleCode
- java ParseExcel
- Spreadsheet(电子试算表)
- Dojo Spreadsheet Widget - 基于Ajax的Excel
- Dojo Spreadsheet Widget - 基于Ajax的Excel
- Dojo Spreadsheet Widget - 基于Ajax的Excel
- Dojo Spreadsheet Widget - 基于Ajax的Excel
- Linux下基于OpenSSL的SSL安全通信设计
- POJ 1416
- 【菜鸟C++学习笔记】3.函数
- TAO工作室
- 标签传播算法在微博用户兴趣图谱的应用
- Excel(一)Spreadsheet::ParseExcel
- 民众主动反恐最好还是要考虑特定环境
- ubuntu 12.04 静态ip的设置方法
- 推荐:Android Design 如何设计出优秀的Android的应用
- 用 Visual Studio 2010 在 SharePoint 2010 创建ASMX Web Service
- 调整字体——Source Insight看程序更舒服
- 深度解析Java内存的原型及工作原理
- 解决虚拟键盘挡住了输入框的问题
- 手机电容屏保养和失灵后的解决方法