Esempio n. 1
0
 /**
  * Write full style
  */
 private function writeStyle()
 {
     $style = $this->getStyle();
     if (!$style instanceof ParagraphStyle) {
         return;
     }
     $xmlWriter = $this->getXmlWriter();
     $styles = $style->getStyleValues();
     if (!$this->withoutPPR) {
         $xmlWriter->startElement('w:pPr');
     }
     // Style name
     $xmlWriter->writeElementIf($styles['name'] !== null, 'w:pStyle', 'w:val', $styles['name']);
     // Alignment
     $styleWriter = new Alignment($xmlWriter, new AlignmentStyle(array('value' => $styles['alignment'])));
     $styleWriter->write();
     // Pagination
     $xmlWriter->writeElementIf($styles['pagination']['widowControl'] === false, 'w:widowControl', 'w:val', '0');
     $xmlWriter->writeElementIf($styles['pagination']['keepNext'] === true, 'w:keepNext', 'w:val', '1');
     $xmlWriter->writeElementIf($styles['pagination']['keepLines'] === true, 'w:keepLines', 'w:val', '1');
     $xmlWriter->writeElementIf($styles['pagination']['pageBreak'] === true, 'w:pageBreakBefore', 'w:val', '1');
     // Indentation & spacing
     $this->writeChildStyle($xmlWriter, 'Indentation', $styles['indentation']);
     $this->writeChildStyle($xmlWriter, 'Spacing', $styles['spacing']);
     // Tabs
     $this->writeTabs($xmlWriter, $styles['tabs']);
     // Numbering
     $this->writeNumbering($xmlWriter, $styles['numbering']);
     if (!$this->withoutPPR) {
         $xmlWriter->endElement();
         // w:pPr
     }
 }
Esempio n. 2
0
 /**
  * Write alignment.
  *
  * @return void
  */
 public function writeAlignment()
 {
     $style = $this->getStyle();
     if (!$style instanceof FrameStyle) {
         return;
     }
     $xmlWriter = $this->getXmlWriter();
     $xmlWriter->startElement('w:pPr');
     $styleWriter = new Alignment($xmlWriter, new AlignmentStyle(array('value' => $style->getAlign())));
     $styleWriter->write();
     $xmlWriter->endElement();
     // w:pPr
 }
Esempio n. 3
0
 /**
  * Write full style
  */
 private function writeStyle(XMLWriter $xmlWriter, TableStyle $style)
 {
     // w:tblPr
     $xmlWriter->startElement('w:tblPr');
     // Alignment
     $styleWriter = new Alignment($xmlWriter, new AlignmentStyle(array('value' => $style->getAlign())));
     $styleWriter->write();
     $this->writeWidth($xmlWriter, $style->getWidth(), $style->getUnit());
     $this->writeMargin($xmlWriter, $style);
     $this->writeBorder($xmlWriter, $style);
     $xmlWriter->endElement();
     // w:tblPr
     $this->writeShading($xmlWriter, $style);
     // First row style
     $firstRow = $style->getFirstRow();
     if ($firstRow instanceof TableStyle) {
         $this->writeFirstRow($xmlWriter, $firstRow);
     }
 }