|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * This file is part of PHPPowerPoint - A pure PHP library for reading and writing |
| 4 | + * presentations documents. |
| 5 | + * |
| 6 | + * PHPPowerPoint is free software distributed under the terms of the GNU Lesser |
| 7 | + * General Public License version 3 as published by the Free Software Foundation. |
| 8 | + * |
| 9 | + * For the full copyright and license information, please read the LICENSE |
| 10 | + * file that was distributed with this source code. For the full list of |
| 11 | + * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. |
| 12 | + * |
| 13 | + * @link https://github.com/PHPOffice/PHPPowerPoint |
| 14 | + * @copyright 2009-2014 PHPPowerPoint contributors |
| 15 | + * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 |
| 16 | + */ |
| 17 | + |
| 18 | +namespace PhpOffice\PhpPowerpoint\Writer\PowerPoint2007; |
| 19 | + |
| 20 | +use PhpOffice\PhpPowerpoint\PhpPowerpoint; |
| 21 | + |
| 22 | +class PptProps extends AbstractPart |
| 23 | +{ |
| 24 | +/** |
| 25 | + * Write ppt/presProps.xml to XML format |
| 26 | + * |
| 27 | + * @param PhpPowerpoint $pPHPPowerPoint |
| 28 | + * @return string XML Output |
| 29 | + * @throws \Exception |
| 30 | + */ |
| 31 | + public function writePresProps(PhpPowerpoint $pPHPPowerPoint = null) |
| 32 | + { |
| 33 | + // Create XML writer |
| 34 | + $objWriter = $this->getXMLWriter(); |
| 35 | + |
| 36 | + // XML header |
| 37 | + $objWriter->startDocument('1.0','UTF-8','yes'); |
| 38 | + |
| 39 | + // p:presentationPr |
| 40 | + $objWriter->startElement('p:presentationPr'); |
| 41 | + $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main'); |
| 42 | + $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); |
| 43 | + $objWriter->writeAttribute('xmlns:p', 'http://schemas.openxmlformats.org/presentationml/2006/main'); |
| 44 | + |
| 45 | + // p:extLst |
| 46 | + $objWriter->startElement('p:extLst'); |
| 47 | + |
| 48 | + // p:ext |
| 49 | + $objWriter->startElement('p:ext'); |
| 50 | + $objWriter->writeAttribute('uri', '{E76CE94A-603C-4142-B9EB-6D1370010A27}'); |
| 51 | + |
| 52 | + // p14:discardImageEditData |
| 53 | + $objWriter->startElement('p14:discardImageEditData'); |
| 54 | + $objWriter->writeAttribute('xmlns:p14', 'http://schemas.microsoft.com/office/powerpoint/2010/main'); |
| 55 | + $objWriter->writeAttribute('val', '0'); |
| 56 | + $objWriter->endElement(); |
| 57 | + |
| 58 | + // > p:ext |
| 59 | + $objWriter->endElement(); |
| 60 | + |
| 61 | + // p:ext |
| 62 | + $objWriter->startElement('p:ext'); |
| 63 | + $objWriter->writeAttribute('uri', '{D31A062A-798A-4329-ABDD-BBA856620510}'); |
| 64 | + |
| 65 | + // p14:defaultImageDpi |
| 66 | + $objWriter->startElement('p14:defaultImageDpi'); |
| 67 | + $objWriter->writeAttribute('xmlns:p14', 'http://schemas.microsoft.com/office/powerpoint/2010/main'); |
| 68 | + $objWriter->writeAttribute('val', '220'); |
| 69 | + $objWriter->endElement(); |
| 70 | + |
| 71 | + // > p:ext |
| 72 | + $objWriter->endElement(); |
| 73 | + // > p:extLst |
| 74 | + $objWriter->endElement(); |
| 75 | + // > p:presentationPr |
| 76 | + $objWriter->endElement(); |
| 77 | + |
| 78 | + return $objWriter->getData(); |
| 79 | + } |
| 80 | + |
| 81 | + /** |
| 82 | + * Write ppt/tableStyles.xml to XML format |
| 83 | + * |
| 84 | + * @param PhpPowerpoint $pPHPPowerPoint |
| 85 | + * @return string XML Output |
| 86 | + * @throws \Exception |
| 87 | + */ |
| 88 | + public function writeTableStyles(PhpPowerpoint $pPHPPowerPoint = null) |
| 89 | + { |
| 90 | + // Create XML writer |
| 91 | + $objWriter = $this->getXMLWriter(); |
| 92 | + // XML header |
| 93 | + $objWriter->startDocument('1.0','UTF-8','yes'); |
| 94 | + |
| 95 | + // a:tblStyleLst |
| 96 | + $objWriter->startElement('a:tblStyleLst'); |
| 97 | + $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main'); |
| 98 | + $objWriter->writeAttribute('def', '{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}'); |
| 99 | + $objWriter->endElement(); |
| 100 | + |
| 101 | + return $objWriter->getData(); |
| 102 | + } |
| 103 | +} |
0 commit comments