Skip to content

Commit 7044ebc

Browse files
committed
Merge pull request #109 from bskrtich/textrunbreak
Add Text Break to Text Run
2 parents 595bcc3 + 762f812 commit 7044ebc

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Classes/PHPWord/Section/TextRun.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,17 @@ public function addImage($imageSrc, $style = null) {
130130
}
131131
}
132132

133+
/**
134+
* Add a Text Break
135+
*
136+
* @param int $count
137+
*/
138+
public function addTextBreak($count = 1) {
139+
for ($i=1; $i<=$count; $i++) {
140+
$this->_elementCollection[] = new PHPWord_Section_TextBreak();
141+
}
142+
}
143+
133144
/**
134145
* Create a new Footnote Element
135146
*

Classes/PHPWord/Writer/Word2007/Base.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,10 @@ protected function _writeTextRun(PHPWord_Shared_XMLWriter $objWriter = null, PHP
108108
$this->_writeLink($objWriter, $element, true);
109109
} elseif ($element instanceof PHPWord_Section_Image) {
110110
$this->_writeImage($objWriter, $element, true);
111-
} elseif($element instanceof PHPWord_Section_Footnote) {
111+
} elseif ($element instanceof PHPWord_Section_Footnote) {
112112
$this->_writeFootnoteReference($objWriter, $element, true);
113+
} elseif ($element instanceof PHPWord_Section_TextBreak) {
114+
$objWriter->writeElement('w:br');
113115
}
114116
}
115117
}

0 commit comments

Comments
 (0)