Write file version

@param 	PHPExcel_Shared_XMLWriter $objWriter 		XML Writer
@throws 	PHPExcel_Writer_Exception
777866
private function _writeFileVersion(PHPExcel_Shared_XMLWriter $objWriter = null)
	{
		$objWriter->startElement('fileVersion');
		$objWriter->writeAttribute('appName', 'xl');
		$objWriter->writeAttribute('lastEdited', '4');
		$objWriter->writeAttribute('lowestEdited', '4');
		$objWriter->writeAttribute('rupBuild', '4505');
		$objWriter->endElement();
	}
159004
private function writeCells(PHPExcel_Shared_XMLWriter $objWriter, PHPExcel_Worksheet_Row $row)
    {
        $number_cols_repeated = self::NUMBER_COLS_REPEATED_MAX;
        $prev_column = -1;
        $cells = $row->getCellIterator();
        while ($cells->valid()) {
            $cell = $cells->current();
            $column = PHPExcel_Cell::columnIndexFromString($cell->getColumn()) - 1;

            $this->writeCellSpan($objWriter, $column, $prev_column);
            $objWriter->startElement('table:table-cell');

            switch ($cell->getDataType()) {
                case PHPExcel_Cell_DataType::TYPE_BOOL:
                    $objWriter->writeAttribute('office:value-type', 'boolean');
                    $objWriter->writeAttribute('office:value', $cell->getValue());
                    $objWriter->writeElement('text:p', $cell->getValue());
                    break;

                case PHPExcel_Cell_DataType::TYPE_ERROR:
                    throw new PHPExcel_Writer_Exception('Writing of error not implemented yet.');
                    break;

                case PHPExcel_Cell_DataType::TYPE_FORMULA:
                    try {
                        $formula_value = $cell->getCalculatedValue();
                    } catch (Exception $e) {
                        $formula_value = $cell->getValue();
                    }
                    $objWriter->writeAttribute('table:formula', 'of:' . $cell->getValue());
                    if (is_numeric($formula_value)) {
                        $objWriter->writeAttribute('office:value-type', 'float');
                    } else {
                        $objWriter->writeAttribute('office:value-type', 'string');
                    }
                    $objWriter->writeAttribute('office:value', $formula_value);
                    $objWriter->writeElement('text:p', $formula_value);
                    break;

                case PHPExcel_Cell_DataType::TYPE_INLINE:
                    throw new PHPExcel_Writer_Exception('Writing of inline not implemented yet.');
                    break;

                case PHPExcel_Cell_DataType::TYPE_NUMERIC:
                    $objWriter->writeAttribute('office:value-type', 'float');
                    $objWriter->writeAttribute('office:value', $cell->getValue());
                    $objWriter->writeElement('text:p', $cell->getValue());
                    break;

                case PHPExcel_Cell_DataType::TYPE_STRING:
                    $objWriter->writeAttribute('office:value-type', 'string');
                    $objWriter->writeElement('text:p', $cell->getValue());
                    break;
            }
            PHPExcel_Writer_OpenDocument_Cell_Comment::write($objWriter, $cell);
            $objWriter->endElement();
            $prev_column = $column;
            $cells->next();
        }
        $number_cols_repeated = $number_cols_repeated - $prev_column - 1;
        if ($number_cols_repeated > 0) {
            if ($number_cols_repeated > 1) {
                $objWriter->startElement('table:table-cell');
                $objWriter->writeAttribute('table:number-columns-repeated', $number_cols_repeated);
                $objWriter->endElement();
            } else {
                $objWriter->writeElement('table:table-cell');
            }
        }
    }
1248305
private function writeFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null)
    {
        // Check if this is a pattern type or gradient type
        if ($pFill->getFillType() === PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR ||
            $pFill->getFillType() === PHPExcel_Style_Fill::FILL_GRADIENT_PATH) {
            // Gradient fill
            $this->writeGradientFill($objWriter, $pFill);
        } elseif ($pFill->getFillType() !== null) {
            // Pattern fill
            $this->writePatternFill($objWriter, $pFill);
        }
    }
