89 lines
7.7 KiB
PHP
89 lines
7.7 KiB
PHP
<?php
|
|
|
|
$inputFile = 'testfiles/1.xlsx';
|
|
$dir = './xlsx_tmp';
|
|
$rmcmd = "rm -Rf $dir/*";
|
|
exec($rmcmd);
|
|
|
|
// Unzip
|
|
$zip = new ZipArchive();
|
|
$zip->open($inputFile);
|
|
if ($zip->extractTo($dir)){
|
|
$sheets = array_diff(scandir($dir ."/xl/worksheets", 0), array('_rels', '..', '.'));
|
|
$nrOfBoxes = count($sheets) / 2;
|
|
print("DEBUG: $inputFile extracted to $dir | NrOfBoxes: $nrOfBoxes\n");
|
|
}
|
|
|
|
if (file_exists($dir . '/xl/worksheets/sheet1.xml')) { $sheet1 = simplexml_load_file($dir . '/xl/worksheets/sheet1.xml'); }
|
|
if (file_exists($dir . '/xl/worksheets/sheet2.xml')) { $sheet2 = simplexml_load_file($dir . '/xl/worksheets/sheet2.xml'); }
|
|
if (file_exists($dir . '/xl/worksheets/sheet3.xml')) { $sheet3 = simplexml_load_file($dir . '/xl/worksheets/sheet3.xml'); }
|
|
if (file_exists($dir . '/xl/worksheets/sheet4.xml')) { $sheet4 = simplexml_load_file($dir . '/xl/worksheets/sheet4.xml'); }
|
|
if (file_exists($dir . '/xl/worksheets/sheet5.xml')) { $sheet5 = simplexml_load_file($dir . '/xl/worksheets/sheet5.xml'); }
|
|
if (file_exists($dir . '/xl/worksheets/sheet6.xml')) { $sheet6 = simplexml_load_file($dir . '/xl/worksheets/sheet6.xml'); }
|
|
if (file_exists($dir . '/xl/worksheets/sheet7.xml')) { $sheet7 = simplexml_load_file($dir . '/xl/worksheets/sheet7.xml'); }
|
|
if (file_exists($dir . '/xl/worksheets/sheet8.xml')) { $sheet8 = simplexml_load_file($dir . '/xl/worksheets/sheet8.xml'); }
|
|
if (file_exists($dir . '/xl/worksheets/sheet9.xml')) { $sheet9 = simplexml_load_file($dir . '/xl/worksheets/sheet9.xml'); }
|
|
if (file_exists($dir . '/xl/worksheets/sheet10.xml')) { $sheet10 = simplexml_load_file($dir . '/xl/worksheets/sheet10.xml'); }
|
|
if (file_exists($dir . '/xl/worksheets/sheet11.xml')) { $sheet11 = simplexml_load_file($dir . '/xl/worksheets/sheet11.xml'); }
|
|
if (file_exists($dir . '/xl/worksheets/sheet12.xml')) { $sheet12 = simplexml_load_file($dir . '/xl/worksheets/sheet12.xml'); }
|
|
if (file_exists($dir . '/xl/worksheets/sheet13.xml')) { $sheet13 = simplexml_load_file($dir . '/xl/worksheets/sheet13.xml'); }
|
|
if (file_exists($dir . '/xl/worksheets/sheet14.xml')) { $sheet14 = simplexml_load_file($dir . '/xl/worksheets/sheet14.xml'); }
|
|
if (file_exists($dir . '/xl/worksheets/sheet15.xml')) { $sheet15 = simplexml_load_file($dir . '/xl/worksheets/sheet15.xml'); }
|
|
|
|
if (isset($sheet1)) { $xlrows1 = $sheet1->sheetData->row; }
|
|
if (isset($sheet2)) { $xlrows2 = $sheet2->sheetData->row; }
|
|
if (isset($sheet3)) { $xlrows3 = $sheet3->sheetData->row; }
|
|
if (isset($sheet4)) { $xlrows4 = $sheet4->sheetData->row; }
|
|
if (isset($sheet5)) { $xlrows5 = $sheet5->sheetData->row; }
|
|
if (isset($sheet6)) { $xlrows6 = $sheet6->sheetData->row; }
|
|
if (isset($sheet7)) { $xlrows7 = $sheet7->sheetData->row; }
|
|
if (isset($sheet8)) { $xlrows8 = $sheet8->sheetData->row; }
|
|
if (isset($sheet9)) { $xlrows9 = $sheet9->sheetData->row; }
|
|
if (isset($sheet10)) { $xlrows10 = $sheet10->sheetData->row; }
|
|
if (isset($sheet11)) { $xlrows11 = $sheet11->sheetData->row; }
|
|
if (isset($sheet12)) { $xlrows12 = $sheet12->sheetData->row; }
|
|
if (isset($sheet13)) { $xlrows13 = $sheet13->sheetData->row; }
|
|
if (isset($sheet14)) { $xlrows14 = $sheet14->sheetData->row; }
|
|
if (isset($sheet15)) { $xlrows15 = $sheet15->sheetData->row; }
|
|
|
|
if ( $nrOfBoxes >= 1 ){ for( $i=2; $i<=10; $i++){ print($sheet1->sheetData->row[$i]->c[0]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 2 ){ for( $i=2; $i<=10; $i++){ print($sheet2->sheetData->row[$i]->c[0]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 3 ){ for( $i=2; $i<=10; $i++){ print($sheet3->sheetData->row[$i]->c[0]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 4 ){ for( $i=2; $i<=10; $i++){ print($sheet4->sheetData->row[$i]->c[0]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 5 ){ for( $i=2; $i<=10; $i++){ print($sheet5->sheetData->row[$i]->c[0]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 6 ){ for( $i=2; $i<=10; $i++){ print($sheet6->sheetData->row[$i]->c[0]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 7 ){ for( $i=2; $i<=10; $i++){ print($sheet7->sheetData->row[$i]->c[0]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 8 ){ for( $i=2; $i<=10; $i++){ print($sheet8->sheetData->row[$i]->c[0]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 9 ){ for( $i=2; $i<=10; $i++){ print($sheet9->sheetData->row[$i]->c[0]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 10 ){ for( $i=2; $i<=10; $i++){ print($sheet10->sheetData->row[$i]->c[0]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 11 ){ for( $i=2; $i<=10; $i++){ print($sheet11->sheetData->row[$i]->c[0]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 12 ){ for( $i=2; $i<=10; $i++){ print($sheet12->sheetData->row[$i]->c[0]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 13 ){ for( $i=2; $i<=10; $i++){ print($sheet13->sheetData->row[$i]->c[0]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
# if ( $nrOfBoxes >= 14 ){ for( $i=2; $i<=10; $i++){ print($sheet14->sheetData->row[$i]->c[0]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
# if ( $nrOfBoxes = 15 ){ for( $i=2; $i<=10; $i++){ print($sheet15->sheetData->row[$i]->c[0]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
print("----------------\n");
|
|
if ( $nrOfBoxes >= 1 ){ for( $i=2; $i<=10; $i++){ print($sheet1->sheetData->row[$i]->c[27]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 2 ){ for( $i=2; $i<=10; $i++){ print($sheet2->sheetData->row[$i]->c[27]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 3 ){ for( $i=2; $i<=10; $i++){ print($sheet3->sheetData->row[$i]->c[27]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 4 ){ for( $i=2; $i<=10; $i++){ print($sheet4->sheetData->row[$i]->c[27]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 5 ){ for( $i=2; $i<=10; $i++){ print($sheet5->sheetData->row[$i]->c[27]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 6 ){ for( $i=2; $i<=10; $i++){ print($sheet6->sheetData->row[$i]->c[27]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 7 ){ for( $i=2; $i<=10; $i++){ print($sheet7->sheetData->row[$i]->c[27]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 8 ){ for( $i=2; $i<=10; $i++){ print($sheet8->sheetData->row[$i]->c[27]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 9 ){ for( $i=2; $i<=10; $i++){ print($sheet9->sheetData->row[$i]->c[27]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 10 ){ for( $i=2; $i<=10; $i++){ print($sheet10->sheetData->row[$i]->c[27]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 11 ){ for( $i=2; $i<=10; $i++){ print($sheet11->sheetData->row[$i]->c[27]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 12 ){ for( $i=2; $i<=10; $i++){ print($sheet12->sheetData->row[$i]->c[27]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
if ( $nrOfBoxes >= 13 ){ for( $i=2; $i<=10; $i++){ print($sheet13->sheetData->row[$i]->c[27]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
# if ( $nrOfBoxes >= 14 ){ for( $i=2; $i<=10; $i++){ print($sheet14->sheetData->row[$i]->c[27]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
# if ( $nrOfBoxes = 15 ){ for( $i=2; $i<=10; $i++){ print($sheet15->sheetData->row[$i]->c[27]->v); if ( $i !=10 ){ print ", "; } else { print ";\n"; }}}
|
|
print("----------------\n");
|
|
|
|
|
|
function getCell($xml, $row, $col){
|
|
return $xml->sheetData->row[$row]->c[$col]->v;
|
|
}
|
|
|
|
|
|
?>
|