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


PHP PHPExcel_Shared_XMLWriter::writeRaw方法代码示例

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


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

示例1: write

 /**
  * Write meta.xml to XML format
  *
  * @param   PHPExcel                   $pPHPExcel
  * @return  string                     XML Output
  * @throws  PHPExcel_Writer_Exception
  */
 public function write(PHPExcel $pPHPExcel = null)
 {
     if (!$pPHPExcel) {
         $pPHPExcel = $this->getParentWriter()->getPHPExcel();
     }
     $objWriter = null;
     if ($this->getParentWriter()->getUseDiskCaching()) {
         $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
     } else {
         $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
     }
     // XML header
     $objWriter->startDocument('1.0', 'UTF-8');
     // Meta
     $objWriter->startElement('office:document-meta');
     $objWriter->writeAttribute('xmlns:office', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0');
     $objWriter->writeAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');
     $objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/');
     $objWriter->writeAttribute('xmlns:meta', 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0');
     $objWriter->writeAttribute('xmlns:ooo', 'http://openoffice.org/2004/office');
     $objWriter->writeAttribute('xmlns:grddl', 'http://www.w3.org/2003/g/data-view#');
     $objWriter->writeAttribute('office:version', '1.2');
     $objWriter->startElement('office:meta');
     $objWriter->writeElement('meta:initial-creator', $pPHPExcel->getProperties()->getCreator());
     $objWriter->writeElement('dc:creator', $pPHPExcel->getProperties()->getCreator());
     $objWriter->writeElement('meta:creation-date', date(DATE_W3C, $pPHPExcel->getProperties()->getCreated()));
     $objWriter->writeElement('dc:date', date(DATE_W3C, $pPHPExcel->getProperties()->getCreated()));
     $objWriter->writeElement('dc:title', $pPHPExcel->getProperties()->getTitle());
     $objWriter->writeElement('dc:description', $pPHPExcel->getProperties()->getDescription());
     $objWriter->writeElement('dc:subject', $pPHPExcel->getProperties()->getSubject());
     $keywords = explode(' ', $pPHPExcel->getProperties()->getKeywords());
     foreach ($keywords as $keyword) {
         $objWriter->writeElement('meta:keyword', $keyword);
     }
     //<meta:document-statistic meta:table-count="XXX" meta:cell-count="XXX" meta:object-count="XXX"/>
     $objWriter->startElement('meta:user-defined');
     $objWriter->writeAttribute('meta:name', 'Company');
     $objWriter->writeRaw($pPHPExcel->getProperties()->getCompany());
     $objWriter->endElement();
     $objWriter->startElement('meta:user-defined');
     $objWriter->writeAttribute('meta:name', 'category');
     $objWriter->writeRaw($pPHPExcel->getProperties()->getCategory());
     $objWriter->endElement();
     $objWriter->endElement();
     $objWriter->endElement();
     return $objWriter->getData();
 }
开发者ID:rostrowicki,项目名称:PHPExcel,代码行数:54,代码来源:Meta.php

示例2: writeDocPropsCore

 /**
  * Write docProps/core.xml to XML format
  *
  * @param 	PHPExcel	$pPHPExcel
  * @return 	string 		XML Output
  * @throws 	Exception
  */
 public function writeDocPropsCore(PHPExcel $pPHPExcel = null)
 {
     // Create XML writer
     $objWriter = null;
     if ($this->getParentWriter()->getUseDiskCaching()) {
         $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
     } else {
         $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
     }
     // XML header
     $objWriter->startDocument('1.0', 'UTF-8', 'yes');
     // cp:coreProperties
     $objWriter->startElement('cp:coreProperties');
     $objWriter->writeAttribute('xmlns:cp', 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties');
     $objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/');
     $objWriter->writeAttribute('xmlns:dcterms', 'http://purl.org/dc/terms/');
     $objWriter->writeAttribute('xmlns:dcmitype', 'http://purl.org/dc/dcmitype/');
     $objWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     // dc:creator
     $objWriter->writeElement('dc:creator', $pPHPExcel->getProperties()->getCreator());
     // cp:lastModifiedBy
     $objWriter->writeElement('cp:lastModifiedBy', $pPHPExcel->getProperties()->getLastModifiedBy());
     // dcterms:created
     $objWriter->startElement('dcterms:created');
     $objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF');
     $objWriter->writeRaw(date(DATE_W3C, $pPHPExcel->getProperties()->getCreated()));
     $objWriter->endElement();
     // dcterms:modified
     $objWriter->startElement('dcterms:modified');
     $objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF');
     $objWriter->writeRaw(date(DATE_W3C, $pPHPExcel->getProperties()->getModified()));
     $objWriter->endElement();
     // dc:title
     $objWriter->writeElement('dc:title', $pPHPExcel->getProperties()->getTitle());
     // dc:description
     $objWriter->writeElement('dc:description', $pPHPExcel->getProperties()->getDescription());
     // dc:subject
     $objWriter->writeElement('dc:subject', $pPHPExcel->getProperties()->getSubject());
     // cp:keywords
     $objWriter->writeElement('cp:keywords', $pPHPExcel->getProperties()->getKeywords());
     // cp:category
     $objWriter->writeElement('cp:category', $pPHPExcel->getProperties()->getCategory());
     $objWriter->endElement();
     // Return
     return $objWriter->getData();
 }
开发者ID:linhanwei,项目名称:TP,代码行数:53,代码来源:DocProps.php

示例3: writeRichText

 /**
  * Write Rich Text
  *
  * @param 	PHPExcel_Shared_XMLWriter		$objWriter 		XML Writer
  * @param 	PHPExcel_RichText				$pRichText		Rich text
  * @throws 	Exception
  */
 public function writeRichText(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_RichText $pRichText = null)
 {
     // Loop trough rich text elements
     $elements = $pRichText->getRichTextElements();
     foreach ($elements as $element) {
         // r
         $objWriter->startElement('r');
         // rPr
         if ($element instanceof PHPExcel_RichText_Run) {
             // rPr
             $objWriter->startElement('rPr');
             // rFont
             $objWriter->startElement('rFont');
             $objWriter->writeAttribute('val', $element->getFont()->getName());
             $objWriter->endElement();
             // Bold
             $objWriter->startElement('b');
             $objWriter->writeAttribute('val', $element->getFont()->getBold() ? 'true' : 'false');
             $objWriter->endElement();
             // Italic
             $objWriter->startElement('i');
             $objWriter->writeAttribute('val', $element->getFont()->getItalic() ? 'true' : 'false');
             $objWriter->endElement();
             // Striketrough
             $objWriter->startElement('strike');
             $objWriter->writeAttribute('val', $element->getFont()->getStriketrough() ? 'true' : 'false');
             $objWriter->endElement();
             // Color
             $objWriter->startElement('color');
             $objWriter->writeAttribute('rgb', $element->getFont()->getColor()->getARGB());
             $objWriter->endElement();
             // Size
             $objWriter->startElement('sz');
             $objWriter->writeAttribute('val', $element->getFont()->getSize());
             $objWriter->endElement();
             // Underline
             $objWriter->startElement('u');
             $objWriter->writeAttribute('val', $element->getFont()->getUnderline());
             $objWriter->endElement();
             $objWriter->endElement();
         }
         // t
         $objWriter->startElement('t');
         $objWriter->writeAttribute('xml:space', 'preserve');
         $objWriter->writeRaw(PHPExcel_Shared_String::ControlCharacterPHP2OOXML($element->getText()));
         $objWriter->endElement();
         $objWriter->endElement();
     }
 }
开发者ID:teungri,项目名称:RequirementsApp,代码行数:56,代码来源:StringTable.php

示例4: _writeDefinedNameForPrintTitles

 /**
  * Write Defined Name for PrintTitles
  *
  * @param 	PHPExcel_Shared_XMLWriter	$objWriter 		XML Writer
  * @param 	PHPExcel_Worksheet			$pSheet
  * @param 	int							$pSheetId
  * @throws 	Exception
  */
 private function _writeDefinedNameForPrintTitles(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0)
 {
     // definedName for PrintTitles
     if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet() || $pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) {
         $objWriter->startElement('definedName');
         $objWriter->writeAttribute('name', '_xlnm.Print_Titles');
         $objWriter->writeAttribute('localSheetId', $pSheetId);
         // Setting string
         $settingString = '';
         // Columns to repeat
         if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet()) {
             $repeat = $pSheet->getPageSetup()->getColumnsToRepeatAtLeft();
             $settingString = $pSheet->getTitle() . '!$' . $repeat[0] . ':$' . $repeat[1];
         }
         // Rows to repeat
         if ($pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) {
             if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet()) {
                 $settingString .= ',';
             }
             $repeat = $pSheet->getPageSetup()->getRowsToRepeatAtTop();
             $settingString = $pSheet->getTitle() . '!$' . $repeat[0] . ':$' . $repeat[1];
         }
         $objWriter->writeRaw($settingString);
         $objWriter->endElement();
     }
 }
开发者ID:hostellerie,项目名称:nexpro,代码行数:34,代码来源:Workbook.php


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