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


PHP PHPExcel_Shared_XMLWriter::writeAttribute方法代码示例

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


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

示例1: writeVBARelationships

 /**
  * Write relationships for a signed VBA Project
  *
  * @param 	PHPExcel	$pPHPExcel
  * @return 	string 		XML Output
  * @throws 	PHPExcel_Writer_Exception
  */
 public function writeVBARelationships(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');
     // Relationships
     $objWriter->startElement('Relationships');
     $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
     $objWriter->startElement('Relationship');
     $objWriter->writeAttribute('Id', 'rId1');
     $objWriter->writeAttribute('Type', 'http://schemas.microsoft.com/office/2006/relationships/vbaProjectSignature');
     $objWriter->writeAttribute('Target', 'vbaProjectSignature.bin');
     $objWriter->endElement();
     //Relationship
     $objWriter->endElement();
     //Relationships
     // Return
     return $objWriter->getData();
 }
开发者ID:ljhchshm,项目名称:weixin,代码行数:32,代码来源:RelsVBA.php

示例2: write

 public static function write(PHPExcel_Shared_XMLWriter $objWriter, PHPExcel_Cell $cell)
 {
     $comments = $cell->getWorksheet()->getComments();
     if (! isset($comments[$cell->getCoordinate()])) {
         return;
     }
     $comment = $comments[$cell->getCoordinate()];
     
     $objWriter->startElement('office:annotation');
     // $objWriter->writeAttribute('draw:style-name', 'gr1');
     // $objWriter->writeAttribute('draw:text-style-name', 'P1');
     $objWriter->writeAttribute('svg:width', $comment->getWidth());
     $objWriter->writeAttribute('svg:height', $comment->getHeight());
     $objWriter->writeAttribute('svg:x', $comment->getMarginLeft());
     $objWriter->writeAttribute('svg:y', $comment->getMarginTop());
     // $objWriter->writeAttribute('draw:caption-point-x', $comment->getMarginLeft());
     // $objWriter->writeAttribute('draw:caption-point-y', $comment->getMarginTop());
     $objWriter->writeElement('dc:creator', $comment->getAuthor());
     // TODO: Not realized in PHPExcel_Comment yet.
     // $objWriter->writeElement('dc:date', $comment->getDate());
     $objWriter->writeElement('text:p', $comment->getText()
         ->getPlainText());
     // $objWriter->writeAttribute('draw:text-style-name', 'P1');
     $objWriter->endElement();
 }
开发者ID:nhatlang19,项目名称:elearningONL,代码行数:25,代码来源:Comment.php

示例3: write

 /**
  * Write settings.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');
     // Settings
     $objWriter->startElement('office:document-settings');
     $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:config', 'urn:oasis:names:tc:opendocument:xmlns:config:1.0');
     $objWriter->writeAttribute('xmlns:ooo', 'http://openoffice.org/2004/office');
     $objWriter->writeAttribute('office:version', '1.2');
     $objWriter->startElement('office:settings');
     $objWriter->startElement('config:config-item-set');
     $objWriter->writeAttribute('config:name', 'ooo:view-settings');
     $objWriter->startElement('config:config-item-map-indexed');
     $objWriter->writeAttribute('config:name', 'Views');
     $objWriter->endElement();
     $objWriter->endElement();
     $objWriter->startElement('config:config-item-set');
     $objWriter->writeAttribute('config:name', 'ooo:configuration-settings');
     $objWriter->endElement();
     $objWriter->endElement();
     $objWriter->endElement();
     return $objWriter->getData();
 }
开发者ID:alyayazilim,项目名称:E-Ticaret-2015,代码行数:41,代码来源:Settings.php

示例4: 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

示例5: _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

示例6: _writeCellSpan

 /**
  * Write span
  *
  * @param PHPExcel_Shared_XMLWriter $objWriter
  * @param integer $curColumn
  * @param integer $prevColumn
  */
 private function _writeCellSpan(PHPExcel_Shared_XMLWriter $objWriter, $curColumn, $prevColumn)
 {
     $diff = $curColumn - $prevColumn - 1;
     if (1 === $diff) {
         $objWriter->writeElement('table:table-cell');
     } elseif ($diff > 1) {
         $objWriter->startElement('table:table-cell');
         $objWriter->writeAttribute('table:number-columns-repeated', $diff);
         $objWriter->endElement();
     }
 }
开发者ID:MyPHPTools,项目名称:PHPExcel,代码行数:18,代码来源:Content.php