730914
public function _writeDrawing(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet_BaseDrawing $pDrawing = null, $pRelationId = -1)
	{
		if ($pRelationId >= 0) {
			// xdr:oneCellAnchor
			$objWriter->startElement('xdr:oneCellAnchor');
				// Image location
				$aCoordinates 		= PHPExcel_Cell::coordinateFromString($pDrawing->getCoordinates());
				$aCoordinates[0] 	= PHPExcel_Cell::columnIndexFromString($aCoordinates[0]);

				// xdr:from
				$objWriter->startElement('xdr:from');
					$objWriter->writeElement('xdr:col', $aCoordinates[0] - 1);
					$objWriter->writeElement('xdr:colOff', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getOffsetX()));
					$objWriter->writeElement('xdr:row', $aCoordinates[1] - 1);
					$objWriter->writeElement('xdr:rowOff', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getOffsetY()));
				$objWriter->endElement();

				// xdr:ext
				$objWriter->startElement('xdr:ext');
					$objWriter->writeAttribute('cx', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getWidth()));
					$objWriter->writeAttribute('cy', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getHeight()));
				$objWriter->endElement();

				// xdr:pic
				$objWriter->startElement('xdr:pic');

					// xdr:nvPicPr
					$objWriter->startElement('xdr:nvPicPr');

						// xdr:cNvPr
						$objWriter->startElement('xdr:cNvPr');
						$objWriter->writeAttribute('id', $pRelationId);
						$objWriter->writeAttribute('name', $pDrawing->getName());
						$objWriter->writeAttribute('descr', $pDrawing->getDescription());
						$objWriter->endElement();

						// xdr:cNvPicPr
						$objWriter->startElement('xdr:cNvPicPr');

							// a:picLocks
							$objWriter->startElement('a:picLocks');
							$objWriter->writeAttribute('noChangeAspect', '1');
							$objWriter->endElement();

						$objWriter->endElement();

					$objWriter->endElement();

					// xdr:blipFill
					$objWriter->startElement('xdr:blipFill');

						// a:blip
						$objWriter->startElement('a:blip');
						$objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
						$objWriter->writeAttribute('r:embed', 'rId' . $pRelationId);
						$objWriter->endElement();

						// a:stretch
						$objWriter->startElement('a:stretch');
							$objWriter->writeElement('a:fillRect', null);
						$objWriter->endElement();

					$objWriter->endElement();

					// xdr:spPr
					$objWriter->startElement('xdr:spPr');

						// a:xfrm
						$objWriter->startElement('a:xfrm');
						$objWriter->writeAttribute('rot', PHPExcel_Shared_Drawing::degreesToAngle($pDrawing->getRotation()));
						$objWriter->endElement();

						// a:prstGeom
						$objWriter->startElement('a:prstGeom');
						$objWriter->writeAttribute('prst', 'rect');

							// a:avLst
							$objWriter->writeElement('a:avLst', null);

						$objWriter->endElement();

//						// a:solidFill
//						$objWriter->startElement('a:solidFill');

//							// a:srgbClr
//							$objWriter->startElement('a:srgbClr');
//							$objWriter->writeAttribute('val', 'FFFFFF');

///* SHADE
//								// a:shade
//								$objWriter->startElement('a:shade');
//								$objWriter->writeAttribute('val', '85000');
//								$objWriter->endElement();
//*/

//							$objWriter->endElement();

//						$objWriter->endElement();
/*
						// a:ln
						$objWriter->startElement('a:ln');
						$objWriter->writeAttribute('w', '88900');
						$objWriter->writeAttribute('cap', 'sq');

							// a:solidFill
							$objWriter->startElement('a:solidFill');

								// a:srgbClr
								$objWriter->startElement('a:srgbClr');
								$objWriter->writeAttribute('val', 'FFFFFF');
								$objWriter->endElement();

							$objWriter->endElement();

							// a:miter
							$objWriter->startElement('a:miter');
							$objWriter->writeAttribute('lim', '800000');
							$objWriter->endElement();

						$objWriter->endElement();
*/

						if ($pDrawing->getShadow()->getVisible()) {
							// a:effectLst
							$objWriter->startElement('a:effectLst');

								// a:outerShdw
								$objWriter->startElement('a:outerShdw');
								$objWriter->writeAttribute('blurRad', 		PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getBlurRadius()));
								$objWriter->writeAttribute('dist',			PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getDistance()));
								$objWriter->writeAttribute('dir',			PHPExcel_Shared_Drawing::degreesToAngle($pDrawing->getShadow()->getDirection()));
								$objWriter->writeAttribute('algn',			$pDrawing->getShadow()->getAlignment());
								$objWriter->writeAttribute('rotWithShape', 	'0');

									// a:srgbClr
									$objWriter->startElement('a:srgbClr');
									$objWriter->writeAttribute('val',		$pDrawing->getShadow()->getColor()->getRGB());

										// a:alpha
										$objWriter->startElement('a:alpha');
										$objWriter->writeAttribute('val', 	$pDrawing->getShadow()->getAlpha() * 1000);
										$objWriter->endElement();

									$objWriter->endElement();

								$objWriter->endElement();

							$objWriter->endElement();
						}
/*

						// a:scene3d
						$objWriter->startElement('a:scene3d');

							// a:camera
							$objWriter->startElement('a:camera');
							$objWriter->writeAttribute('prst', 'orthographicFront');
							$objWriter->endElement();

							// a:lightRig
							$objWriter->startElement('a:lightRig');
							$objWriter->writeAttribute('rig', 'twoPt');
							$objWriter->writeAttribute('dir', 't');

								// a:rot
								$objWriter->startElement('a:rot');
								$objWriter->writeAttribute('lat', '0');
								$objWriter->writeAttribute('lon', '0');
								$objWriter->writeAttribute('rev', '0');
								$objWriter->endElement();

							$objWriter->endElement();

						$objWriter->endElement();
*/
/*
						// a:sp3d
						$objWriter->startElement('a:sp3d');

							// a:bevelT
							$objWriter->startElement('a:bevelT');
							$objWriter->writeAttribute('w', '25400');
							$objWriter->writeAttribute('h', '19050');
							$objWriter->endElement();

							// a:contourClr
							$objWriter->startElement('a:contourClr');

								// a:srgbClr
								$objWriter->startElement('a:srgbClr');
								$objWriter->writeAttribute('val', 'FFFFFF');
								$objWriter->endElement();

							$objWriter->endElement();

						$objWriter->endElement();
*/
					$objWriter->endElement();

				$objWriter->endElement();

				// xdr:clientData
				$objWriter->writeElement('xdr:clientData', null);

			$objWriter->endElement();
		} else {
			throw new PHPExcel_Writer_Exception("Invalid parameters passed.");
		}
	}
