当前位置: 首页>>代码示例>>PHP>>正文


PHP XMLWriter::endElement方法代码示例

本文整理汇总了PHP中PhpOffice\PhpWord\Shared\XMLWriter::endElement方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLWriter::endElement方法的具体用法?PHP XMLWriter::endElement怎么用?PHP XMLWriter::endElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhpOffice\PhpWord\Shared\XMLWriter的用法示例。


在下文中一共展示了XMLWriter::endElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: writeFontFaces

 /**
  * Write font faces declaration
  */
 protected function writeFontFaces(XMLWriter $xmlWriter)
 {
     $xmlWriter->startElement('office:font-face-decls');
     $arrFonts = array();
     $styles = Style::getStyles();
     $numFonts = 0;
     if (count($styles) > 0) {
         foreach ($styles as $style) {
             // Font
             if ($style instanceof Font) {
                 $numFonts++;
                 $name = $style->getName();
                 if (!in_array($name, $arrFonts)) {
                     $arrFonts[] = $name;
                     // style:font-face
                     $xmlWriter->startElement('style:font-face');
                     $xmlWriter->writeAttribute('style:name', $name);
                     $xmlWriter->writeAttribute('svg:font-family', $name);
                     $xmlWriter->endElement();
                 }
             }
         }
     }
     if (!in_array(PhpWord::DEFAULT_FONT_NAME, $arrFonts)) {
         $xmlWriter->startElement('style:font-face');
         $xmlWriter->writeAttribute('style:name', PhpWord::DEFAULT_FONT_NAME);
         $xmlWriter->writeAttribute('svg:font-family', PhpWord::DEFAULT_FONT_NAME);
         $xmlWriter->endElement();
     }
     $xmlWriter->endElement();
 }
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:34,代码来源:AbstractPart.php

示例2: endElementP

 /**
  * End w:p DOM element.
  *
  * @return void
  */
 protected function endElementP()
 {
     if (!$this->withoutP) {
         $this->xmlWriter->endElement();
         // w:p
     }
 }
开发者ID:uusa35,项目名称:turnkw,代码行数:12,代码来源:AbstractElement.php

示例3: writeContentType

 /**
  * Write content types element
  *
  * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter XML Writer
  * @param array $parts
  * @param boolean $isDefault
  */
 private function writeContentType(XMLWriter $xmlWriter, $parts, $isDefault)
 {
     foreach ($parts as $partName => $contentType) {
         $partType = $isDefault ? 'Default' : 'Override';
         $partAttribute = $isDefault ? 'Extension' : 'PartName';
         $xmlWriter->startElement($partType);
         $xmlWriter->writeAttribute($partAttribute, $partName);
         $xmlWriter->writeAttribute('ContentType', $contentType);
         $xmlWriter->endElement();
     }
 }
开发者ID:hcvcastro,项目名称:pxp,代码行数:18,代码来源:ContentTypes.php

示例4: writeContentType

 /**
  * Write content types element
  *
  * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter XML Writer
  * @param array $parts
  * @param boolean $isDefault
  * @throws \PhpOffice\PhpWord\Exception\Exception
  */
 private function writeContentType(XMLWriter $xmlWriter, $parts, $isDefault)
 {
     foreach ($parts as $partName => $contentType) {
         if ($partName != '' && $contentType != '') {
             $partType = $isDefault ? 'Default' : 'Override';
             $partAttribute = $isDefault ? 'Extension' : 'PartName';
             $xmlWriter->startElement($partType);
             $xmlWriter->writeAttribute($partAttribute, $partName);
             $xmlWriter->writeAttribute('ContentType', $contentType);
             $xmlWriter->endElement();
         } else {
             throw new Exception("Invalid parameters passed.");
         }
     }
 }
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:23,代码来源:ContentTypes.php

示例5: writeSectionSettings

 /**
  * Write end section.
  *
  * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
  * @param \PhpOffice\PhpWord\Element\Section $section
  * @return void
  */
 private function writeSectionSettings(XMLWriter $xmlWriter, Section $section)
 {
     $xmlWriter->startElement('w:sectPr');
     // Header reference
     foreach ($section->getHeaders() as $header) {
         $rId = $header->getRelationId();
         $xmlWriter->startElement('w:headerReference');
         $xmlWriter->writeAttribute('w:type', $header->getType());
         $xmlWriter->writeAttribute('r:id', 'rId' . $rId);
         $xmlWriter->endElement();
     }
     // Footer reference
     foreach ($section->getFooters() as $footer) {
         $rId = $footer->getRelationId();
         $xmlWriter->startElement('w:footerReference');
         $xmlWriter->writeAttribute('w:type', $footer->getType());
         $xmlWriter->writeAttribute('r:id', 'rId' . $rId);
         $xmlWriter->endElement();
     }
     // Different first page
     if ($section->hasDifferentFirstPage()) {
         $xmlWriter->startElement('w:titlePg');
         $xmlWriter->endElement();
     }
     // Section settings
     $styleWriter = new SectionStyleWriter($xmlWriter, $section->getStyle());
     $styleWriter->write();
     $xmlWriter->endElement();
     // w:sectPr
 }
