本文整理汇总了PHP中PHPExcel_Shared_XMLWriter类的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Shared_XMLWriter类的具体用法?PHP PHPExcel_Shared_XMLWriter怎么用?PHP PHPExcel_Shared_XMLWriter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PHPExcel_Shared_XMLWriter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: _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();
}
}
示例3: 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();
}
示例4: 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();
}
示例5: 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();
}
示例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();
}
}
示例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();
}
示例8: _writeCellStyleDxf
/**
* Write Cell Style Dxf
*
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
* @param PHPExcel_Style $pStyle Style
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeCellStyleDxf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null)
{
// dxf
$objWriter->startElement('dxf');
// font
$this->_writeFont($objWriter, $pStyle->getFont());
// numFmt
$this->_writeNumFmt($objWriter, $pStyle->getNumberFormat());
// fill
$this->_writeFill($objWriter, $pStyle->getFill());
// alignment
$objWriter->startElement('alignment');
if ($pStyle->getAlignment()->getHorizontal() !== null) {
$objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
}
if ($pStyle->getAlignment()->getVertical() !== null) {
$objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
}
if ($pStyle->getAlignment()->getTextRotation() !== null) {
$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->endElement();
// border
$this->_writeBorder($objWriter, $pStyle->getBorders());
// protection
if ($pStyle->getProtection()->getLocked() !== null || $pStyle->getProtection()->getHidden() !== null) {
if ($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT) {
$objWriter->startElement('protection');
if ($pStyle->getProtection()->getLocked() !== null && $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() !== null && $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();
}
示例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();
}
示例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();
}
示例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.");
}
}
示例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();
}
}
示例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
//.........这里部分代码省略.........
示例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();
}
示例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();
}
}