getParentWriter()->getUseDiskCaching()) { $objWriter = new PHPWord_Shared_XMLWriter(PHPWord_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { $objWriter = new PHPWord_Shared_XMLWriter(PHPWord_Shared_XMLWriter::STORAGE_MEMORY); } // XML header $objWriter->startDocument('1.0', 'UTF-8', 'yes'); $objWriter->startElement('w:hdr'); $objWriter->writeAttribute('xmlns:ve','http://schemas.openxmlformats.org/markup-compatibility/2006'); $objWriter->writeAttribute('xmlns:o','urn:schemas-microsoft-com:office:office'); $objWriter->writeAttribute('xmlns:r','http://schemas.openxmlformats.org/officeDocument/2006/relationships'); $objWriter->writeAttribute('xmlns:m','http://schemas.openxmlformats.org/officeDocument/2006/math'); $objWriter->writeAttribute('xmlns:v','urn:schemas-microsoft-com:vml'); $objWriter->writeAttribute('xmlns:wp','http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing'); $objWriter->writeAttribute('xmlns:w10','urn:schemas-microsoft-com:office:word'); $objWriter->writeAttribute('xmlns:w','http://schemas.openxmlformats.org/wordprocessingml/2006/main'); $objWriter->writeAttribute('xmlns:wne','http://schemas.microsoft.com/office/word/2006/wordml'); $_elements = $header->getElements(); foreach($_elements as $element) { if($element instanceof PHPWord_Section_Text) { $this->_writeText($objWriter, $element); } elseif($element instanceof PHPWord_Section_TextRun) { $this->_writeTextRun($objWriter, $element); } elseif($element instanceof PHPWord_Section_TextBreak) { $this->_writeTextBreak($objWriter); } elseif($element instanceof PHPWord_Section_Table) { $this->_writeTable($objWriter, $element); } elseif($element instanceof PHPWord_Section_Image || $element instanceof PHPWord_Section_MemoryImage) { if(!$element->getIsWatermark()) { $this->_writeImage($objWriter, $element); } else { $this->_writeWatermark($objWriter, $element); } } elseif($element instanceof PHPWord_Section_Footer_PreserveText) { $this->_writePreserveText($objWriter, $element); } } $objWriter->endElement(); // Return return $objWriter->getData(); } } ?>