开发者ID:doit05,项目名称:relProject,代码行数:37,代码来源:Document.php

示例6: writeDropDown

 /**
  * Write dropdown.
  *
  * @link http://www.datypic.com/sc/ooxml/t-w_CT_FFDDList.html
  * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
  * @param \PhpOffice\PhpWord\Element\FormField $element
  * @return void
  */
 private function writeDropDown(XMLWriter $xmlWriter, FormFieldElement $element)
 {
     $default = $element->getDefault();
     $value = $element->getValue();
     if ($value == null) {
         $value = $default;
     }
     $entries = $element->getEntries();
     $xmlWriter->startElement('w:ddList');
     $xmlWriter->writeElementBlock('w:result', 'w:val', $value);
     $xmlWriter->writeElementBlock('w:default', 'w:val', $default);
     foreach ($entries as $entry) {
         $xmlWriter->writeElementBlock('w:listEntry', 'w:val', $entry);
     }
     $xmlWriter->endElement();
 }
开发者ID:Senasum,项目名称:PHPWord,代码行数:24,代码来源:FormField.php

示例7: writeCustomProperty

 /**
  * Write individual property
  *
  * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
  * @param string $property
  * @param string $value
  * @return void
  *
  * @todo Handle other `$type`: double|date|dateTime|duration|boolean (4th arguments)
  */
 private function writeCustomProperty(XMLWriter $xmlWriter, $property, $value)
 {
     $xmlWriter->startElement('meta:user-defined');
     $xmlWriter->writeAttribute('meta:name', $property);
     // if ($type !== null) {
     //     $xmlWriter->writeAttribute('meta:value-type', $type);
     // }
     $xmlWriter->writeRaw($value);
     $xmlWriter->endElement();
     // meta:user-defined
 }
开发者ID:Senasum,项目名称:PHPWord,代码行数:21,代码来源:Meta.php

示例8: writeNote

 /**
  * Write note item
  *
  * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
  * @param \PhpOffice\PhpWord\Element\Footnote|\PhpOffice\PhpWord\Element\Endnote $element
  */
 protected function writeNote(XMLWriter $xmlWriter, $element)
 {
     $xmlWriter->startElement($this->elementNode);
     $xmlWriter->writeAttribute('w:id', $element->getRelationId());
     $xmlWriter->startElement('w:p');
     // Paragraph style
     $styleWriter = new ParagraphStyleWriter($xmlWriter, $element->getParagraphStyle());
     $styleWriter->setIsInline(true);
     $styleWriter->write();
     // Reference symbol
     $xmlWriter->startElement('w:r');
     $xmlWriter->startElement('w:rPr');
     $xmlWriter->startElement('w:rStyle');
     $xmlWriter->writeAttribute('w:val', $this->refStyle);
     $xmlWriter->endElement();
     // w:rStyle
     $xmlWriter->endElement();
     // w:rPr
     $xmlWriter->writeElement($this->refNode);
     $xmlWriter->endElement();
     // w:r
     // Empty space after refence symbol
     $xmlWriter->startElement('w:r');
     $xmlWriter->startElement('w:t');
     $xmlWriter->writeAttribute('xml:space', 'preserve');
     $xmlWriter->writeRaw(' ');
     $xmlWriter->endElement();
     // w:t
     $xmlWriter->endElement();
     // w:r
     $this->writeContainerElements($xmlWriter, $element);
     $xmlWriter->endElement();
     // w:p
     $xmlWriter->endElement();
     // $this->elementNode
 }
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:42,代码来源:Footnotes.php

