1use strict;
2use Spreadsheet::ParseExcel;
3use Spreadsheet::ParseExcel::FmtJapan2;
4if(!(defined $ARGV[0])) {
5    print<<EOF;
6Usage: $0 Excel_File
7EOF
8    exit;
9}
10my $iPreSheet=-1;
11sub subCellHandler($$$$$) {
12    my ($oBook, $iSheet, $iRow, $iCol, $oCell) = @_;
13    if($iPreSheet<0) {
14        print "=========================================\n";
15        print "FILE  :", $oBook->{File} , "\n";
16        print "COUNT :", $oBook->{SheetCount} , "\n";
17        print "AUTHOR:", $oBook->{Author} , "\n";
18    }
19    if($iPreSheet != $iSheet) {
20        print "--------- SHEET:",
21            $oBook->{Worksheet}[$iSheet]->{Name}, "\n" ;
22        $iPreSheet = $iSheet;
23    }
24    print "( $iRow , $iCol ) =>", $oCell->Value, "\n";
25#    $oBook->ParseAbort('Exceed Data') if($iRow >= 1);
26}
27my $oExcel = new Spreadsheet::ParseExcel
28        ( CellHandler => \&subCellHandler, NotSetCell => 1);
29my $oFmtJ = Spreadsheet::ParseExcel::FmtJapan2->new(Code => $ARGV[1]);
30my $oBook = $oExcel->Parse($ARGV[0], $oFmtJ);
31for(my $i=0;$i<$oBook->{SheetCount};$i++) {
32    print "LAST:\n";
33    print "Row:", $oBook->{Worksheet}[$i]->{MaxRow}, "\n";
34    print "Col:", $oBook->{Worksheet}[$i]->{MaxCol}, "\n";
35}
36print "ABORTED:", $oBook->{_ParseAbort} if($oBook->{_ParseAbort});
37