File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
src/PhpWord/Writer/HTML/Element
tests/PhpWord/Writer/HTML Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ public function write()
45
45
$ text = $ this ->escaper ->escapeHtml ($ text );
46
46
}
47
47
} elseif ($ text instanceof \PhpOffice \PhpWord \Element \AbstractContainer) {
48
- $ writer = new Container ($ this ->parentWriter , $ this -> element );
48
+ $ writer = new Container ($ this ->parentWriter , $ text );
49
49
$ text = $ writer ->write ();
50
50
}
51
51
Original file line number Diff line number Diff line change 18
18
namespace PhpOffice \PhpWord \Writer \HTML ;
19
19
20
20
use PhpOffice \PhpWord \Element \Text as TextElement ;
21
+ use PhpOffice \PhpWord \Element \TextRun ;
21
22
use PhpOffice \PhpWord \Element \TrackChange ;
22
23
use PhpOffice \PhpWord \PhpWord ;
23
24
use PhpOffice \PhpWord \Writer \HTML ;
@@ -138,4 +139,22 @@ private function getAsHTML(PhpWord $phpWord)
138
139
139
140
return $ dom ;
140
141
}
142
+
143
+ public function testWriteTitleTextRun ()
144
+ {
145
+ $ expected = 'Title with TextRun ' ;
146
+
147
+ $ phpWord = new PhpWord ();
148
+ $ section = $ phpWord ->addSection ();
149
+
150
+ $ textRun = new TextRun ();
151
+ $ textRun ->addText ($ expected );
152
+
153
+ $ section ->addTitle ($ textRun );
154
+
155
+ $ htmlWriter = new HTML ($ phpWord );
156
+ $ content = $ htmlWriter ->getContent ();
157
+
158
+ $ this ->assertTrue (strpos ($ content , $ expected ) !== false );
159
+ }
141
160
}
You can’t perform that action at this time.
0 commit comments