示例9: writeFontFaces

 /**
  * Write font faces declaration
  */
 protected function writeFontFaces(XMLWriter $xmlWriter)
 {
     $xmlWriter->startElement('office:font-face-decls');
     $fontTable = array();
     $styles = Style::getStyles();
     $numFonts = 0;
     if (count($styles) > 0) {
         foreach ($styles as $style) {
             // Font
             if ($style instanceof Font) {
                 $numFonts++;
                 $name = $style->getName();
                 if (!in_array($name, $fontTable)) {
                     $fontTable[] = $name;
                     // style:font-face
                     $xmlWriter->startElement('style:font-face');
                     $xmlWriter->writeAttribute('style:name', $name);
                     $xmlWriter->writeAttribute('svg:font-family', $name);
                     $xmlWriter->endElement();
                 }
             }
         }
     }
     if (!in_array(Settings::getDefaultFontName(), $fontTable)) {
         $xmlWriter->startElement('style:font-face');
         $xmlWriter->writeAttribute('style:name', Settings::getDefaultFontName());
         $xmlWriter->writeAttribute('svg:font-family', Settings::getDefaultFontName());
         $xmlWriter->endElement();
     }
     $xmlWriter->endElement();
 }
开发者ID:hcvcastro,项目名称:pxp,代码行数:34,代码来源:AbstractPart.php

示例10: writeFont

 /**
  * Write level font.
  *
  * @since 0.11.0
  *
  * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
  * @param \PhpOffice\PhpWord\Style\NumberingLevel $level
  * @return void
  * @todo Use font style writer
  */
 private function writeFont(XMLWriter $xmlWriter, NumberingLevel $level)
 {
     $font = $level->getFont();
     $hint = $level->getHint();
     $xmlWriter->startElement('w:rPr');
     $xmlWriter->startElement('w:rFonts');
     $xmlWriter->writeAttributeIf($font !== null, 'w:ascii', $font);
     $xmlWriter->writeAttributeIf($font !== null, 'w:hAnsi', $font);
     $xmlWriter->writeAttributeIf($font !== null, 'w:cs', $font);
     $xmlWriter->writeAttributeIf($hint !== null, 'w:hint', $hint);
     $xmlWriter->endElement();
     // w:rFonts
     $xmlWriter->endElement();
     // w:rPr
 }
开发者ID:Senasum,项目名称:PHPWord,代码行数:25,代码来源:Numbering.php

示例11: writeDate

 /**
  * Write date.
  *
  * @link http://www.datypic.com/sc/ooxml/t-w_CT_SdtDate.html
  * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
  * @param \PhpOffice\PhpWord\Element\SDT $element
  * @return void
  */
 private function writeDate(XMLWriter $xmlWriter, SDTElement $element)
 {
     $type = $element->getType();
     $xmlWriter->startElement("w:{$type}");
     $xmlWriter->writeElementBlock('w:dateFormat', 'w:val', 'd/M/yyyy');
     $xmlWriter->writeElementBlock('w:lid', 'w:val', 'en-US');
     $xmlWriter->writeElementBlock('w:storeMappedDataAs', 'w:val', 'dateTime');
     $xmlWriter->writeElementBlock('w:calendar', 'w:val', 'gregorian');
     $xmlWriter->endElement();
     // w:date
 }
开发者ID:doit05,项目名称:relProject,代码行数:19,代码来源:SDT.php

示例12: writeDefaultStyles

 /**
  * Write default font and other default styles
  *
  * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
  * @param array $styles
  */
 private function writeDefaultStyles(XMLWriter $xmlWriter, PhpWord $phpWord, $styles)
 {
     $fontName = $phpWord->getDefaultFontName();
     $fontSize = $phpWord->getDefaultFontSize();
     // Default font
     $xmlWriter->startElement('w:docDefaults');
     $xmlWriter->startElement('w:rPrDefault');
     $xmlWriter->startElement('w:rPr');
     $xmlWriter->startElement('w:rFonts');
     $xmlWriter->writeAttribute('w:ascii', $fontName);
     $xmlWriter->writeAttribute('w:hAnsi', $fontName);
     $xmlWriter->writeAttribute('w:eastAsia', $fontName);
     $xmlWriter->writeAttribute('w:cs', $fontName);
     $xmlWriter->endElement();
     // w:rFonts
     $xmlWriter->startElement('w:sz');
     $xmlWriter->writeAttribute('w:val', $fontSize * 2);
     $xmlWriter->endElement();
     // w:sz
     $xmlWriter->startElement('w:szCs');
     $xmlWriter->writeAttribute('w:val', $fontSize * 2);
     $xmlWriter->endElement();
     // w:szCs
     $xmlWriter->endElement();
     // w:rPr
     $xmlWriter->endElement();
     // w:rPrDefault
     $xmlWriter->endElement();
     // w:docDefaults
     // Normal style
     $xmlWriter->startElement('w:style');
     $xmlWriter->writeAttribute('w:type', 'paragraph');
     $xmlWriter->writeAttribute('w:default', '1');
     $xmlWriter->writeAttribute('w:styleId', 'Normal');
     $xmlWriter->startElement('w:name');
     $xmlWriter->writeAttribute('w:val', 'Normal');
     $xmlWriter->endElement();
     // w:name
     if (array_key_exists('Normal', $styles)) {
         $styleWriter = new ParagraphStyleWriter($xmlWriter, $styles['Normal']);
         $styleWriter->write();
     }
     $xmlWriter->endElement();
     // w:style
     // FootnoteReference style
     if (!array_key_exists('FootnoteReference', $styles)) {
         $xmlWriter->startElement('w:style');
         $xmlWriter->writeAttribute('w:type', 'character');
         $xmlWriter->writeAttribute('w:styleId', 'FootnoteReference');
         $xmlWriter->startElement('w:name');
         $xmlWriter->writeAttribute('w:val', 'Footnote Reference');
         $xmlWriter->endElement();
         // w:name
         $xmlWriter->writeElement('w:semiHidden');
         $xmlWriter->writeElement('w:unhideWhenUsed');
         $xmlWriter->startElement('w:rPr');
         $xmlWriter->startElement('w:vertAlign');
         $xmlWriter->writeAttribute('w:val', 'superscript');
         $xmlWriter->endElement();
         // w:vertAlign
         $xmlWriter->endElement();
         // w:rPr
         $xmlWriter->endElement();
         // w:style
     }
 }
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:72,代码来源:Styles.php

