/** * Write margin. * * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Table $style * @return void */ private function writeMargin(XMLWriter $xmlWriter, TableStyle $style) { if ($style->hasMargin()) { $xmlWriter->startElement('w:tblCellMar'); $styleWriter = new MarginBorder($xmlWriter); $styleWriter->setSizes($style->getCellMargin()); $styleWriter->write(); $xmlWriter->endElement(); // w:tblCellMar } }
/** * Set style value for various special value types */ public function testSetStyleValue() { $object = new Table(); $object->setStyleValue('borderSize', 120); $object->setStyleValue('cellMargin', 240); $object->setStyleValue('borderColor', '999999'); $this->assertEquals(array(120, 120, 120, 120, 120, 120), $object->getBorderSize()); $this->assertEquals(array(240, 240, 240, 240), $object->getCellMargin()); $this->assertEquals(array('999999', '999999', '999999', '999999', '999999', '999999'), $object->getBorderColor()); }