示例7: _writeCalcPr

 /**
  * Write calcPr
  *
  * @param    PHPExcel_Shared_XMLWriter $objWriter      XML Writer
  * @param    boolean                   $recalcRequired Indicate whether formulas should be recalculated before writing
  *
  * @throws    PHPExcel_Writer_Exception
  */
 private function _writeCalcPr(PHPExcel_Shared_XMLWriter $objWriter = null, $recalcRequired = true)
 {
     $objWriter->startElement('calcPr');
     //	Set the calcid to a higher value than Excel itself will use, otherwise Excel will always recalc
     //  If MS Excel does do a recalc, then users opening a file in MS Excel will be prompted to save on exit
     //     because the file has changed
     $objWriter->writeAttribute('calcId', '999999');
     $objWriter->writeAttribute('calcMode', 'auto');
     //	fullCalcOnLoad isn't needed if we've recalculating for the save
     $objWriter->writeAttribute('calcCompleted', $recalcRequired ? 1 : 0);
     $objWriter->writeAttribute('fullCalcOnLoad', $recalcRequired ? 0 : 1);
     $objWriter->endElement();
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:21,代码来源:Workbook.php

示例8: _writeCellStyleXf

 /**
  * Write Cell Style Xf
  *
  * @param    PHPExcel_Shared_XMLWriter $objWriter XML Writer
  * @param    PHPExcel_Style            $pStyle    Style
  * @param    PHPExcel                  $pPHPExcel Workbook
  *
  * @throws    PHPExcel_Writer_Exception
  */
 private function _writeCellStyleXf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null, PHPExcel $pPHPExcel = null)
 {
     // xf
     $objWriter->startElement('xf');
     $objWriter->writeAttribute('xfId', 0);
     $objWriter->writeAttribute('fontId', (int) $this->getParentWriter()->getFontHashTable()->getIndexForHashCode($pStyle->getFont()->getHashCode()));
     if ($pStyle->getQuotePrefix()) {
         $objWriter->writeAttribute('quotePrefix', 1);
     }
     if ($pStyle->getNumberFormat()->getBuiltInFormatCode() === false) {
         $objWriter->writeAttribute('numFmtId', (int) ($this->getParentWriter()->getNumFmtHashTable()->getIndexForHashCode($pStyle->getNumberFormat()->getHashCode()) + 164));
     } else {
         $objWriter->writeAttribute('numFmtId', (int) $pStyle->getNumberFormat()->getBuiltInFormatCode());
     }
     $objWriter->writeAttribute('fillId', (int) $this->getParentWriter()->getFillHashTable()->getIndexForHashCode($pStyle->getFill()->getHashCode()));
     $objWriter->writeAttribute('borderId', (int) $this->getParentWriter()->getBordersHashTable()->getIndexForHashCode($pStyle->getBorders()->getHashCode()));
     // Apply styles?
     $objWriter->writeAttribute('applyFont', $pPHPExcel->getDefaultStyle()->getFont()->getHashCode() != $pStyle->getFont()->getHashCode() ? '1' : '0');
     $objWriter->writeAttribute('applyNumberFormat', $pPHPExcel->getDefaultStyle()->getNumberFormat()->getHashCode() != $pStyle->getNumberFormat()->getHashCode() ? '1' : '0');
     $objWriter->writeAttribute('applyFill', $pPHPExcel->getDefaultStyle()->getFill()->getHashCode() != $pStyle->getFill()->getHashCode() ? '1' : '0');
     $objWriter->writeAttribute('applyBorder', $pPHPExcel->getDefaultStyle()->getBorders()->getHashCode() != $pStyle->getBorders()->getHashCode() ? '1' : '0');
     $objWriter->writeAttribute('applyAlignment', $pPHPExcel->getDefaultStyle()->getAlignment()->getHashCode() != $pStyle->getAlignment()->getHashCode() ? '1' : '0');
     if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
         $objWriter->writeAttribute('applyProtection', 'true');
     }
     // alignment
     $objWriter->startElement('alignment');
     $objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
     $objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
     $textRotation = 0;
     if ($pStyle->getAlignment()->getTextRotation() >= 0) {
         $textRotation = $pStyle->getAlignment()->getTextRotation();
     } else {
         if ($pStyle->getAlignment()->getTextRotation() < 0) {
             $textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
         }
     }
     $objWriter->writeAttribute('textRotation', $textRotation);
     $objWriter->writeAttribute('wrapText', $pStyle->getAlignment()->getWrapText() ? 'true' : 'false');
     $objWriter->writeAttribute('shrinkToFit', $pStyle->getAlignment()->getShrinkToFit() ? 'true' : 'false');
     if ($pStyle->getAlignment()->getIndent() > 0) {
         $objWriter->writeAttribute('indent', $pStyle->getAlignment()->getIndent());
     }
     $objWriter->endElement();
     // protection
     if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
         $objWriter->startElement('protection');
         if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
             $objWriter->writeAttribute('locked', $pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false');
         }
         if ($pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
             $objWriter->writeAttribute('hidden', $pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false');
         }
         $objWriter->endElement();
     }
     $objWriter->endElement();
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:66,代码来源:Style.php