1373751
private function _writePrintOptions(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
	{
		// printOptions
		$objWriter->startElement('printOptions');

		$objWriter->writeAttribute('gridLines',	($pSheet->getPrintGridlines() ? 'true': 'false'));
		$objWriter->writeAttribute('gridLinesSet',	'true');

		if ($pSheet->getPageSetup()->getHorizontalCentered()) {
			$objWriter->writeAttribute('horizontalCentered', 'true');
		}

		if ($pSheet->getPageSetup()->getVerticalCentered()) {
			$objWriter->writeAttribute('verticalCentered', 'true');
		}

		$objWriter->endElement();
	}
340795
private function _writeLegend(PHPExcel_Chart_Legend $legend = null, $objWriter)
	{
		if (is_null($legend)) {
			return;
		}

		$objWriter->startElement('c:legend');

			$objWriter->startElement('c:legendPos');
				$objWriter->writeAttribute('val', $legend->getPosition());
			$objWriter->endElement();

			$layout = $legend->getLayout();
			$this->_writeLayout($layout, $objWriter);

			$objWriter->startElement('c:overlay');
				$objWriter->writeAttribute('val', ($legend->getOverlay()) ? '1' : '0');
			$objWriter->endElement();

			$objWriter->startElement('c:txPr');
				$objWriter->startElement('a:bodyPr');
				$objWriter->endElement();

				$objWriter->startElement('a:lstStyle');
				$objWriter->endElement();

				$objWriter->startElement('a:p');
					$objWriter->startElement('a:pPr');
						$objWriter->writeAttribute('rtl', 0);

						$objWriter->startElement('a:defRPr');
						$objWriter->endElement();
					$objWriter->endElement();

					$objWriter->startElement('a:endParaRPr');
						$objWriter->writeAttribute('lang', "en-US");
					$objWriter->endElement();

				$objWriter->endElement();
			$objWriter->endElement();

		$objWriter->endElement();
	}
1363456
protected function writeExtensions(\XMLWriter $xmlWriter, array $extensions)
    {
        $xmlWriter->startElement('extensions');
        foreach ($extensions as $extension) {
            switch ($extension::ID()) {
                case HR::ID():
                    $xmlWriter->startElementNs('gpxtpx', 'TrackPointExtension', null);
                    $xmlWriter->writeElementNs('gpxtpx', 'hr', null, (string)$extension->value());
                    $xmlWriter->endElement();
                    break;
            }
        }
        $xmlWriter->endElement();
    }
747378
private function writePatternFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null)
    {
        // fill
        $objWriter->startElement('fill');

        // patternFill
        $objWriter->startElement('patternFill');
        $objWriter->writeAttribute('patternType', $pFill->getFillType());

        if ($pFill->getFillType() !== PHPExcel_Style_Fill::FILL_NONE) {
            // fgColor
            if ($pFill->getStartColor()->getARGB()) {
                $objWriter->startElement('fgColor');
                $objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB());
                $objWriter->endElement();
            }
        }
        if ($pFill->getFillType() !== PHPExcel_Style_Fill::FILL_NONE) {
            // bgColor
            if ($pFill->getEndColor()->getARGB()) {
                $objWriter->startElement('bgColor');
                $objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB());
                $objWriter->endElement();
            }
        }

        $objWriter->endElement();

        $objWriter->endElement();
    }
230770
private function _writeDefaultContentType(PHPWord_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 Exception("Invalid parameters passed.");
		}
	}
7136
public function writeDocPropsCustom(PHPExcel $pPHPExcel = null)
	{
		$customPropertyList = $pPHPExcel->getProperties()->getCustomProperties();
		if (empty($customPropertyList)) {
			return;
		}

		// 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('Properties');
			$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/custom-properties');
			$objWriter->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');


			foreach($customPropertyList as $key => $customProperty) {
				$propertyValue = $pPHPExcel->getProperties()->getCustomPropertyValue($customProperty);
				$propertyType = $pPHPExcel->getProperties()->getCustomPropertyType($customProperty);

				$objWriter->startElement('property');
					$objWriter->writeAttribute('fmtid', 	'{D5CDD505-2E9C-101B-9397-08002B2CF9AE}');
					$objWriter->writeAttribute('pid', 		$key+2);
					$objWriter->writeAttribute('name', 		$customProperty);

					switch($propertyType) {
						case 'i' :
							$objWriter->writeElement('vt:i4', 		$propertyValue);
							break;
						case 'f' :
							$objWriter->writeElement('vt:r8', 		$propertyValue);
							break;
						case 'b' :
							$objWriter->writeElement('vt:bool', 	($propertyValue) ? 'true' : 'false');
							break;
						case 'd' :
							$objWriter->startElement('vt:filetime');
								$objWriter->writeRawData(date(DATE_W3C, $propertyValue));
							$objWriter->endElement();
							break;
						default :
							$objWriter->writeElement('vt:lpwstr', 	$propertyValue);
							break;
					}

				$objWriter->endElement();
			}


		$objWriter->endElement();

		// Return
		return $objWriter->getData();
	}
