Skip to content

Commit cd3f74e

Browse files
committed
Footnote fix
1 parent b11cd40 commit cd3f74e

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

Classes/PHPWord/Writer/Word2007/ContentTypes.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ public function writeContentTypes($_imageTypes, $_objectTypes, $_cHdrs, $_cFtrs)
138138
'application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml'
139139
);
140140

141+
// Footnotes
142+
$this->_writeOverrideContentType(
143+
$objWriter,
144+
'/word/footnotes.xml',
145+
'application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml'
146+
);
147+
141148
for ($i = 1; $i <= $_cHdrs; $i++) {
142149
$this->_writeOverrideContentType(
143150
$objWriter,
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
namespace PHPWord\Tests\Writer\Word2007;
3+
4+
use PHPWord;
5+
use PHPWord\Tests\TestHelperDOCX;
6+
7+
/**
8+
* Class PHPWord_Writer_Word2007_FootnotesTest
9+
* @package PHPWord\Tests
10+
* @runTestsInSeparateProcesses
11+
*/
12+
class FootnotesTest extends \PHPUnit_Framework_TestCase
13+
{
14+
/**
15+
* Executed before each method of the class
16+
*/
17+
public function tearDown()
18+
{
19+
TestHelperDOCX::clear();
20+
}
21+
22+
public function testWriteFootnotes()
23+
{
24+
$PHPWord = new PHPWord();
25+
$section = $PHPWord->createSection();
26+
$section->addText('Text');
27+
$footnote = $section->createFootnote();
28+
$footnote->addText('Footnote');
29+
$footnote->addLink('http://google.com');
30+
$doc = TestHelperDOCX::getDocument($PHPWord);
31+
32+
$this->assertEquals(1, 1);
33+
}
34+
}

0 commit comments

Comments
 (0)