Exemple #1
0
 public function test_remember_data()
 {
     $this->table->setContent('cell content');
     $this->table->rememberData($this->table->getContent());
     $data = $this->table->getData();
     $this->assertEquals('cell content', $data[$this->table->getRow()][$this->table->getColumn()]);
 }
Exemple #2
0
 /**
  * @param ReferenceTable $table
  */
 public function flush(ReferenceTable &$table)
 {
     if (is_string($table->getContent())) {
         if (trim($table->getContent()) > '') {
             $this->sheet->cell($table->getColumn() . $table->getRow(), $table->getContent());
             $table->rememberData($table->getContent());
         }
     } else {
         $table->rememberData('RICH TEXT: ' . $table->getContent());
     }
     $table->setContent('');
 }
Exemple #3
0
 public function test_td_element_gets_parsed()
 {
     $dom = new \DOMElement('td', 'Patrick');
     $table = new ReferenceTable();
     // Fake as if we are inside a <table>
     $table->setColumn($table->setStartColumn());
     // Fake as if we are inside a <tr>
     $table->nextRow();
     $this->assertEquals('A', $table->getColumn());
     $sheet = $this->mockSheet();
     $element = new TdElement($sheet);
     $element->parse($dom, $table);
     // Flush the element
     $element->flush($table);
     $this->assertEquals('B', $table->getColumn());
 }
Exemple #4
0
 /**
  * @param DOMAttr        $attribute
  * @param ReferenceTable $table
  *
  * @return mixed
  */
 public function parse(DOMAttr $attribute, ReferenceTable &$table)
 {
     $this->sheet->setColumnWidth($table->getColumn(), $attribute->value);
 }
Exemple #5
0
 /**
  * @param DOMAttr        $attribute
  * @param ReferenceTable $table
  *
  * @return mixed
  */
 public function parse(DOMAttr $attribute, ReferenceTable &$table)
 {
     $this->sheet->cell($table->getColumn() . $table->getRow(), function (Cell $cell) use($attribute) {
         $cell->valign($attribute->value);
     });
 }