示例9: _writeVMLComment

 /**
  * Write VML comment to XML format
  *
  * @param   PHPExcel_Worksheet              $pWorksheet
  * @param 	PHPExcel_Shared_XMLWriter		$objWriter 			XML Writer
  * @param	string							$pCellReference		Cell reference
  * @param 	PHPExcel_Comment				$pComment			Comment
  * @throws 	PHPExcel_Writer_Exception
  */
 public function _writeVMLComment(PHPExcel_Worksheet $pWorksheet = null, PHPExcel_Shared_XMLWriter $objWriter = null, $pCellReference = 'A1', PHPExcel_Comment $pComment = null)
 {
     // Metadata
     list($column, $row) = PHPExcel_Cell::coordinateFromString($pCellReference);
     $column = PHPExcel_Cell::columnIndexFromString($column);
     $id = 1024 + $column + $row;
     $id = substr($id, 0, 4);
     $cssWidth = $pComment->getWidth();
     $cssHeight = $pComment->getHeight();
     // v:shape
     $objWriter->startElement('v:shape');
     $objWriter->writeAttribute('id', '_x0000_s' . $id);
     $objWriter->writeAttribute('type', '#_x0000_t202');
     $objWriter->writeAttribute('style', 'position:absolute;margin-left:' . $pComment->getMarginLeft() . ';margin-top:' . $pComment->getMarginTop() . ';width:' . $cssWidth . ';height:' . $cssHeight . ';z-index:1;visibility:' . ($pComment->getVisible() ? 'visible' : 'hidden'));
     $objWriter->writeAttribute('fillcolor', '#' . $pComment->getFillColor()->getRGB());
     $objWriter->writeAttribute('o:insetmode', 'auto');
     // v:fill
     $objWriter->startElement('v:fill');
     $objWriter->writeAttribute('color2', '#' . $pComment->getFillColor()->getRGB());
     $objWriter->endElement();
     // v:shadow
     $objWriter->startElement('v:shadow');
     $objWriter->writeAttribute('on', 't');
     $objWriter->writeAttribute('color', 'black');
     $objWriter->writeAttribute('obscured', 't');
     $objWriter->endElement();
     // v:path
     $objWriter->startElement('v:path');
     $objWriter->writeAttribute('o:connecttype', 'none');
     $objWriter->endElement();
     // v:textbox
     $objWriter->startElement('v:textbox');
     $objWriter->writeAttribute('style', 'mso-direction-alt:auto');
     // div
     $objWriter->startElement('div');
     $objWriter->writeAttribute('style', 'text-align:left');
     $objWriter->endElement();
     $objWriter->endElement();
     // x:ClientData
     $objWriter->startElement('x:ClientData');
     $objWriter->writeAttribute('ObjectType', 'Note');
     // x:MoveWithCells
     $objWriter->writeElement('x:MoveWithCells', '');
     // x:SizeWithCells
     $objWriter->writeElement('x:SizeWithCells', '');
     // x:Anchor
     // anchor is a nice way to locate the comment sensibly with respect to the sheet's rows/columns, but
     // in order to do so, need to be able to convert roughly to point dimensions from the comments
     // width/height, which are optimized for css
     if (preg_match('/\\s*pt\\s*$/', $cssWidth) && preg_match('/\\s*pt\\s*$/', $cssHeight)) {
         // compute CSS height to an integer # pts
         $width = intval(preg_replace('/\\s*pt\\s*$/', '', $cssWidth));
         $height = intval(preg_replace('/\\s*pt\\s*$/', '', $cssHeight));
         // starting from the row/column this is being placed in try
         // to figure out the row column that should anchor the lower-right
         // corner of the comment
         $clearedWidth = 0;
         $clearedHeight = 0;
         $maxColumns = 2;
         $maxRows = 10;
         // loop incremenets, so decrement both to start
         $curColumn = $column - 1;
         $curRow = $row - 1;
         while ($clearedWidth < $width && $curColumn - $column < $maxColumns) {
             ++$curColumn;
             $dim = $pWorksheet->getColumnDimensionByColumn($curColumn, false);
             $clearedWidth += $dim && $dim->getWidth() > 0 ? $dim->getWidth() : 96;
         }
         while ($clearedHeight < $height && $curRow - $row < $maxRows) {
             ++$curRow;
             $dim = $pWorksheet->getRowDimension($curRow, false);
             $clearedHeight += $dim && $dim->getRowHeight() > 0 ? $dim->getRowHeight() : 14;
         }
         $colBump = 15;
         $rowBump = 10;
         $anchor = $column . ', ' . $colBump . ', ' . ($row - 1) . ', ' . $rowBump . ', ' . $curColumn . ', ' . max($clearedWidth - $width, 0) . ', ' . $curRow . ', ' . max($clearedHeight - $height, 0);
         // lower-right row offset
         $objWriter->writeElement('x:Anchor', $anchor);
     }
     // x:AutoFill
     $objWriter->writeElement('x:AutoFill', 'False');
     // x:Row
     $objWriter->writeElement('x:Row', $row - 1);
     // x:Column
     $objWriter->writeElement('x:Column', $column - 1);
     $objWriter->endElement();
     $objWriter->endElement();
 }