936273
public function writeWorkbookRelationships(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');

			// Relationship styles.xml
			$this->_writeRelationship(
				$objWriter,
				1,
				'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles',
				'styles.xml'
			);

			// Relationship theme/theme1.xml
			$this->_writeRelationship(
				$objWriter,
				2,
				'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme',
				'theme/theme1.xml'
			);

			// Relationship sharedStrings.xml
			$this->_writeRelationship(
				$objWriter,
				3,
				'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings',
				'sharedStrings.xml'
			);

			// Relationships with sheets
			$sheetCount = $pPHPExcel->getSheetCount();
			for ($i = 0; $i < $sheetCount; ++$i) {
				$this->_writeRelationship(
					$objWriter,
					($i + 1 + 3),
					'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet',
					'worksheets/sheet' . ($i + 1) . '.xml'
				);
			}

		$objWriter->endElement();

		// Return
		return $objWriter->getData();
	}
1118746
private function _writeCols(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
	{
		// cols
		if (count($pSheet->getColumnDimensions()) > 0)  {
			$objWriter->startElement('cols');

				$pSheet->calculateColumnWidths();

				// Loop through column dimensions
				foreach ($pSheet->getColumnDimensions() as $colDimension) {
					// col
					$objWriter->startElement('col');
					$objWriter->writeAttribute('min',	PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex()));
					$objWriter->writeAttribute('max',	PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex()));

					if ($colDimension->getWidth() < 0) {
						// No width set, apply default of 10
						$objWriter->writeAttribute('width',		'9.10');
					} else {
						// Width set
						$objWriter->writeAttribute('width',		PHPExcel_Shared_String::FormatNumber($colDimension->getWidth()));
					}

					// Column visibility
					if ($colDimension->getVisible() == false) {
						$objWriter->writeAttribute('hidden',		'true');
					}

					// Auto size?
					if ($colDimension->getAutoSize()) {
						$objWriter->writeAttribute('bestFit',		'true');
					}

					// Custom width?
					if ($colDimension->getWidth() != $pSheet->getDefaultColumnDimension()->getWidth()) {
						$objWriter->writeAttribute('customWidth',	'true');
					}

					// Collapsed
					if ($colDimension->getCollapsed() == true) {
						$objWriter->writeAttribute('collapsed',		'true');
					}

					// Outline level
					if ($colDimension->getOutlineLevel() > 0) {
						$objWriter->writeAttribute('outlineLevel',	$colDimension->getOutlineLevel());
					}

					// Style
					$objWriter->writeAttribute('style', $colDimension->getXfIndex());

					$objWriter->endElement();
				}

			$objWriter->endElement();
		}
	}
976467
private function writeNamedRanges(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel)
    {
        // Loop named ranges
        $namedRanges = $pPHPExcel->getNamedRanges();
        foreach ($namedRanges as $namedRange) {
            $this->writeDefinedNameForNamedRange($objWriter, $namedRange);
        }
    }
1198887
private function _writeLegacyDrawing(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
	{
		// If sheet contains comments, add the relationships
		if (count($pSheet->getComments()) > 0) {
			$objWriter->startElement('legacyDrawing');
			$objWriter->writeAttribute('r:id', 'rId_comments_vml1');
			$objWriter->endElement();
		}
	}
1287147
public function writeInnerXml(\XMLWriter $xmlWriter)
    {
        Validate::notNull($xmlWriter, 'xmlWriter');

        $this->writeOptionalAttribute($xmlWriter, 'href', $this->href);
        $this->writeOptionalAttribute($xmlWriter, 'rel', $this->rel);
        $this->writeOptionalAttribute($xmlWriter, 'type', $this->type);
        $this->writeOptionalAttribute($xmlWriter, 'hreflang', $this->hreflang);
        $this->writeOptionalAttribute($xmlWriter, 'title', $this->title);
        $this->writeOptionalAttribute($xmlWriter, 'length', $this->length);

        if (!empty($this->undefinedContent)) {
            $xmlWriter->writeRaw($this->undefinedContent);
        }
    }
685855
public function writeRichText(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_RichText $pRichText = null, $prefix=NULL)
	{
		if ($prefix !== NULL)
			$prefix .= ':';
		// Loop through rich text elements
		$elements = $pRichText->getRichTextElements();
		foreach ($elements as $element) {
			// r
			$objWriter->startElement($prefix.'r');

				// rPr
				if ($element instanceof PHPExcel_RichText_Run) {
					// rPr
					$objWriter->startElement($prefix.'rPr');

						// rFont
						$objWriter->startElement($prefix.'rFont');
						$objWriter->writeAttribute('val', $element->getFont()->getName());
						$objWriter->endElement();

						// Bold
						$objWriter->startElement($prefix.'b');
						$objWriter->writeAttribute('val', ($element->getFont()->getBold() ? 'true' : 'false'));
						$objWriter->endElement();

						// Italic
						$objWriter->startElement($prefix.'i');
						$objWriter->writeAttribute('val', ($element->getFont()->getItalic() ? 'true' : 'false'));
						$objWriter->endElement();

						// Superscript / subscript
						if ($element->getFont()->getSuperScript() || $element->getFont()->getSubScript()) {
							$objWriter->startElement($prefix.'vertAlign');
							if ($element->getFont()->getSuperScript()) {
								$objWriter->writeAttribute('val', 'superscript');
							} else if ($element->getFont()->getSubScript()) {
								$objWriter->writeAttribute('val', 'subscript');
							}
							$objWriter->endElement();
						}

						// Strikethrough
						$objWriter->startElement($prefix.'strike');
						$objWriter->writeAttribute('val', ($element->getFont()->getStrikethrough() ? 'true' : 'false'));
						$objWriter->endElement();

						// Color
						$objWriter->startElement($prefix.'color');
						$objWriter->writeAttribute('rgb', $element->getFont()->getColor()->getARGB());
						$objWriter->endElement();

						// Size
						$objWriter->startElement($prefix.'sz');
						$objWriter->writeAttribute('val', $element->getFont()->getSize());
						$objWriter->endElement();

						// Underline
						$objWriter->startElement($prefix.'u');
						$objWriter->writeAttribute('val', $element->getFont()->getUnderline());
						$objWriter->endElement();

					$objWriter->endElement();
				}

				// t
				$objWriter->startElement($prefix.'t');
				$objWriter->writeAttribute('xml:space', 'preserve');
				$objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $element->getText() ));
				$objWriter->endElement();

			$objWriter->endElement();
		}
	}
