コード例 #1
0
ファイル: Base.php プロジェクト: heruprambadi/sim_penyuratan
 protected function _writeParagraphStyle(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Style_Paragraph $style, $withoutPPR = false)
 {
     $align = $style->getAlign();
     $spaceBefore = $style->getSpaceBefore();
     $spaceAfter = $style->getSpaceAfter();
     $spacing = $style->getSpacing();
     $indent = $style->getIndent();
     $tabs = $style->getTabs();
     if (!is_null($align) || !is_null($spacing) || !is_null($spaceBefore) || !is_null($spaceAfter) || !is_null($indent) || !is_null($tabs)) {
         if (!$withoutPPR) {
             $objWriter->startElement('w:pPr');
         }
         if (!is_null($align)) {
             $objWriter->startElement('w:jc');
             $objWriter->writeAttribute('w:val', $align);
             $objWriter->endElement();
         }
         if (!is_null($indent)) {
             $objWriter->startElement('w:ind');
             $objWriter->writeAttribute('w:firstLine', 0);
             $objWriter->writeAttribute('w:left', $indent);
             $objWriter->endElement();
         }
         if (!is_null($spaceBefore) || !is_null($spaceAfter) || !is_null($spacing)) {
             $objWriter->startElement('w:spacing');
             if (!is_null($spaceBefore)) {
                 $objWriter->writeAttribute('w:before', $spaceBefore);
             }
             if (!is_null($spaceAfter)) {
                 $objWriter->writeAttribute('w:after', $spaceAfter);
             }
             if (!is_null($spacing)) {
                 $objWriter->writeAttribute('w:line', $spacing);
                 $objWriter->writeAttribute('w:lineRule', 'auto');
             }
             $objWriter->endElement();
         }
         if (!is_null($tabs)) {
             $tabs->toXml($objWriter);
         }
         if (!$withoutPPR) {
             $objWriter->endElement();
             // w:pPr
         }
     }
 }
コード例 #2
0
ファイル: Base.php プロジェクト: foxpython/phpword
 protected function _writeParagraphStyle(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Style_Paragraph $style, $withoutPPR = false)
 {
     $flag = false;
     $align = $style->getAlign();
     $spaceBefore = $style->getSpaceBefore();
     $spaceAfter = $style->getSpaceAfter();
     $spacing = $style->getSpacing();
     $indentLeft = $style->getIndentLeft();
     $indentRight = $style->getIndentRight();
     $indentFirstLine = $style->getIndentFirstLine();
     $indentFirstLineChars = $style->getIndentFirstLineChars();
     if (!is_null($align) || !is_null($spacing) || !is_null($spaceBefore) || !is_null($spaceAfter)) {
         if (!$withoutPPR) {
             $objWriter->startElement('w:pPr');
             $flag = true;
         }
         if (!is_null($align)) {
             $objWriter->startElement('w:jc');
             $objWriter->writeAttribute('w:val', $align);
             $objWriter->endElement();
         }
         if (!is_null($spaceBefore) || !is_null($spaceAfter) || !is_null($spacing)) {
             $objWriter->startElement('w:spacing');
             if (!is_null($spaceBefore)) {
                 $objWriter->writeAttribute('w:before', $spaceBefore);
             }
             if (!is_null($spaceAfter)) {
                 $objWriter->writeAttribute('w:after', $spaceAfter);
             }
             if (!is_null($spacing)) {
                 $objWriter->writeAttribute('w:line', $spacing);
                 $objWriter->writeAttribute('w:lineRule', 'auto');
             }
             $objWriter->endElement();
         }
     }
     if (!is_null($indentLeft) || !is_null($indentRight) || !is_null($indentFirstLine) || !is_null($indentFirstLineChars)) {
         $objWriter->startElement('w:ind');
         if (!is_null($indentLeft)) {
             $objWriter->writeAttribute('w:left', $indentLeft);
         }
         if (!is_null($indentRight)) {
             $objWriter->writeAttribute('w:right', $indentRight);
         }
         if (!is_null($indentFirstLine)) {
             $objWriter->writeAttribute('w:firstLine', $indentFirstLine);
         }
         if (!is_null($indentFirstLineChars)) {
             $objWriter->writeAttribute('w:firstLineChars', $indentFirstLineChars);
             $objWriter->writeAttribute('w:firstLine', '420');
         }
         $objWriter->endElement();
     }
     if (!$withoutPPR && $flag) {
         $objWriter->endElement();
         // w:pPr
     }
 }