开发者ID:AlphaPipe,项目名称:PHPExcel,代码行数:97,代码来源:Comments.php

示例10: writeHeaderFooterDrawingRelationships

 /**
  * Write header/footer drawing relationships to XML format
  *
  * @param    PHPExcel_Worksheet $pWorksheet
  *
  * @return    string                        XML Output
  * @throws    PHPExcel_Writer_Exception
  */
 public function writeHeaderFooterDrawingRelationships(PHPExcel_Worksheet $pWorksheet = 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');
     // Relationships
     $objWriter->startElement('Relationships');
     $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
     // Loop through images and write relationships
     foreach ($pWorksheet->getHeaderFooter()->getImages() as $key => $value) {
         // Write relationship for image drawing
         $this->_writeRelationship($objWriter, $key, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', '../media/' . $value->getIndexedFilename());
     }
     $objWriter->endElement();
     // Return
     return $objWriter->getData();
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:31,代码来源:Rels.php

示例11: _writeDefaultContentType

 /**
  * Write Default content type
  *
  * @param    PHPExcel_Shared_XMLWriter $objWriter    XML Writer
  * @param    string                    $pPartname    Part name
  * @param    string                    $pContentType Content type
  *
  * @throws    PHPExcel_Writer_Exception
  */
 private function _writeDefaultContentType(PHPExcel_Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '')
 {
     if ($pPartname != '' && $pContentType != '') {
         // Write content type
         $objWriter->startElement('Default');
         $objWriter->writeAttribute('Extension', $pPartname);
         $objWriter->writeAttribute('ContentType', $pContentType);
         $objWriter->endElement();
     } else {
         throw new PHPExcel_Writer_Exception("Invalid parameters passed.");
     }
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:21,代码来源:ContentTypes.php

示例12: _writeDefinedNameForPrintArea

 /**
  * Write Defined Name for PrintTitles
  *
  * @param 	PHPExcel_Shared_XMLWriter	$objWriter 		XML Writer
  * @param 	PHPExcel_Worksheet			$pSheet
  * @param 	int							$pSheetId
  * @throws 	Exception
  */
 private function _writeDefinedNameForPrintArea(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0)
 {
     // definedName for PrintArea
     if ($pSheet->getPageSetup()->isPrintAreaSet()) {
         $objWriter->startElement('definedName');
         $objWriter->writeAttribute('name', '_xlnm.Print_Area');
         $objWriter->writeAttribute('localSheetId', $pSheetId);
         // Setting string
         $settingString = '';
         // Print area
         $printArea = PHPExcel_Cell::splitRange($pSheet->getPageSetup()->getPrintArea());
         $printArea[0] = PHPExcel_Cell::absoluteCoordinate($printArea[0]);
         $printArea[1] = PHPExcel_Cell::absoluteCoordinate($printArea[1]);
         $objWriter->writeRaw('\'' . $pSheet->getTitle() . '\'!' . implode(':', $printArea));
         $objWriter->endElement();
     }
 }
开发者ID:laiello,项目名称:myopensources,代码行数:25,代码来源:Workbook.php

示例13: writeTheme

 /**
  * Write theme to XML format
  *
  * @param 	PHPExcel	$pPHPExcel
  * @return 	string 		XML Output
  * @throws 	Exception
  */
 public function writeTheme(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');
     // a:theme
     $objWriter->startElement('a:theme');
     $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main');
     $objWriter->writeAttribute('name', 'Office Theme');
     // a:themeElements
     $objWriter->startElement('a:themeElements');
     // a:clrScheme
     $objWriter->startElement('a:clrScheme');
     $objWriter->writeAttribute('name', 'Office');
     // a:dk1
     $objWriter->startElement('a:dk1');
     // a:sysClr
     $objWriter->startElement('a:sysClr');
     $objWriter->writeAttribute('val', 'windowText');
     $objWriter->writeAttribute('lastClr', '000000');
     $objWriter->endElement();
     $objWriter->endElement();
     // a:lt1
     $objWriter->startElement('a:lt1');
     // a:sysClr
     $objWriter->startElement('a:sysClr');
     $objWriter->writeAttribute('val', 'window');
     $objWriter->writeAttribute('lastClr', 'FFFFFF');
     $objWriter->endElement();
     $objWriter->endElement();
     // a:dk2
     $objWriter->startElement('a:dk2');
     // a:sysClr
     $objWriter->startElement('a:srgbClr');
     $objWriter->writeAttribute('val', '1F497D');
     $objWriter->endElement();
     $objWriter->endElement();
     // a:lt2
     $objWriter->startElement('a:lt2');
     // a:sysClr
     $objWriter->startElement('a:srgbClr');
     $objWriter->writeAttribute('val', 'EEECE1');
     $objWriter->endElement();
     $objWriter->endElement();
     // a:accent1
     $objWriter->startElement('a:accent1');
     // a:sysClr
     $objWriter->startElement('a:srgbClr');
     $objWriter->writeAttribute('val', '4F81BD');
     $objWriter->endElement();
     $objWriter->endElement();
     // a:accent2
     $objWriter->startElement('a:accent2');
     // a:sysClr
     $objWriter->startElement('a:srgbClr');
     $objWriter->writeAttribute('val', 'C0504D');
     $objWriter->endElement();
     $objWriter->endElement();
     // a:accent3
     $objWriter->startElement('a:accent3');
     // a:sysClr
     $objWriter->startElement('a:srgbClr');
     $objWriter->writeAttribute('val', '9BBB59');
     $objWriter->endElement();
     $objWriter->endElement();
     // a:accent4
     $objWriter->startElement('a:accent4');
     // a:sysClr
     $objWriter->startElement('a:srgbClr');
     $objWriter->writeAttribute('val', '8064A2');
     $objWriter->endElement();
     $objWriter->endElement();
     // a:accent5
     $objWriter->startElement('a:accent5');
     // a:sysClr
     $objWriter->startElement('a:srgbClr');
     $objWriter->writeAttribute('val', '4BACC6');
     $objWriter->endElement();
     $objWriter->endElement();
     // a:accent6
     $objWriter->startElement('a:accent6');
     // a:sysClr
     $objWriter->startElement('a:srgbClr');
     $objWriter->writeAttribute('val', 'F79646');
     $objWriter->endElement();
     $objWriter->endElement();
     // a:hlink
//.........这里部分代码省略.........
开发者ID:nagiro,项目名称:hospici_cultural,代码行数:101,代码来源:Theme.php

示例14: 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

示例15: _writeDefinedNameForPrintArea

 /**
  * Write Defined Name for PrintTitles
  *
  * @param 	PHPExcel_Shared_XMLWriter	$objWriter 		XML Writer
  * @param 	PHPExcel_Worksheet			$pSheet
  * @param 	int							$pSheetId
  * @throws 	PHPExcel_Writer_Exception
  */
 private function _writeDefinedNameForPrintArea(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0)
 {
     // definedName for PrintArea
     if ($pSheet->getPageSetup()->isPrintAreaSet()) {
         $objWriter->startElement('definedName');
         $objWriter->writeAttribute('name', '_xlnm.Print_Area');
         $objWriter->writeAttribute('localSheetId', $pSheetId);
         // Setting string
         $settingString = '';
         // Print area
         $printArea = PHPExcel_Cell::splitRange($pSheet->getPageSetup()->getPrintArea());
         $chunks = array();
         foreach ($printArea as $printAreaRect) {
             $printAreaRect[0] = PHPExcel_Cell::absoluteReference($printAreaRect[0]);
             $printAreaRect[1] = PHPExcel_Cell::absoluteReference($printAreaRect[1]);
             $chunks[] = '\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!' . implode(':', $printAreaRect);
         }
         $objWriter->writeRawData(implode(',', $chunks));
         $objWriter->endElement();
     }
 }
开发者ID:Princelo,项目名称:bioerp,代码行数:29,代码来源:Workbook.php


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