1122538
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
                    $this->writeColourScheme($objWriter);

                $objWriter->endElement();

                // a:fontScheme
                $objWriter->startElement('a:fontScheme');
                $objWriter->writeAttribute('name', 'Office');

                    // a:majorFont
                    $objWriter->startElement('a:majorFont');
                        $this->writeFonts($objWriter, 'Cambria', self::$majorFonts);
                    $objWriter->endElement();

                    // a:minorFont
                    $objWriter->startElement('a:minorFont');
                        $this->writeFonts($objWriter, 'Calibri', self::$minorFonts);
                    $objWriter->endElement();

                $objWriter->endElement();

                // a:fmtScheme
                $objWriter->startElement('a:fmtScheme');
                $objWriter->writeAttribute('name', 'Office');

                    // a:fillStyleLst
                    $objWriter->startElement('a:fillStyleLst');

                        // a:solidFill
                        $objWriter->startElement('a:solidFill');

                            // a:schemeClr
                            $objWriter->startElement('a:schemeClr');
                            $objWriter->writeAttribute('val', 'phClr');
                            $objWriter->endElement();

                        $objWriter->endElement();

                        // a:gradFill
                        $objWriter->startElement('a:gradFill');
                        $objWriter->writeAttribute('rotWithShape', '1');

                            // a:gsLst
                            $objWriter->startElement('a:gsLst');

                                // a:gs
                                $objWriter->startElement('a:gs');
                                $objWriter->writeAttribute('pos', '0');

                                    // a:schemeClr
                                    $objWriter->startElement('a:schemeClr');
                                    $objWriter->writeAttribute('val', 'phClr');

                                        // a:tint
                                        $objWriter->startElement('a:tint');
                                        $objWriter->writeAttribute('val', '50000');
                                        $objWriter->endElement();

                                        // a:satMod
                                        $objWriter->startElement('a:satMod');
                                        $objWriter->writeAttribute('val', '300000');
                                        $objWriter->endElement();

                                    $objWriter->endElement();

                                $objWriter->endElement();

                                // a:gs
                                $objWriter->startElement('a:gs');
                                $objWriter->writeAttribute('pos', '35000');

                                    // a:schemeClr
                                    $objWriter->startElement('a:schemeClr');
                                    $objWriter->writeAttribute('val', 'phClr');

                                        // a:tint
                                        $objWriter->startElement('a:tint');
                                        $objWriter->writeAttribute('val', '37000');
                                        $objWriter->endElement();

                                        // a:satMod
                                        $objWriter->startElement('a:satMod');
                                        $objWriter->writeAttribute('val', '300000');
                                        $objWriter->endElement();

                                    $objWriter->endElement();

                                $objWriter->endElement();

                                // a:gs
                                $objWriter->startElement('a:gs');
                                $objWriter->writeAttribute('pos', '100000');

                                    // a:schemeClr
                                    $objWriter->startElement('a:schemeClr');
                                    $objWriter->writeAttribute('val', 'phClr');

                                        // a:tint
                                        $objWriter->startElement('a:tint');
                                        $objWriter->writeAttribute('val', '15000');
                                        $objWriter->endElement();

                                        // a:satMod
                                        $objWriter->startElement('a:satMod');
                                        $objWriter->writeAttribute('val', '350000');
                                        $objWriter->endElement();

                                    $objWriter->endElement();

                                $objWriter->endElement();

                            $objWriter->endElement();

                            // a:lin
                            $objWriter->startElement('a:lin');
                            $objWriter->writeAttribute('ang', '16200000');
                            $objWriter->writeAttribute('scaled', '1');
                            $objWriter->endElement();

                        $objWriter->endElement();

                        // a:gradFill
                        $objWriter->startElement('a:gradFill');
                        $objWriter->writeAttribute('rotWithShape', '1');

                            // a:gsLst
                            $objWriter->startElement('a:gsLst');

                                // a:gs
                                $objWriter->startElement('a:gs');
                                $objWriter->writeAttribute('pos', '0');

                                    // a:schemeClr
                                    $objWriter->startElement('a:schemeClr');
                                    $objWriter->writeAttribute('val', 'phClr');

                                        // a:shade
                                        $objWriter->startElement('a:shade');
                                        $objWriter->writeAttribute('val', '51000');
                                        $objWriter->endElement();

                                        // a:satMod
                                        $objWriter->startElement('a:satMod');
                                        $objWriter->writeAttribute('val', '130000');
                                        $objWriter->endElement();

                                    $objWriter->endElement();

                                $objWriter->endElement();

                                // a:gs
                                $objWriter->startElement('a:gs');
                                $objWriter->writeAttribute('pos', '80000');

                                    // a:schemeClr
                                    $objWriter->startElement('a:schemeClr');
                                    $objWriter->writeAttribute('val', 'phClr');

                                        // a:shade
                                        $objWriter->startElement('a:shade');
                                        $objWriter->writeAttribute('val', '93000');
                                        $objWriter->endElement();

                                        // a:satMod
                                        $objWriter->startElement('a:satMod');
                                        $objWriter->writeAttribute('val', '130000');
                                        $objWriter->endElement();

                                    $objWriter->endElement();

                                $objWriter->endElement();

                                // a:gs
                                $objWriter->startElement('a:gs');
                                $objWriter->writeAttribute('pos', '100000');

                                    // a:schemeClr
                                    $objWriter->startElement('a:schemeClr');
                                    $objWriter->writeAttribute('val', 'phClr');

                                        // a:shade
                                        $objWriter->startElement('a:shade');
                                        $objWriter->writeAttribute('val', '94000');
                                        $objWriter->endElement();

                                        // a:satMod
                                        $objWriter->startElement('a:satMod');
                                        $objWriter->writeAttribute('val', '135000');
                                        $objWriter->endElement();

                                    $objWriter->endElement();

                                $objWriter->endElement();

                            $objWriter->endElement();

                            // a:lin
                            $objWriter->startElement('a:lin');
                            $objWriter->writeAttribute('ang', '16200000');
                            $objWriter->writeAttribute('scaled', '0');
                            $objWriter->endElement();

                        $objWriter->endElement();

                    $objWriter->endElement();

                    // a:lnStyleLst
                    $objWriter->startElement('a:lnStyleLst');

                        // a:ln
                        $objWriter->startElement('a:ln');
                        $objWriter->writeAttribute('w', '9525');
                        $objWriter->writeAttribute('cap', 'flat');
                        $objWriter->writeAttribute('cmpd', 'sng');
                        $objWriter->writeAttribute('algn', 'ctr');

                            // a:solidFill
                            $objWriter->startElement('a:solidFill');

                                // a:schemeClr
                                $objWriter->startElement('a:schemeClr');
                                $objWriter->writeAttribute('val', 'phClr');

                                        // a:shade
                                        $objWriter->startElement('a:shade');
                                        $objWriter->writeAttribute('val', '95000');
                                        $objWriter->endElement();

                                        // a:satMod
                                        $objWriter->startElement('a:satMod');
                                        $objWriter->writeAttribute('val', '105000');
                                        $objWriter->endElement();

                                $objWriter->endElement();

                            $objWriter->endElement();

                            // a:prstDash
                            $objWriter->startElement('a:prstDash');
                            $objWriter->writeAttribute('val', 'solid');
                            $objWriter->endElement();

                        $objWriter->endElement();

                        // a:ln
                        $objWriter->startElement('a:ln');
                        $objWriter->writeAttribute('w', '25400');
                        $objWriter->writeAttribute('cap', 'flat');
                        $objWriter->writeAttribute('cmpd', 'sng');
                        $objWriter->writeAttribute('algn', 'ctr');

                            // a:solidFill
                            $objWriter->startElement('a:solidFill');

                                // a:schemeClr
                                $objWriter->startElement('a:schemeClr');
                                $objWriter->writeAttribute('val', 'phClr');
                                $objWriter->endElement();

                            $objWriter->endElement();

                            // a:prstDash
                            $objWriter->startElement('a:prstDash');
                            $objWriter->writeAttribute('val', 'solid');
                            $objWriter->endElement();

                        $objWriter->endElement();

                        // a:ln
                        $objWriter->startElement('a:ln');
                        $objWriter->writeAttribute('w', '38100');
                        $objWriter->writeAttribute('cap', 'flat');
                        $objWriter->writeAttribute('cmpd', 'sng');
                        $objWriter->writeAttribute('algn', 'ctr');

                            // a:solidFill
                            $objWriter->startElement('a:solidFill');

                                // a:schemeClr
                                $objWriter->startElement('a:schemeClr');
                                $objWriter->writeAttribute('val', 'phClr');
                                $objWriter->endElement();

                            $objWriter->endElement();

                            // a:prstDash
                            $objWriter->startElement('a:prstDash');
                            $objWriter->writeAttribute('val', 'solid');
                            $objWriter->endElement();

                        $objWriter->endElement();

                    $objWriter->endElement();



                    // a:effectStyleLst
                    $objWriter->startElement('a:effectStyleLst');

                        // a:effectStyle
                        $objWriter->startElement('a:effectStyle');

                            // a:effectLst
                            $objWriter->startElement('a:effectLst');

                                // a:outerShdw
                                $objWriter->startElement('a:outerShdw');
                                $objWriter->writeAttribute('blurRad', '40000');
                                $objWriter->writeAttribute('dist', '20000');
                                $objWriter->writeAttribute('dir', '5400000');
                                $objWriter->writeAttribute('rotWithShape', '0');

                                    // a:srgbClr
                                    $objWriter->startElement('a:srgbClr');
                                    $objWriter->writeAttribute('val', '000000');

                                        // a:alpha
                                        $objWriter->startElement('a:alpha');
                                        $objWriter->writeAttribute('val', '38000');
                                        $objWriter->endElement();

                                    $objWriter->endElement();

                                $objWriter->endElement();

                            $objWriter->endElement();

                        $objWriter->endElement();

                        // a:effectStyle
                        $objWriter->startElement('a:effectStyle');

                            // a:effectLst
                            $objWriter->startElement('a:effectLst');

                                // a:outerShdw
                                $objWriter->startElement('a:outerShdw');
                                $objWriter->writeAttribute('blurRad', '40000');
                                $objWriter->writeAttribute('dist', '23000');
                                $objWriter->writeAttribute('dir', '5400000');
                                $objWriter->writeAttribute('rotWithShape', '0');

                                    // a:srgbClr
                                    $objWriter->startElement('a:srgbClr');
                                    $objWriter->writeAttribute('val', '000000');

                                        // a:alpha
                                        $objWriter->startElement('a:alpha');
                                        $objWriter->writeAttribute('val', '35000');
                                        $objWriter->endElement();

                                    $objWriter->endElement();

                                $objWriter->endElement();

                            $objWriter->endElement();

                        $objWriter->endElement();

                        // a:effectStyle
                        $objWriter->startElement('a:effectStyle');

                            // a:effectLst
                            $objWriter->startElement('a:effectLst');

                                // a:outerShdw
                                $objWriter->startElement('a:outerShdw');
                                $objWriter->writeAttribute('blurRad', '40000');
                                $objWriter->writeAttribute('dist', '23000');
                                $objWriter->writeAttribute('dir', '5400000');
                                $objWriter->writeAttribute('rotWithShape', '0');

                                    // a:srgbClr
                                    $objWriter->startElement('a:srgbClr');
                                    $objWriter->writeAttribute('val', '000000');

                                        // a:alpha
                                        $objWriter->startElement('a:alpha');
                                        $objWriter->writeAttribute('val', '35000');
                                        $objWriter->endElement();

                                    $objWriter->endElement();

                                $objWriter->endElement();

                            $objWriter->endElement();

                            // a:scene3d
                            $objWriter->startElement('a:scene3d');

                                // a:camera
                                $objWriter->startElement('a:camera');
                                $objWriter->writeAttribute('prst', 'orthographicFront');

                                    // a:rot
                                    $objWriter->startElement('a:rot');
                                    $objWriter->writeAttribute('lat', '0');
                                    $objWriter->writeAttribute('lon', '0');
                                    $objWriter->writeAttribute('rev', '0');
                                    $objWriter->endElement();

                                $objWriter->endElement();

                                // a:lightRig
                                $objWriter->startElement('a:lightRig');
                                $objWriter->writeAttribute('rig', 'threePt');
                                $objWriter->writeAttribute('dir', 't');

                                    // a:rot
                                    $objWriter->startElement('a:rot');
                                    $objWriter->writeAttribute('lat', '0');
                                    $objWriter->writeAttribute('lon', '0');
                                    $objWriter->writeAttribute('rev', '1200000');
                                    $objWriter->endElement();

                                $objWriter->endElement();

                            $objWriter->endElement();

                            // a:sp3d
                            $objWriter->startElement('a:sp3d');

                                // a:bevelT
                                $objWriter->startElement('a:bevelT');
                                $objWriter->writeAttribute('w', '63500');
                                $objWriter->writeAttribute('h', '25400');
                                $objWriter->endElement();

                            $objWriter->endElement();

                        $objWriter->endElement();

                    $objWriter->endElement();

                    // a:bgFillStyleLst
                    $objWriter->startElement('a:bgFillStyleLst');

                        // a:solidFill
                        $objWriter->startElement('a:solidFill');

                            // a:schemeClr
                            $objWriter->startElement('a:schemeClr');
                            $objWriter->writeAttribute('val', 'phClr');
                            $objWriter->endElement();

                        $objWriter->endElement();

                        // a:gradFill
                        $objWriter->startElement('a:gradFill');
                        $objWriter->writeAttribute('rotWithShape', '1');

                            // a:gsLst
                            $objWriter->startElement('a:gsLst');

                                // a:gs
                                $objWriter->startElement('a:gs');
                                $objWriter->writeAttribute('pos', '0');

                                    // a:schemeClr
                                    $objWriter->startElement('a:schemeClr');
                                    $objWriter->writeAttribute('val', 'phClr');

                                        // a:tint
                                        $objWriter->startElement('a:tint');
                                        $objWriter->writeAttribute('val', '40000');
                                        $objWriter->endElement();

                                        // a:satMod
                                        $objWriter->startElement('a:satMod');
                                        $objWriter->writeAttribute('val', '350000');
                                        $objWriter->endElement();

                                    $objWriter->endElement();

                                $objWriter->endElement();

                                // a:gs
                                $objWriter->startElement('a:gs');
                                $objWriter->writeAttribute('pos', '40000');

                                    // a:schemeClr
                                    $objWriter->startElement('a:schemeClr');
                                    $objWriter->writeAttribute('val', 'phClr');

                                        // a:tint
                                        $objWriter->startElement('a:tint');
                                        $objWriter->writeAttribute('val', '45000');
                                        $objWriter->endElement();

                                        // a:shade
                                        $objWriter->startElement('a:shade');
                                        $objWriter->writeAttribute('val', '99000');
                                        $objWriter->endElement();

                                        // a:satMod
                                        $objWriter->startElement('a:satMod');
                                        $objWriter->writeAttribute('val', '350000');
                                        $objWriter->endElement();

                                    $objWriter->endElement();

                                $objWriter->endElement();

                                // a:gs
                                $objWriter->startElement('a:gs');
                                $objWriter->writeAttribute('pos', '100000');

                                    // a:schemeClr
                                    $objWriter->startElement('a:schemeClr');
                                    $objWriter->writeAttribute('val', 'phClr');

                                        // a:shade
                                        $objWriter->startElement('a:shade');
                                        $objWriter->writeAttribute('val', '20000');
                                        $objWriter->endElement();

                                        // a:satMod
                                        $objWriter->startElement('a:satMod');
                                        $objWriter->writeAttribute('val', '255000');
                                        $objWriter->endElement();

                                    $objWriter->endElement();

                                $objWriter->endElement();

                            $objWriter->endElement();

                            // a:path
                            $objWriter->startElement('a:path');
                            $objWriter->writeAttribute('path', 'circle');

                                // a:fillToRect
                                $objWriter->startElement('a:fillToRect');
                                $objWriter->writeAttribute('l', '50000');
                                $objWriter->writeAttribute('t', '-80000');
                                $objWriter->writeAttribute('r', '50000');
                                $objWriter->writeAttribute('b', '180000');
                                $objWriter->endElement();

                            $objWriter->endElement();

                        $objWriter->endElement();

                        // a:gradFill
                        $objWriter->startElement('a:gradFill');
                        $objWriter->writeAttribute('rotWithShape', '1');

                            // a:gsLst
                            $objWriter->startElement('a:gsLst');

                                // a:gs
                                $objWriter->startElement('a:gs');
                                $objWriter->writeAttribute('pos', '0');

                                    // a:schemeClr
                                    $objWriter->startElement('a:schemeClr');
                                    $objWriter->writeAttribute('val', 'phClr');

                                        // a:tint
                                        $objWriter->startElement('a:tint');
                                        $objWriter->writeAttribute('val', '80000');
                                        $objWriter->endElement();

                                        // a:satMod
                                        $objWriter->startElement('a:satMod');
                                        $objWriter->writeAttribute('val', '300000');
                                        $objWriter->endElement();

                                    $objWriter->endElement();

                                $objWriter->endElement();

                                // a:gs
                                $objWriter->startElement('a:gs');
                                $objWriter->writeAttribute('pos', '100000');

                                    // a:schemeClr
                                    $objWriter->startElement('a:schemeClr');
                                    $objWriter->writeAttribute('val', 'phClr');

                                        // a:shade
                                        $objWriter->startElement('a:shade');
                                        $objWriter->writeAttribute('val', '30000');
                                        $objWriter->endElement();

                                        // a:satMod
                                        $objWriter->startElement('a:satMod');
                                        $objWriter->writeAttribute('val', '200000');
                                        $objWriter->endElement();

                                    $objWriter->endElement();

                                $objWriter->endElement();

                            $objWriter->endElement();

                            // a:path
                            $objWriter->startElement('a:path');
                            $objWriter->writeAttribute('path', 'circle');

                                // a:fillToRect
                                $objWriter->startElement('a:fillToRect');
                                $objWriter->writeAttribute('l', '50000');
                                $objWriter->writeAttribute('t', '50000');
                                $objWriter->writeAttribute('r', '50000');
                                $objWriter->writeAttribute('b', '50000');
                                $objWriter->endElement();

                            $objWriter->endElement();

                        $objWriter->endElement();

                    $objWriter->endElement();

                $objWriter->endElement();

            $objWriter->endElement();

            // a:objectDefaults
            $objWriter->writeElement('a:objectDefaults', null);

            // a:extraClrSchemeLst
            $objWriter->writeElement('a:extraClrSchemeLst', null);

        $objWriter->endElement();

        // Return
        return $objWriter->getData();
    }