示例13: writeRel

 /**
  * Write individual rels entry.
  *
  * Format:
  * <Relationship Id="rId..." Type="http://..." Target="....xml" TargetMode="..." />
  *
  * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
  * @param int $relId Relationship ID
  * @param string $type Relationship type
  * @param string $target Relationship target
  * @param string $targetMode Relationship target mode
  * @return void
  * @throws \PhpOffice\PhpWord\Exception\Exception
  */
 private function writeRel(XMLWriter $xmlWriter, $relId, $type, $target, $targetMode = '')
 {
     if ($type != '' && $target != '') {
         if (strpos($relId, 'rId') === false) {
             $relId = 'rId' . $relId;
         }
         $xmlWriter->startElement('Relationship');
         $xmlWriter->writeAttribute('Id', $relId);
         $xmlWriter->writeAttribute('Type', 'http://schemas.openxmlformats.org/' . $type);
         $xmlWriter->writeAttribute('Target', $target);
         if ($targetMode != '') {
             $xmlWriter->writeAttribute('TargetMode', $targetMode);
         }
         $xmlWriter->endElement();
     } else {
         throw new Exception("Invalid parameters passed.");
     }
 }
开发者ID:Senasum,项目名称:PHPWord,代码行数:32,代码来源:Rels.php

示例14: writeTableStyle

 /**
  * Write table style
  *
  * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
  * @param string $styleName
  * @param \PhpOffice\PhpWord\Style\Table $style
  */
 private function writeTableStyle(XMLWriter $xmlWriter, $styleName, TableStyle $style)
 {
     $xmlWriter->startElement('w:style');
     $xmlWriter->writeAttribute('w:type', 'table');
     $xmlWriter->writeAttribute('w:customStyle', '1');
     $xmlWriter->writeAttribute('w:styleId', $styleName);
     $xmlWriter->startElement('w:name');
     $xmlWriter->writeAttribute('w:val', $styleName);
     $xmlWriter->endElement();
     $xmlWriter->startElement('w:uiPriority');
     $xmlWriter->writeAttribute('w:val', '99');
     $xmlWriter->endElement();
     $styleWriter = new TableStyleWriter($xmlWriter, $style);
     $styleWriter->write();
     $xmlWriter->endElement();
     // w:style
 }
开发者ID:FabianoFaria,项目名称:ULA_front,代码行数:24,代码来源:Styles.php

示例15: writeShape

 /**
  * Write shape
  *
  * @link http://www.datypic.com/sc/ooxml/t-a_CT_ShapeProperties.html
  * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
  * @param bool $line
  * @return void
  */
 private function writeShape(XMLWriter $xmlWriter, $line = false)
 {
     $xmlWriter->startElement('c:spPr');
     $xmlWriter->startElement('a:ln');
     if ($line === true) {
         $xmlWriter->writeElement('a:solidFill');
     } else {
         $xmlWriter->writeElement('a:noFill');
     }
     $xmlWriter->endElement();
     // a:ln
     $xmlWriter->endElement();
     // c:spPr
 }
开发者ID:doit05,项目名称:relProject,代码行数:22,代码来源:Chart.php


注:本文中的PhpOffice\PhpWord\Shared\XMLWriter::endElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。