56 $objWriter->startDocument(
'1.0',
'UTF-8',
'yes');
60 $objWriter->writeAttribute(
'xml:space',
'preserve');
61 $objWriter->writeAttribute(
'xmlns',
'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
68 for ($i = 0; $i < $this->
getParentWriter()->getNumFmtHashTable()->count(); ++$i) {
79 for ($i = 0; $i < $this->
getParentWriter()->getFontHashTable()->count(); ++$i) {
90 for ($i = 0; $i < $this->
getParentWriter()->getFillHashTable()->count(); ++$i) {
101 for ($i = 0; $i < $this->
getParentWriter()->getBordersHashTable()->count(); ++$i) {
123 $objWriter->writeAttribute(
'count', count($pPHPExcel->getCellXfCollection()));
126 foreach ($pPHPExcel->getCellXfCollection() as $cellXf) {
150 for ($i = 0; $i < $this->
getParentWriter()->getStylesConditionalHashTable()->count(); ++$i) {
158 $objWriter->writeAttribute(
'defaultTableStyle',
'TableStyleMedium9');
159 $objWriter->writeAttribute(
'defaultPivotStyle',
'PivotTableStyle1');
182 } elseif($pFill->getFillType() !== NULL) {
202 $objWriter->writeAttribute(
'type', $pFill->getFillType());
203 $objWriter->writeAttribute(
'degree', $pFill->getRotation());
211 $objWriter->writeAttribute(
'rgb', $pFill->getStartColor()->getARGB());
222 $objWriter->writeAttribute(
'rgb', $pFill->getEndColor()->getARGB());
246 $objWriter->writeAttribute(
'patternType', $pFill->getFillType());
250 if ($pFill->getStartColor()->getARGB()) {
252 $objWriter->writeAttribute(
'rgb', $pFill->getStartColor()->getARGB());
258 if ($pFill->getEndColor()->getARGB()) {
260 $objWriter->writeAttribute(
'rgb', $pFill->getEndColor()->getARGB());
288 if ($pFont->getBold() !== NULL) {
290 $objWriter->writeAttribute(
'val', $pFont->getBold() ?
'1' :
'0');
295 if ($pFont->getItalic() !== NULL) {
297 $objWriter->writeAttribute(
'val', $pFont->getItalic() ?
'1' :
'0');
302 if ($pFont->getStrikethrough() !== NULL) {
304 $objWriter->writeAttribute(
'val', $pFont->getStrikethrough() ?
'1' :
'0');
309 if ($pFont->getUnderline() !== NULL) {
311 $objWriter->writeAttribute(
'val', $pFont->getUnderline());
316 if ($pFont->getSuperScript() === TRUE || $pFont->getSubScript() === TRUE) {
318 if ($pFont->getSuperScript() === TRUE) {
319 $objWriter->writeAttribute(
'val',
'superscript');
320 }
else if ($pFont->getSubScript() === TRUE) {
321 $objWriter->writeAttribute(
'val',
'subscript');
327 if ($pFont->getSize() !== NULL) {
329 $objWriter->writeAttribute(
'val', $pFont->getSize());
334 if ($pFont->getColor()->getARGB() !== NULL) {
336 $objWriter->writeAttribute(
'rgb', $pFont->getColor()->getARGB());
341 if ($pFont->getName() !== NULL) {
343 $objWriter->writeAttribute(
'val', $pFont->getName());
362 switch ($pBorders->getDiagonalDirection()) {
364 $objWriter->writeAttribute(
'diagonalUp',
'true');
365 $objWriter->writeAttribute(
'diagonalDown',
'false');
368 $objWriter->writeAttribute(
'diagonalUp',
'false');
369 $objWriter->writeAttribute(
'diagonalDown',
'true');
372 $objWriter->writeAttribute(
'diagonalUp',
'true');
373 $objWriter->writeAttribute(
'diagonalDown',
'true');
399 $objWriter->writeAttribute(
'fontId', (
int)$this->
getParentWriter()->getFontHashTable()->getIndexForHashCode($pStyle->getFont()->getHashCode()));
400 if ($pStyle->getQuotePrefix()) {
404 if ($pStyle->getNumberFormat()->getBuiltInFormatCode() ===
false) {
405 $objWriter->writeAttribute(
'numFmtId', (
int)($this->
getParentWriter()->getNumFmtHashTable()->getIndexForHashCode($pStyle->getNumberFormat()->getHashCode()) + 164) );
407 $objWriter->writeAttribute(
'numFmtId', (
int)$pStyle->getNumberFormat()->getBuiltInFormatCode());
410 $objWriter->writeAttribute(
'fillId', (
int)$this->
getParentWriter()->getFillHashTable()->getIndexForHashCode($pStyle->getFill()->getHashCode()));
411 $objWriter->writeAttribute(
'borderId', (
int)$this->
getParentWriter()->getBordersHashTable()->getIndexForHashCode($pStyle->getBorders()->getHashCode()));
414 $objWriter->writeAttribute(
'applyFont', ($pPHPExcel->getDefaultStyle()->getFont()->getHashCode() != $pStyle->getFont()->getHashCode()) ?
'1' :
'0');
415 $objWriter->writeAttribute(
'applyNumberFormat', ($pPHPExcel->getDefaultStyle()->getNumberFormat()->getHashCode() != $pStyle->getNumberFormat()->getHashCode()) ?
'1' :
'0');
416 $objWriter->writeAttribute(
'applyFill', ($pPHPExcel->getDefaultStyle()->getFill()->getHashCode() != $pStyle->getFill()->getHashCode()) ?
'1' :
'0');
417 $objWriter->writeAttribute(
'applyBorder', ($pPHPExcel->getDefaultStyle()->getBorders()->getHashCode() != $pStyle->getBorders()->getHashCode()) ?
'1' :
'0');
418 $objWriter->writeAttribute(
'applyAlignment', ($pPHPExcel->getDefaultStyle()->getAlignment()->getHashCode() != $pStyle->getAlignment()->getHashCode()) ?
'1' :
'0');
420 $objWriter->writeAttribute(
'applyProtection',
'true');
425 $objWriter->writeAttribute(
'horizontal', $pStyle->getAlignment()->getHorizontal());
426 $objWriter->writeAttribute(
'vertical', $pStyle->getAlignment()->getVertical());
429 if ($pStyle->getAlignment()->getTextRotation() >= 0) {
430 $textRotation = $pStyle->getAlignment()->getTextRotation();
431 }
else if ($pStyle->getAlignment()->getTextRotation() < 0) {
432 $textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
434 $objWriter->writeAttribute(
'textRotation', $textRotation);
436 $objWriter->writeAttribute(
'wrapText', ($pStyle->getAlignment()->getWrapText() ?
'true' :
'false'));
437 $objWriter->writeAttribute(
'shrinkToFit', ($pStyle->getAlignment()->getShrinkToFit() ?
'true' :
'false'));
439 if ($pStyle->getAlignment()->getIndent() > 0) {
440 $objWriter->writeAttribute(
'indent', $pStyle->getAlignment()->getIndent());
442 if ($pStyle->getAlignment()->getReadorder() > 0) {
443 $objWriter->writeAttribute(
'readingOrder', $pStyle->getAlignment()->getReadorder());
485 if ($pStyle->getAlignment()->getHorizontal() !== NULL) {
486 $objWriter->writeAttribute(
'horizontal', $pStyle->getAlignment()->getHorizontal());
488 if ($pStyle->getAlignment()->getVertical() !== NULL) {
489 $objWriter->writeAttribute(
'vertical', $pStyle->getAlignment()->getVertical());
492 if ($pStyle->getAlignment()->getTextRotation() !== NULL) {
494 if ($pStyle->getAlignment()->getTextRotation() >= 0) {
495 $textRotation = $pStyle->getAlignment()->getTextRotation();
496 }
else if ($pStyle->getAlignment()->getTextRotation() < 0) {
497 $textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
499 $objWriter->writeAttribute(
'textRotation', $textRotation);
507 if (($pStyle->getProtection()->getLocked() !== NULL) ||
508 ($pStyle->getProtection()->getHidden() !== NULL)) {
512 if (($pStyle->getProtection()->getLocked() !== NULL) &&
516 if (($pStyle->getProtection()->getHidden() !== NULL) &&
540 $objWriter->writeAttribute(
'style', $pBorder->getBorderStyle());
544 $objWriter->writeAttribute(
'rgb', $pBorder->getColor()->getARGB());
562 $formatCode = $pNumberFormat->getFormatCode();
565 if ($formatCode !== NULL) {
567 $objWriter->writeAttribute(
'numFmtId', ($pId + 164));
568 $objWriter->writeAttribute(
'formatCode', $formatCode);
582 $aStyles = $pPHPExcel->getCellXfCollection();
599 $sheetCount = $pPHPExcel->getSheetCount();
600 for ($i = 0; $i < $sheetCount; ++$i) {
601 foreach ($pPHPExcel->getSheet($i)->getConditionalStylesCollection() as
$conditionalStyles) {
603 $aStyles[] = $conditionalStyle;
633 foreach ($aStyles as
$style) {
634 if (!array_key_exists($style->getFill()->getHashCode(), $aFills)) {
635 $aFills[ $style->getFill()->getHashCode() ] = $style->getFill();
655 foreach ($aStyles as
$style) {
656 if (!array_key_exists($style->getFont()->getHashCode(), $aFonts)) {
657 $aFonts[ $style->getFont()->getHashCode() ] = $style->getFont();
677 foreach ($aStyles as
$style) {
678 if (!array_key_exists($style->getBorders()->getHashCode(), $aBorders)) {
679 $aBorders[ $style->getBorders()->getHashCode() ] = $style->getBorders();
699 foreach ($aStyles as
$style) {
700 if ($style->getNumberFormat()->getBuiltInFormatCode() ===
false && !array_key_exists($style->getNumberFormat()->getHashCode(), $aNumFmts)) {
701 $aNumFmts[ $style->getNumberFormat()->getHashCode() ] = $style->getNumberFormat();
_writePatternFill(PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel_Style_Fill $pFill=null)
Write Pattern Fill.
writeStyles(PHPExcel $pPHPExcel=null)
Write styles to XML format.
_writeCellStyleXf(PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel_Style $pStyle=null, PHPExcel $pPHPExcel=null)
Write Cell Style Xf.
getParentWriter()
Get parent IWriter object.
allFills(PHPExcel $pPHPExcel=null)
Get an array of all fills.
_writeBorderPr(PHPExcel_Shared_XMLWriter $objWriter=null, $pName='left', PHPExcel_Style_Border $pBorder=null)
Write BorderPr.
allFonts(PHPExcel $pPHPExcel=null)
Get an array of all fonts.
_writeFill(PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel_Style_Fill $pFill=null)
Write Fill.
allBorders(PHPExcel $pPHPExcel=null)
Get an array of all borders.
allNumberFormats(PHPExcel $pPHPExcel=null)
Get an array of all number formats.
const PROTECTION_INHERIT
Protection styles.
const FILL_PATTERN_GRAY125
Create styles array
The data for the language used.
_writeFont(PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel_Style_Font $pFont=null)
Write Font.
const PROTECTION_PROTECTED
allStyles(PHPExcel $pPHPExcel=null)
Get an array of all styles.
_writeNumFmt(PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel_Style_NumberFormat $pNumberFormat=null, $pId=0)
Write NumberFormat.
allConditionalStyles(PHPExcel $pPHPExcel=null)
Get an array of all conditional styles.
_writeGradientFill(PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel_Style_Fill $pFill=null)
Write Gradient Fill.
const STORAGE_MEMORY
Temporary storage method.
_writeBorder(PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel_Style_Borders $pBorders=null)
Write Border.
const FILL_GRADIENT_LINEAR
_writeCellStyleDxf(PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel_Style $pStyle=null)
Write Cell Style Dxf.