Loading src/Calc.php +29 −2 Changes for src/Calc.php: 29 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use DOMDocument; use DOMElement; use DOMNode; use DOMNodeList; use Unicaen\OpenDocument\Calc\Cell; use ZipArchive; class Calc Loading @@ -22,6 +23,11 @@ class Calc */ private $document; /** * @var Cell[] */ private $cells; /** Loading @@ -37,13 +43,34 @@ class Calc /** * @param Document $document * * @return Publisher * @return Calc */ public function setDocument(Document $document): Publisher public function setDocument(Document $document): Calc { $this->document = $document; return $this; } public function read() { $content = $this->getDocument()->getContent(); $spreadsheet = $this->getDocument()->find( $content, 'office:spreadsheet')[0]; $table = $this->getDocument()->find($spreadsheet, 'table:table')[0]; $rcs = $table->childNodes; foreach( $rcs as $rc ){ switch($rc->tagName){ case 'office:forms': break; case 'table:table-column': break; case 'table:table-row': xmlDump($rc); break; } } } } No newline at end of file src/Calc/Cell.php 0 → 100644 +34 −0 Changes for src/Calc/Cell.php: 34 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Unicaen\OpenDocument\Calc; class Cell { /** * @var int */ private $line; /** * @var int */ private $col; /** * @var string */ private $content; /** * @var string */ private $formule; public function __construct( int $line, int $col ) { $this->line = $line; $this->col = $col; } } No newline at end of file Loading
src/Calc.php +29 −2 Changes for src/Calc.php: 29 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use DOMDocument; use DOMElement; use DOMNode; use DOMNodeList; use Unicaen\OpenDocument\Calc\Cell; use ZipArchive; class Calc Loading @@ -22,6 +23,11 @@ class Calc */ private $document; /** * @var Cell[] */ private $cells; /** Loading @@ -37,13 +43,34 @@ class Calc /** * @param Document $document * * @return Publisher * @return Calc */ public function setDocument(Document $document): Publisher public function setDocument(Document $document): Calc { $this->document = $document; return $this; } public function read() { $content = $this->getDocument()->getContent(); $spreadsheet = $this->getDocument()->find( $content, 'office:spreadsheet')[0]; $table = $this->getDocument()->find($spreadsheet, 'table:table')[0]; $rcs = $table->childNodes; foreach( $rcs as $rc ){ switch($rc->tagName){ case 'office:forms': break; case 'table:table-column': break; case 'table:table-row': xmlDump($rc); break; } } } } No newline at end of file
src/Calc/Cell.php 0 → 100644 +34 −0 Changes for src/Calc/Cell.php: 34 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Unicaen\OpenDocument\Calc; class Cell { /** * @var int */ private $line; /** * @var int */ private $col; /** * @var string */ private $content; /** * @var string */ private $formule; public function __construct( int $line, int $col ) { $this->line = $line; $this->col = $col; } } No newline at end of file