Skip to content

Commit 29a3321

Browse files
committed
PowerPoint2007 Writer : Keynote incompatibility (CodePlex#237322) (Fix PHPCS + UnitTests)
1 parent 92ffaf4 commit 29a3321

File tree

2 files changed

+70
-4
lines changed

2 files changed

+70
-4
lines changed

src/PhpPowerpoint/Writer/PowerPoint2007/PptProps.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function writePresProps(PhpPowerpoint $pPHPPowerPoint = null)
3434
$objWriter = $this->getXMLWriter();
3535

3636
// XML header
37-
$objWriter->startDocument('1.0','UTF-8','yes');
37+
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
3838

3939
// p:presentationPr
4040
$objWriter->startElement('p:presentationPr');
@@ -52,7 +52,7 @@ public function writePresProps(PhpPowerpoint $pPHPPowerPoint = null)
5252
// p14:discardImageEditData
5353
$objWriter->startElement('p14:discardImageEditData');
5454
$objWriter->writeAttribute('xmlns:p14', 'http://schemas.microsoft.com/office/powerpoint/2010/main');
55-
$objWriter->writeAttribute('val', '0');
55+
$objWriter->writeAttribute('val', '0');
5656
$objWriter->endElement();
5757

5858
// > p:ext
@@ -65,7 +65,7 @@ public function writePresProps(PhpPowerpoint $pPHPPowerPoint = null)
6565
// p14:defaultImageDpi
6666
$objWriter->startElement('p14:defaultImageDpi');
6767
$objWriter->writeAttribute('xmlns:p14', 'http://schemas.microsoft.com/office/powerpoint/2010/main');
68-
$objWriter->writeAttribute('val', '220');
68+
$objWriter->writeAttribute('val', '220');
6969
$objWriter->endElement();
7070

7171
// > p:ext
@@ -90,7 +90,7 @@ public function writeTableStyles(PhpPowerpoint $pPHPPowerPoint = null)
9090
// Create XML writer
9191
$objWriter = $this->getXMLWriter();
9292
// XML header
93-
$objWriter->startDocument('1.0','UTF-8','yes');
93+
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
9494

9595
// a:tblStyleLst
9696
$objWriter->startElement('a:tblStyleLst');
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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/PHPPowerPoint/contributors.
12+
*
13+
* @copyright 2009-2014 PHPPowerPoint contributors
14+
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
15+
* @link https://github.com/PHPOffice/PHPPowerPoint
16+
*/
17+
18+
namespace PhpOffice\PhpPowerpoint\Tests\Writer\PowerPoint2007;
19+
20+
use PhpOffice\PhpPowerpoint\PhpPowerpoint;
21+
use PhpOffice\PhpPowerpoint\Shared\Drawing;
22+
use PhpOffice\PhpPowerpoint\Style\Alignment;
23+
use PhpOffice\PhpPowerpoint\Style\Bullet;
24+
use PhpOffice\PhpPowerpoint\Style\Color;
25+
use PhpOffice\PhpPowerpoint\Style\Fill;
26+
use PhpOffice\PhpPowerpoint\Tests\TestHelperDOCX;
27+
use PhpOffice\PhpPowerpoint\Writer\PowerPoint2007;
28+
use PhpOffice\PhpPowerpoint\Style\Border;
29+
use PhpOffice\PhpPowerpoint\Shape\Hyperlink;
30+
use PhpOffice\PhpPowerpoint\Writer\PowerPoint2007\Slide;
31+
32+
/**
33+
* Test class for PowerPoint2007
34+
*
35+
* @coversDefaultClass PowerPoint2007
36+
*/
37+
class PptPropsTest extends \PHPUnit_Framework_TestCase
38+
{
39+
/**
40+
* Executed before each method of the class
41+
*/
42+
public function tearDown()
43+
{
44+
TestHelperDOCX::clear();
45+
}
46+
47+
public function testPresProps()
48+
{
49+
$phpPowerPoint = new PhpPowerpoint();
50+
51+
$pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007');
52+
$element = '/p:presentationPr/p:extLst/p:ext';
53+
$this->assertTrue($pres->elementExists($element, 'ppt/presProps.xml'));
54+
$this->assertEquals('{E76CE94A-603C-4142-B9EB-6D1370010A27}', $pres->getElementAttribute($element, 'uri', 'ppt/presProps.xml'));
55+
}
56+
57+
public function testTableStyles()
58+
{
59+
$phpPowerPoint = new PhpPowerpoint();
60+
61+
$pres = TestHelperDOCX::getDocument($phpPowerPoint, 'PowerPoint2007');
62+
$element = '/a:tblStyleLst';
63+
$this->assertTrue($pres->elementExists($element, 'ppt/tableStyles.xml'));
64+
$this->assertEquals('{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}', $pres->getElementAttribute($element, 'def', 'ppt/tableStyles.xml'));
65+
}
66+
}

0 commit comments

Comments
 (0)