예제 #1
0
 /**
  * Add a cell
  *
  * @param int $width
  * @param mixed $style
  * @return \PhpOffice\PhpWord\Element\Cell
  */
 public function addCell($width = null, $style = null)
 {
     $cell = new Cell($width, $style);
     $cell->setParentContainer($this);
     $this->cells[] = $cell;
     return $cell;
 }
예제 #2
0
 /**
  * Add a cell
  *
  * @param int $width
  * @param mixed $style
  * @return \PhpOffice\PhpWord\Element\Cell
  */
 public function addCell($width = null, $style = null)
 {
     $cell = new Cell($width, $style);
     $cell->setDocPart($this->getDocPart(), $this->getDocPartId());
     $cell->setPhpWord($this->phpWord);
     $cell->setNestedLevel($this->getNestedLevel());
     $this->cells[] = $cell;
     return $cell;
 }
예제 #3
0
파일: Table.php 프로젝트: Senasum/PHPWord
 /**
  * Write cell.
  *
  * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
  * @param \PhpOffice\PhpWord\Element\Cell $cell
  * @return void
  */
 private function writeCell(XMLWriter $xmlWriter, CellElement $cell)
 {
     $xmlWriter->startElement('w:tc');
     // Write style
     $cellStyle = $cell->getStyle();
     if ($cellStyle instanceof CellStyle) {
         $styleWriter = new CellStyleWriter($xmlWriter, $cellStyle);
         $styleWriter->setWidth($cell->getWidth());
         $styleWriter->write();
     }
     // Write content
     $containerWriter = new Container($xmlWriter, $cell);
     $containerWriter->write();
     $xmlWriter->endElement();
     // w:tc
 }
예제 #4
0
 /**
  * Get elements
  */
 public function testGetElements()
 {
     $oCell = new Cell('section', 1);
     $this->assertInternalType('array', $oCell->getElements());
 }