123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- /**
- * @file
- * Demo application for LibreOffice Calc reader.
- *
- * Pass the path of "content.xml" in an unpacked ODF spreadsheet.
- * Suggested: use the supplied odf_sample.ods, unpacked
- */
- declare(strict_types=1);
- use Osinet\OpenDocument\Calc\Reader;
- use Osinet\OpenDocument\Calc\Row;
- error_reporting(-1);
- require __DIR__ . '/../../vendor/autoload.php';
- $path = $argv[1];
- $reader = new Reader($path);
- echo "This file contains the following sheets:\n";
- $sheetNames = $reader->getCalcSheetNames();
- print_r($sheetNames);
- echo PHP_EOL;
- $rows = $reader->getRows();
- foreach ($rows as $rowNum => $nodeList) {
- $row = new Row($nodeList);
- printf("%3d", $rowNum);
- $cells = $row->getCells();
- for ($i = 0; $i < count($cells); $i++) {
- printf('|%11s', $cells[$i]->displayValue);
- }
- echo PHP_EOL;
- }
|