1 | <?php |
||
2 | |||
3 | namespace Tests; |
||
4 | |||
5 | use PHPUnit\Framework\TestCase; |
||
6 | use DOMDocument; |
||
7 | use PhpDocxTemplate\PhpDocxTemplate; |
||
8 | use PhpDocxTemplate\DocxDocument; |
||
9 | use ZipArchive; |
||
10 | |||
11 | class PhpDocxTemplateTest extends TestCase |
||
12 | { |
||
13 | private const TEMPLATE1 = __DIR__ . "/templates/template1.docx"; |
||
14 | private const TEMPLATE2 = __DIR__ . "/templates/template2.docx"; |
||
15 | private const TEMPLATE3 = __DIR__ . "/templates/template3.docx"; |
||
16 | private const TEMPLATE4 = __DIR__ . "/templates/template4.docx"; |
||
17 | private const TEMPLATE5 = __DIR__ . "/templates/template5.docx"; |
||
18 | private const TEMPLATE8 = __DIR__ . "/templates/template8.docx"; |
||
19 | private const TEMPLATE9 = __DIR__ . "/templates/template9.docx"; |
||
20 | |||
21 | public function testXmlToString(): void |
||
22 | { |
||
23 | $xml = new DOMDocument('1.0'); |
||
24 | $root = $xml->createElement('w:body'); |
||
25 | $root = $xml->appendChild($root); |
||
26 | $title = $xml->createElement('title'); |
||
27 | $title = $root->appendChild($title); |
||
28 | $text = $xml->createTextNode('Title'); |
||
29 | $title->appendChild($text); |
||
30 | $reporter = new PhpDocxTemplate(self::TEMPLATE1); |
||
31 | |||
32 | $this->assertEquals( |
||
33 | $reporter->xmlToString($xml), |
||
34 | "<?xml version=\"1.0\"?>\n<w:body><title>Title</title></w:body>\n" |
||
35 | ); |
||
36 | $reporter->close(); |
||
37 | } |
||
38 | |||
39 | public function testGetDocx(): void |
||
40 | { |
||
41 | $reporter = new PhpDocxTemplate(self::TEMPLATE1); |
||
42 | $this->assertInstanceOf(DocxDocument::class, $reporter->getDocx()); |
||
43 | $reporter->close(); |
||
44 | } |
||
45 | |||
46 | public function testGetXml(): void |
||
47 | { |
||
48 | $reporter = new PhpDocxTemplate(self::TEMPLATE1); |
||
49 | $this->assertEquals( |
||
50 | $reporter->getXml(), |
||
51 | "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" . |
||
52 | "<w:document xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" " . |
||
53 | "xmlns:cx=\"http://schemas.microsoft.com/office/drawing/2014/chartex\" " . |
||
54 | "xmlns:cx1=\"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex\" " . |
||
55 | "xmlns:cx2=\"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex\" " . |
||
56 | "xmlns:cx3=\"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex\" " . |
||
57 | "xmlns:cx4=\"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex\" " . |
||
58 | "xmlns:cx5=\"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex\" " . |
||
59 | "xmlns:cx6=\"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex\" " . |
||
60 | "xmlns:cx7=\"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex\" " . |
||
61 | "xmlns:cx8=\"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex\" " . |
||
62 | "xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" " . |
||
63 | "xmlns:aink=\"http://schemas.microsoft.com/office/drawing/2016/ink\" " . |
||
64 | "xmlns:am3d=\"http://schemas.microsoft.com/office/drawing/2017/model3d\" " . |
||
65 | "xmlns:o=\"urn:schemas-microsoft-com:office:office\" " . |
||
66 | "xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" " . |
||
67 | "xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" " . |
||
68 | "xmlns:v=\"urn:schemas-microsoft-com:vml\" " . |
||
69 | "xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" " . |
||
70 | "xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" " . |
||
71 | "xmlns:w10=\"urn:schemas-microsoft-com:office:word\" " . |
||
72 | "xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" " . |
||
73 | "xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" " . |
||
74 | "xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" " . |
||
75 | "xmlns:w16cid=\"http://schemas.microsoft.com/office/word/2016/wordml/cid\" " . |
||
76 | "xmlns:w16se=\"http://schemas.microsoft.com/office/word/2015/wordml/symex\" " . |
||
77 | "xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" " . |
||
78 | "xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" " . |
||
79 | "xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" " . |
||
80 | "xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" " . |
||
81 | "mc:Ignorable=\"w14 w15 w16se w16cid wp14\"><w:body><w:p w14:paraId=\"504F2588\" " . |
||
82 | "w14:textId=\"54DF26C8\" w:rsidR=\"0090657C\" w:rsidRPr=\"00FA3F61\" " . |
||
83 | "w:rsidRDefault=\"00FA3F61\" w:rsidP=\"00C13DD6\"><w:pPr><w:rPr><w:lang w:val=\"en-US\"/>" . |
||
84 | "</w:rPr></w:pPr><w:r><w:rPr><w:lang w:val=\"en-US\"/></w:rPr><w:t>Hello {{ object }}!</w:t>" . |
||
85 | "</w:r><w:bookmarkStart w:id=\"0\" w:name=\"_GoBack\"/><w:bookmarkEnd w:id=\"0\"/></w:p>" . |
||
86 | "<w:sectPr w:rsidR=\"0090657C\" w:rsidRPr=\"00FA3F61\"><w:pgSz w:w=\"11906\" w:h=\"16838\"/>" . |
||
87 | "<w:pgMar w:top=\"1134\" w:right=\"850\" w:bottom=\"1134\" w:left=\"1701\" w:header=\"708\" " . |
||
88 | "w:footer=\"708\" w:gutter=\"0\"/><w:cols w:space=\"708\"/><w:docGrid w:linePitch=\"360\"/>" . |
||
89 | "</w:sectPr></w:body></w:document>\n" |
||
90 | ); |
||
91 | $reporter->close(); |
||
92 | } |
||
93 | |||
94 | public function testPatchXml(): void |
||
95 | { |
||
96 | $reporter = new PhpDocxTemplate(self::TEMPLATE1); |
||
97 | //test stripTags |
||
98 | $xml = "{<tag>%Hello</w:t><w:t>\nworld%<tag>}\n{<tag>{Hi</w:t><w:t>\nthere}<tag>}\n"; |
||
99 | $this->assertEquals( |
||
100 | $reporter->patchXmlChunk($xml), |
||
101 | "{%Hello\nworld%}\n{{Hi\nthere}}\n" |
||
102 | ); |
||
103 | |||
104 | //test colspan |
||
105 | $xml = "<w:tc xeLLm[t6;cT&!Z_#KI8cniins[)UX>TAnAaqg_a}sePvK.OO#Q=B-]cBDFM8UL]8m@i" . |
||
106 | "Ct{% colspan val%}TkuSd<w:r meg+PYSJWO}~k<w:t></w:t></w:r>" . |
||
107 | "<w:gridSpan88MJ@1bX/><w:tcPrL4><w:gridSpan@1bY/>?Nl`z:^kY@FXeJ@P{8WhCt0__/,8woI2." . |
||
108 | "8#[r_Cqig!5Qt{8gl5ls<9Ci|^QN2IK#L[cB9@:XclVQQIxe</w:tc>"; |
||
109 | $this->assertEquals( |
||
110 | $reporter->patchXmlChunk($xml), |
||
111 | '<w:tc xeLLm[t6;cT&!Z_#KI8cniins[)UX>TAnAaqg_a}sePvK.OO#Q=B-]cBDFM8UL]8m@iCtTkuSd<w:tcPrL4>' . |
||
112 | '<w:gridSpan w:val="{{val}}"/><w:gridSpan@1bY/>?Nl`z:^kY@FXeJ@P{8WhCt0__/,8woI2.8#[r_Cqig!5Qt' . |
||
113 | '{8gl5ls<9Ci|^QN2IK#L[cB9@:XclVQQIxe</w:tc>' |
||
114 | ); |
||
115 | |||
116 | //test cellbg |
||
117 | $xml = "<w:tc xeLLm[t6;cT&!Z_#KI8cniins[)UX>TAnAaqg_a}sePvK.OO#Q=B-]cBDFM8UL]8m@i" . |
||
118 | "Ct{% cellbg val%}TkuSd<w:r meg+PYSJWO}~k<w:t></w:t></w:r>" . |
||
119 | "<w:shd88MJ@1bX/><w:tcPrL4><w:shd@1bY/>?Nl`z:^kY@FXeJ@P{8WhCt0__/,8woI2." . |
||
120 | "8#[r_Cqig!5Qt{8gl5ls<9Ci|^QN2IK#L[cB9@:XclVQQIxe</w:tc>"; |
||
121 | $this->assertEquals( |
||
122 | $reporter->patchXmlChunk($xml), |
||
123 | '<w:tc xeLLm[t6;cT&!Z_#KI8cniins[)UX>TAnAaqg_a}sePvK.OO#Q=B-]cBDFM8UL]8m@iCtTkuSd<w:tcPrL4>' . |
||
124 | '<w:shd w:val="clear" w:color="auto" w:fill="{{val}}"/><w:shd@1bY/>?Nl`z:^kY@FXeJ@P{8WhCt0__/,' . |
||
125 | '8woI2.8#[r_Cqig!5Qt{8gl5ls<9Ci|^QN2IK#L[cB9@:XclVQQIxe</w:tc>' |
||
126 | ); |
||
127 | |||
128 | $xml = "{%r _Rom{X=aC3/s#W#~o<#d:tH^>DTAz;s<}O0RJ#V!wW:]%kR@wzLf*\iu^zAGrr!3]v<SUc|B)o>kA.:*1?,0%}"; |
||
129 | $this->assertEquals( |
||
130 | $reporter->patchXmlChunk($xml), |
||
131 | '</w:t></w:r><w:r><w:t xml:space="preserve">{%r _Rom{X=aC3/s#W#~o<#d:tH^>DTAz;s<}O0RJ#V!wW:]%kR' . |
||
132 | '@wzLf*\iu^zAGrr!3]v<SUc|B)o>kA.:*1?,0%}</w:t></w:r><w:r><w:t xml:space="preserve">' |
||
133 | ); |
||
134 | |||
135 | // test vMerge |
||
136 | $xml = "<w:tc></w:tcPr>t/H-Q.X)jC_sI6(J7w-;QI&JpDG}:>f02Zls<8(7&SEyc>" . |
||
137 | "`@P/<Ero^KEbL`EX^<w:t>{% vm %}</w:t></w:tc>"; |
||
138 | $this->assertEquals( |
||
139 | $reporter->patchXmlChunk($xml), |
||
140 | '<w:tc><w:vMerge w:val="{% if loop.first %}restart{% else %}continue' . |
||
141 | '{% endif %}"/></w:tcPr>t/H-Q.X)jC_sI6(J7w-;QI&JpDG}:>f02Zls<8(7&SEyc>`' . |
||
142 | '@P/<Ero^KEbL`EX^<w:t>{% if loop.first %}{% endif %}</w:t></w:tc>' |
||
143 | ); |
||
144 | |||
145 | // test hMerge |
||
146 | $xml = "<w:tc></w:tcPr>t/H-Q.X)jC_sI6(J7w-;QI&JpDG}:>f02Zls<8(7&SEyc>" . |
||
147 | "`@P/<Ero^KEbL`EX^<w:t>{% hm %}</w:t></w:tc>"; |
||
148 | $this->assertEquals( |
||
149 | $reporter->patchXmlChunk($xml), |
||
150 | '{% if loop.first %}<w:tc><w:gridSpan w:val="{{ loop.length }}"/></w:tcPr>t/H-Q.X)' . |
||
151 | 'jC_sI6(J7w-;QI&JpDG}:>f02Zls<8(7&SEyc>`@P/<Ero^KEbL`EX^<w:t></w:t></w:tc>{% endif %}' |
||
152 | ); |
||
153 | |||
154 | // test cleanTags |
||
155 | $xml = '{%‘<>“”‘’%}'; |
||
156 | $this->assertEquals( |
||
157 | $reporter->patchXmlChunk($xml), |
||
158 | "{%'<>\"\"''%}" |
||
159 | ); |
||
160 | $reporter->close(); |
||
161 | } |
||
162 | |||
163 | public function testRenderXml(): void |
||
164 | { |
||
165 | $reporter = new PhpDocxTemplate(self::TEMPLATE1); |
||
166 | |||
167 | $this->assertEquals( |
||
168 | $reporter->buildXml(["object" => "world"]), |
||
169 | "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" . |
||
170 | "<w:document xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" " . |
||
171 | "xmlns:cx=\"http://schemas.microsoft.com/office/drawing/2014/chartex\" " . |
||
172 | "xmlns:cx1=\"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex\" " . |
||
173 | "xmlns:cx2=\"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex\" " . |
||
174 | "xmlns:cx3=\"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex\" " . |
||
175 | "xmlns:cx4=\"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex\" " . |
||
176 | "xmlns:cx5=\"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex\" " . |
||
177 | "xmlns:cx6=\"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex\" " . |
||
178 | "xmlns:cx7=\"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex\" " . |
||
179 | "xmlns:cx8=\"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex\" " . |
||
180 | "xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" " . |
||
181 | "xmlns:aink=\"http://schemas.microsoft.com/office/drawing/2016/ink\" " . |
||
182 | "xmlns:am3d=\"http://schemas.microsoft.com/office/drawing/2017/model3d\" " . |
||
183 | "xmlns:o=\"urn:schemas-microsoft-com:office:office\" " . |
||
184 | "xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" " . |
||
185 | "xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" " . |
||
186 | "xmlns:v=\"urn:schemas-microsoft-com:vml\" " . |
||
187 | "xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" " . |
||
188 | "xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" " . |
||
189 | "xmlns:w10=\"urn:schemas-microsoft-com:office:word\" " . |
||
190 | "xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" " . |
||
191 | "xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" " . |
||
192 | "xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" " . |
||
193 | "xmlns:w16cid=\"http://schemas.microsoft.com/office/word/2016/wordml/cid\" " . |
||
194 | "xmlns:w16se=\"http://schemas.microsoft.com/office/word/2015/wordml/symex\" " . |
||
195 | "xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" " . |
||
196 | "xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" " . |
||
197 | "xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" " . |
||
198 | "xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" " . |
||
199 | "mc:Ignorable=\"w14 w15 w16se w16cid wp14\"><w:body><w:p w14:paraId=\"504F2588\" " . |
||
200 | "w14:textId=\"54DF26C8\" w:rsidR=\"0090657C\" w:rsidRPr=\"00FA3F61\" " . |
||
201 | "w:rsidRDefault=\"00FA3F61\" w:rsidP=\"00C13DD6\"><w:pPr><w:rPr><w:lang w:val=\"en-US\"/>" . |
||
202 | "</w:rPr></w:pPr><w:r><w:rPr><w:lang w:val=\"en-US\"/></w:rPr><w:t>Hello world!</w:t>" . |
||
203 | "</w:r><w:bookmarkStart w:id=\"0\" w:name=\"_GoBack\"/><w:bookmarkEnd w:id=\"0\"/></w:p>" . |
||
204 | "<w:sectPr w:rsidR=\"0090657C\" w:rsidRPr=\"00FA3F61\"><w:pgSz w:w=\"11906\" w:h=\"16838\"/>" . |
||
205 | "<w:pgMar w:top=\"1134\" w:right=\"850\" w:bottom=\"1134\" w:left=\"1701\" w:header=\"708\" " . |
||
206 | "w:footer=\"708\" w:gutter=\"0\"/><w:cols w:space=\"708\"/><w:docGrid w:linePitch=\"360\"/>" . |
||
207 | "</w:sectPr></w:body></w:document>" |
||
208 | ); |
||
209 | $reporter->close(); |
||
210 | } |
||
211 | |||
212 | public function testRender(): void |
||
213 | { |
||
214 | $reporter = new PhpDocxTemplate(self::TEMPLATE2); |
||
215 | $reporter->render(["one" => "1", "two" => "2", "three" => "3", "four" => "4"]); |
||
216 | $this->assertEquals( |
||
217 | $reporter->getXml(), |
||
218 | "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" . |
||
219 | "<w:document xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:c" . |
||
220 | "x=\"http://schemas.microsoft.com/office/drawing/2014/chartex\" xmlns:cx1=\"http://schemas.microsoft." . |
||
221 | "com/office/drawing/2015/9/8/chartex\" xmlns:cx2=\"http://schemas.microsoft.com/office/drawing/2015/1" . |
||
222 | "0/21/chartex\" xmlns:cx3=\"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex\" xmlns:cx4=" . |
||
223 | "\"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex\" xmlns:cx5=\"http://schemas.microso" . |
||
224 | "ft.com/office/drawing/2016/5/11/chartex\" xmlns:cx6=\"http://schemas.microsoft.com/office/drawing/20" . |
||
225 | "16/5/12/chartex\" xmlns:cx7=\"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex\" xmlns:" . |
||
226 | "cx8=\"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex\" xmlns:mc=\"http://schemas.open" . |
||
227 | "xmlformats.org/markup-compatibility/2006\" xmlns:aink=\"http://schemas.microsoft.com/office/drawing/" . |
||
228 | "2016/ink\" xmlns:am3d=\"http://schemas.microsoft.com/office/drawing/2017/model3d\" xmlns:o=\"urn:sch" . |
||
229 | "emas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/r" . |
||
230 | "elationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:" . |
||
231 | "schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessin" . |
||
232 | "gDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns" . |
||
233 | ":w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordproce" . |
||
234 | "ssingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"h" . |
||
235 | "ttp://schemas.microsoft.com/office/word/2012/wordml\" xmlns:w16cid=\"http://schemas.microsoft.com/of" . |
||
236 | "fice/word/2016/wordml/cid\" xmlns:w16se=\"http://schemas.microsoft.com/office/word/2015/wordml/symex" . |
||
237 | "\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http:" . |
||
238 | "//schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.co" . |
||
239 | "m/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessing" . |
||
240 | "Shape\" mc:Ignorable=\"w14 w15 w16se w16cid wp14\"><w:body><w:tbl><w:tblPr><w:tblStyle w:val=\"a3\"/" . |
||
241 | "><w:tblW w:w=\"0\" w:type=\"auto\"/><w:tblLook w:val=\"04A0\" w:firstRow=\"1\" w:lastRow=\"0\" w:fir" . |
||
242 | "stColumn=\"1\" w:lastColumn=\"0\" w:noHBand=\"0\" w:noVBand=\"1\"/></w:tblPr><w:tblGrid><w:gridCol w" . |
||
243 | ":w=\"3115\"/><w:gridCol w:w=\"3115\"/><w:gridCol w:w=\"3115\"/></w:tblGrid><w:tr w:rsidR=\"00031864" . |
||
244 | "\" w14:paraId=\"73B274FD\" w14:textId=\"77777777\" w:rsidTr=\"00135B64\"><w:tc><w:tcPr><w:tcW w:w=\"3" . |
||
245 | "115\" w:type=\"dxa\"/></w:tcPr><w:p w14:paraId=\"29117FB3\" w14:textId=\"713E58B3\" w:rsidR=\"000318" . |
||
246 | "64\" w:rsidRPr=\"0033062B\" w:rsidRDefault=\"00031864\" w:rsidP=\"0033062B\"><w:pPr><w:rPr><w:lang w" . |
||
247 | ":val=\"en-US\"/></w:rPr></w:pPr><w:r><w:rPr><w:lang w:val=\"en-US\"/></w:rPr><w:t>1</w:t></w:r></w:p" . |
||
248 | "></w:tc><w:tc><w:tcPr><w:tcW w:w=\"6230\" w:type=\"dxa\"/><w:gridSpan w:val=\"2\"/></w:tcPr><w:p w14" . |
||
249 | ":paraId=\"4620CF03\" w14:textId=\"7FD6FF29\" w:rsidR=\"00031864\" w:rsidRPr=\"00B6314C\" w:rsidRDefa" . |
||
250 | "ult=\"00B6314C\" w:rsidP=\"0033062B\"><w:pPr><w:rPr><w:lang w:val=\"en-US\"/></w:rPr></w:pPr><w:r><w" . |
||
251 | ":rPr><w:lang w:val=\"en-US\"/></w:rPr><w:t>1</w:t></w:r></w:p></w:tc></w:tr><w:tr w:rsidR=\"00031864" . |
||
252 | "\" w14:paraId=\"638CAE21\" w14:textId=\"77777777\" w:rsidTr=\"0033062B\"><w:tc><w:tcPr><w:tcW w:w=\"" . |
||
253 | "3115\" w:type=\"dxa\"/><w:vMerge w:val=\"restart\"/></w:tcPr><w:p w14:paraId=\"69D3958C\" w14:textId" . |
||
254 | "=\"77777777\" w:rsidR=\"00031864\" w:rsidRPr=\"0033062B\" w:rsidRDefault=\"00031864\" w:rsidP=\"0033" . |
||
255 | "062B\"><w:pPr><w:rPr><w:lang w:val=\"en-US\"/></w:rPr></w:pPr><w:r><w:rPr><w:lang w:val=\"en-US\"/><" . |
||
256 | "/w:rPr><w:t>2</w:t></w:r></w:p><w:p w14:paraId=\"203EF204\" w14:textId=\"751D091A\" w:rsidR=\"000318" . |
||
257 | "64\" w:rsidRPr=\"0033062B\" w:rsidRDefault=\"00031864\" w:rsidP=\"0033062B\"><w:pPr><w:rPr><w:lang w" . |
||
258 | ":val=\"en-US\"/></w:rPr></w:pPr><w:r><w:rPr><w:lang w:val=\"en-US\"/></w:rPr><w:t>3</w:t></w:r></w:p" . |
||
259 | "></w:tc><w:tc><w:tcPr><w:tcW w:w=\"3115\" w:type=\"dxa\"/></w:tcPr><w:p w14:paraId=\"29D750B5\" w14:" . |
||
260 | "textId=\"52111D71\" w:rsidR=\"00031864\" w:rsidRPr=\"00B6314C\" w:rsidRDefault=\"00B6314C\" w:rsidP=" . |
||
261 | "\"0033062B\"><w:pPr><w:rPr><w:lang w:val=\"en-US\"/></w:rPr></w:pPr><w:r><w:rPr><w:lang w:val=\"en-U" . |
||
262 | "S\"/></w:rPr><w:t>2</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"3115\" w:type=\"dxa\"/></w:tc" . |
||
263 | "Pr><w:p w14:paraId=\"443FEDA5\" w14:textId=\"77777777\" w:rsidR=\"00031864\" w:rsidRDefault=\"000318" . |
||
264 | "64\" w:rsidP=\"0033062B\"/></w:tc></w:tr><w:tr w:rsidR=\"00031864\" w14:paraId=\"3400FAC6\" w14:text" . |
||
265 | "Id=\"77777777\" w:rsidTr=\"0033062B\"><w:tc><w:tcPr><w:tcW w:w=\"3115\" w:type=\"dxa\"/><w:vMerge/><" . |
||
266 | "/w:tcPr><w:p w14:paraId=\"27010401\" w14:textId=\"299C3CC2\" w:rsidR=\"00031864\" w:rsidRPr=\"003306" . |
||
267 | "2B\" w:rsidRDefault=\"00031864\" w:rsidP=\"0033062B\"><w:pPr><w:rPr><w:lang w:val=\"en-US\"/></w:rPr" . |
||
268 | "></w:pPr></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"3115\" w:type=\"dxa\"/></w:tcPr><w:p w14:paraId=\"6" . |
||
269 | "D034FEF\" w14:textId=\"6465FA34\" w:rsidR=\"00031864\" w:rsidRPr=\"00B6314C\" w:rsidRDefault=\"00B63" . |
||
270 | "14C\" w:rsidP=\"0033062B\"><w:pPr><w:rPr><w:lang w:val=\"en-US\"/></w:rPr></w:pPr><w:r><w:rPr><w:lan" . |
||
271 | "g w:val=\"en-US\"/></w:rPr><w:t>3</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"3115\" w:type=" . |
||
272 | "\"dxa\"/></w:tcPr><w:p w14:paraId=\"331E7F28\" w14:textId=\"77777777\" w:rsidR=\"00031864\" w:rsidRDe" . |
||
273 | "fault=\"00031864\" w:rsidP=\"0033062B\"/></w:tc></w:tr><w:tr w:rsidR=\"0033062B\" w14:paraId=\"489E0" . |
||
274 | "54E\" w14:textId=\"77777777\" w:rsidTr=\"0033062B\"><w:tc><w:tcPr><w:tcW w:w=\"3115\" w:type=\"dxa\"" . |
||
275 | "/></w:tcPr><w:p w14:paraId=\"24A13E38\" w14:textId=\"18E3B4BC\" w:rsidR=\"0033062B\" w:rsidRPr=\"003" . |
||
276 | "3062B\" w:rsidRDefault=\"0033062B\" w:rsidP=\"0033062B\"><w:pPr><w:rPr><w:lang w:val=\"en-US\"/></w:" . |
||
277 | "rPr></w:pPr><w:r><w:rPr><w:lang w:val=\"en-US\"/></w:rPr><w:t>4</w:t></w:r></w:p></w:tc><w:tc><w:tcP" . |
||
278 | "r><w:tcW w:w=\"3115\" w:type=\"dxa\"/></w:tcPr><w:p w14:paraId=\"58DCBE56\" w14:textId=\"5D680B0D\" " . |
||
279 | "w:rsidR=\"0033062B\" w:rsidRPr=\"00B6314C\" w:rsidRDefault=\"00B6314C\" w:rsidP=\"0033062B\"><w:pPr>" . |
||
280 | "<w:rPr><w:lang w:val=\"en-US\"/></w:rPr></w:pPr><w:r><w:rPr><w:lang w:val=\"en-US\"/></w:rPr><w:t>4<" . |
||
281 | "/w:t></w:r><w:bookmarkStart w:id=\"0\" w:name=\"_GoBack\"/><w:bookmarkEnd w:id=\"0\"/></w:p></w:tc><" . |
||
282 | "w:tc><w:tcPr><w:tcW w:w=\"3115\" w:type=\"dxa\"/></w:tcPr><w:p w14:paraId=\"277EDAD6\" w14:textId=\"" . |
||
283 | "77777777\" w:rsidR=\"0033062B\" w:rsidRDefault=\"0033062B\" w:rsidP=\"0033062B\"/></w:tc></w:tr></w:" . |
||
284 | "tbl><w:p w14:paraId=\"504F2588\" w14:textId=\"658244D8\" w:rsidR=\"0090657C\" w:rsidRPr=\"0033062B\"" . |
||
285 | " w:rsidRDefault=\"0090657C\" w:rsidP=\"0033062B\"/><w:sectPr w:rsidR=\"0090657C\" w:rsidRPr=\"003306" . |
||
286 | "2B\"><w:pgSz w:w=\"11906\" w:h=\"16838\"/><w:pgMar w:top=\"1134\" w:right=\"850\" w:bottom=\"1134\" " . |
||
287 | "w:left=\"1701\" w:header=\"708\" w:footer=\"708\" w:gutter=\"0\"/><w:cols w:space=\"708\"/><w:docGri" . |
||
288 | "d w:linePitch=\"360\"/></w:sectPr></w:body></w:document>\n" |
||
289 | ); |
||
290 | $reporter->save(sys_get_temp_dir() . "/test.docx"); |
||
291 | } |
||
292 | |||
293 | public function testLineBreak(): void |
||
294 | { |
||
295 | $reporter = new PhpDocxTemplate(self::TEMPLATE3); |
||
296 | $reporter->render(["один" => "значение с \n переносом строки"]); |
||
297 | $this->assertEquals( |
||
298 | $reporter->getXml(), |
||
299 | "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" . |
||
300 | "<w:document xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:c" . |
||
301 | "x=\"http://schemas.microsoft.com/office/drawing/2014/chartex\" xmlns:cx1=\"http://schemas.microsoft." . |
||
302 | "com/office/drawing/2015/9/8/chartex\" xmlns:cx2=\"http://schemas.microsoft.com/office/drawing/2015/1" . |
||
303 | "0/21/chartex\" xmlns:cx3=\"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex\" xmlns:cx4=" . |
||
304 | "\"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex\" xmlns:cx5=\"http://schemas.microso" . |
||
305 | "ft.com/office/drawing/2016/5/11/chartex\" xmlns:cx6=\"http://schemas.microsoft.com/office/drawing/20" . |
||
306 | "16/5/12/chartex\" xmlns:cx7=\"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex\" xmlns:" . |
||
307 | "cx8=\"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex\" xmlns:mc=\"http://schemas.open" . |
||
308 | "xmlformats.org/markup-compatibility/2006\" xmlns:aink=\"http://schemas.microsoft.com/office/drawing/" . |
||
309 | "2016/ink\" xmlns:am3d=\"http://schemas.microsoft.com/office/drawing/2017/model3d\" xmlns:o=\"urn:sch" . |
||
310 | "emas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/r" . |
||
311 | "elationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:" . |
||
312 | "schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessin" . |
||
313 | "gDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns" . |
||
314 | ":w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordproce" . |
||
315 | "ssingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"h" . |
||
316 | "ttp://schemas.microsoft.com/office/word/2012/wordml\" xmlns:w16cid=\"http://schemas.microsoft.com/of" . |
||
317 | "fice/word/2016/wordml/cid\" xmlns:w16se=\"http://schemas.microsoft.com/office/word/2015/wordml/symex" . |
||
318 | "\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http:" . |
||
319 | "//schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.co" . |
||
320 | "m/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessing" . |
||
321 | "Shape\" mc:Ignorable=\"w14 w15 w16se w16cid wp14\"><w:body><w:p w14:paraId=\"504F2588\" w14:textId=" . |
||
322 | "\"0B366F38\" w:rsidR=\"0090657C\" w:rsidRPr=\"00BC38E6\" w:rsidRDefault=\"00BC38E6\" w:rsidP=\"003306" . |
||
323 | "2B\"><w:pPr><w:rPr><w:lang w:val=\"en-US\"/></w:rPr></w:pPr><w:r><w:rPr><w:lang w:val=\"en-US\"/></w" . |
||
324 | ":rPr><w:t xml:space=\"preserve\">значение с </w:t></w:r></w:p><w:p><w:pPr><w:rPr><w:lang w:val=\"en-U" . |
||
325 | "S\"/></w:rPr></w:pPr><w:r><w:rPr><w:lang w:val=\"en-US\"/></w:rPr><w:t xml:space=\"preserve\">" . |
||
326 | " переносом строки</w:t></w:r><w:bookmarkStart w:id=\"0\" w:name=\"_GoBack\"/>" . |
||
327 | "<w:bookmarkEnd w:id=\"0\"/></w:p><w:sectPr w:rsidR=\"0090657C\" w:rsidRPr=\"00BC38E6\"><w:pgSz w:w=\"" . |
||
328 | "11906\" w:h=\"16838\"/><w:pgMar w:top=\"1134\" w:right=\"850\" w:bottom=\"1134\" w:left=\"1701\" w:he" . |
||
329 | "ader=\"708\" w:footer=\"708\" w:gutter=\"0\"/><w:cols w:space=\"708\"/><w:docGrid w:linePitch=\"360\"/><" . |
||
330 | "/w:sectPr></w:body></w:document>\n" |
||
331 | ); |
||
332 | } |
||
333 | |||
334 | public function testCyrillic(): void |
||
335 | { |
||
336 | $reporter = new PhpDocxTemplate(self::TEMPLATE3); |
||
337 | $reporter->render(["один" => "значение"]); |
||
338 | $this->assertEquals( |
||
339 | $reporter->getXml(), |
||
340 | "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" . |
||
341 | "<w:document xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:c" . |
||
342 | "x=\"http://schemas.microsoft.com/office/drawing/2014/chartex\" xmlns:cx1=\"http://schemas.microsoft." . |
||
343 | "com/office/drawing/2015/9/8/chartex\" xmlns:cx2=\"http://schemas.microsoft.com/office/drawing/2015/1" . |
||
344 | "0/21/chartex\" xmlns:cx3=\"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex\" xmlns:cx4=" . |
||
345 | "\"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex\" xmlns:cx5=\"http://schemas.microso" . |
||
346 | "ft.com/office/drawing/2016/5/11/chartex\" xmlns:cx6=\"http://schemas.microsoft.com/office/drawing/20" . |
||
347 | "16/5/12/chartex\" xmlns:cx7=\"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex\" xmlns:" . |
||
348 | "cx8=\"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex\" xmlns:mc=\"http://schemas.open" . |
||
349 | "xmlformats.org/markup-compatibility/2006\" xmlns:aink=\"http://schemas.microsoft.com/office/drawing/" . |
||
350 | "2016/ink\" xmlns:am3d=\"http://schemas.microsoft.com/office/drawing/2017/model3d\" xmlns:o=\"urn:sch" . |
||
351 | "emas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/r" . |
||
352 | "elationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:" . |
||
353 | "schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessin" . |
||
354 | "gDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns" . |
||
355 | ":w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordproce" . |
||
356 | "ssingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"h" . |
||
357 | "ttp://schemas.microsoft.com/office/word/2012/wordml\" xmlns:w16cid=\"http://schemas.microsoft.com/of" . |
||
358 | "fice/word/2016/wordml/cid\" xmlns:w16se=\"http://schemas.microsoft.com/office/word/2015/wordml/symex" . |
||
359 | "\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http:" . |
||
360 | "//schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.co" . |
||
361 | "m/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessing" . |
||
362 | "Shape\" mc:Ignorable=\"w14 w15 w16se w16cid wp14\"><w:body><w:p w14:paraId=\"504F2588\" w14:textId=" . |
||
363 | "\"0B366F38\" w:rsidR=\"0090657C\" w:rsidRPr=\"00BC38E6\" w:rsidRDefault=\"00BC38E6\" w:rsidP=\"003306" . |
||
364 | "2B\"><w:pPr><w:rPr><w:lang w:val=\"en-US\"/></w:rPr></w:pPr><w:r><w:rPr><w:lang w:val=\"en-US\"/></w" . |
||
365 | ":rPr><w:t xml:space=\"preserve\">значение</w:t></w:r><w:bookmarkStart w:id=\"0\" w:name=\"_GoBack\"/>" . |
||
366 | "<w:bookmarkEnd w:id=\"0\"/></w:p><w:sectPr w:rsidR=\"0090657C\" w:rsidRPr=\"00BC38E6\"><w:pgSz w:w=\"" . |
||
367 | "11906\" w:h=\"16838\"/><w:pgMar w:top=\"1134\" w:right=\"850\" w:bottom=\"1134\" w:left=\"1701\" w:he" . |
||
368 | "ader=\"708\" w:footer=\"708\" w:gutter=\"0\"/><w:cols w:space=\"708\"/><w:docGrid w:linePitch=\"360\"/><" . |
||
369 | "/w:sectPr></w:body></w:document>\n" |
||
370 | ); |
||
371 | } |
||
372 | |||
373 | public function testForLoop(): void |
||
374 | { |
||
375 | $reporter = new PhpDocxTemplate(self::TEMPLATE4); |
||
376 | $reporter->render(["сотрудники" => [ |
||
377 | [ |
||
378 | "фамилия" => "Иванов", |
||
379 | "имя" => "Иван", |
||
380 | "отчество" => "Иванович", |
||
381 | "дети" => [ |
||
382 | [ |
||
383 | "фамилия" => "Иванова", |
||
384 | "имя" => "Алена", |
||
385 | "отчество" => "Ивановна", |
||
386 | "возраст" => 25 |
||
387 | ], |
||
388 | [ |
||
389 | "фамилия" => "Иванов", |
||
390 | "имя" => "Михаил", |
||
391 | "отчество" => "Иванович", |
||
392 | "возраст" => 6 |
||
393 | ] |
||
394 | ], |
||
395 | "возраст" => 50 |
||
396 | ], |
||
397 | [ |
||
398 | "фамилия" => "Петров", |
||
399 | "имя" => "Петр", |
||
400 | "отчество" => "Петрович", |
||
401 | "возраст" => 30 |
||
402 | ] |
||
403 | ]]); |
||
404 | $this->assertEquals( |
||
405 | $reporter->getXml(), |
||
406 | "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" . |
||
407 | "<w:document xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:c" . |
||
408 | "x=\"http://schemas.microsoft.com/office/drawing/2014/chartex\" xmlns:cx1=\"http://schemas.microsoft." . |
||
409 | "com/office/drawing/2015/9/8/chartex\" xmlns:cx2=\"http://schemas.microsoft.com/office/drawing/2015/1" . |
||
410 | "0/21/chartex\" xmlns:cx3=\"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex\" xmlns:cx4=" . |
||
411 | "\"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex\" xmlns:cx5=\"http://schemas.microso" . |
||
412 | "ft.com/office/drawing/2016/5/11/chartex\" xmlns:cx6=\"http://schemas.microsoft.com/office/drawing/20" . |
||
413 | "16/5/12/chartex\" xmlns:cx7=\"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex\" xmlns:" . |
||
414 | "cx8=\"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex\" xmlns:mc=\"http://schemas.open" . |
||
415 | "xmlformats.org/markup-compatibility/2006\" xmlns:aink=\"http://schemas.microsoft.com/office/drawing/" . |
||
416 | "2016/ink\" xmlns:am3d=\"http://schemas.microsoft.com/office/drawing/2017/model3d\" xmlns:o=\"urn:sch" . |
||
417 | "emas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/r" . |
||
418 | "elationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:" . |
||
419 | "schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessin" . |
||
420 | "gDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns" . |
||
421 | ":w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordproce" . |
||
422 | "ssingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"h" . |
||
423 | "ttp://schemas.microsoft.com/office/word/2012/wordml\" xmlns:w16cid=\"http://schemas.microsoft.com/of" . |
||
424 | "fice/word/2016/wordml/cid\" xmlns:w16se=\"http://schemas.microsoft.com/office/word/2015/wordml/symex" . |
||
425 | "\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http:" . |
||
426 | "//schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.co" . |
||
427 | "m/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessing" . |
||
428 | "Shape\" mc:Ignorable=\"w14 w15 w16se w16cid wp14\"><w:body><w:p w14:paraId=\"45D5C362\" w14:textId=" . |
||
429 | "\"79C82D83\" w:rsidR=\"00AF4B5B\" w:rsidRDefault=\"005D75A1\" w:rsidP=\"006B0D50\"><w:pPr><w:pStyle w" . |
||
430 | ":val=\"a4\"/><w:numPr><w:ilvl w:val=\"0\"/><w:numId w:val=\"2\"/></w:numPr></w:pPr><w:proofErr w:typ" . |
||
431 | "e=\"gramStart\"/><w:r w:rsidRPr=\"005D75A1\"><w:t xml:space=\"preserve\">Иванов Иван Иванович</w:t><" . |
||
432 | "/w:r><w:r w:rsidR=\"00FE09C8\" w:rsidRPr=\"00FE09C8\"><w:t xml:space=\"preserve\">, </w:t></w:r><w:r" . |
||
433 | " w:rsidR=\"00FE09C8\"><w:t>возраст</w:t></w:r><w:r w:rsidR=\"00FE09C8\" w:rsidRPr=\"00FE09C8\"><w:t>" . |
||
434 | ":</w:t></w:r><w:r w:rsidR=\"005E422E\"><w:t xml:space=\"preserve\"> </w:t></w:r><w:r w:rsidR=\"005E4" . |
||
435 | "22E\" w:rsidRPr=\"00DE2B94\"><w:t>50</w:t></w:r></w:p><w:p w14:paraId=\"78D1FA3D\" w14:textId=\"55EF" . |
||
436 | "7A47\" w:rsidR=\"00AF4B5B\" w:rsidRDefault=\"00DE2B94\" w:rsidP=\"0031223E\"><w:pPr><w:pStyle w:val=" . |
||
437 | "\"a4\"/></w:pPr><w:r><w:t xml:space=\"preserve\">- </w:t></w:r><w:proofErr w:type=\"gramStart\"/><w:" . |
||
438 | "r w:rsidRPr=\"00DE2B94\"><w:t xml:space=\"preserve\">Иванова Алена Ивановна</w:t></w:r><w:r w:rsidR=" . |
||
439 | "\"00126257\" w:rsidRPr=\"00126257\"><w:t xml:space=\"preserve\"> </w:t></w:r></w:p><w:p w14:paraId=" . |
||
440 | "\"78D1FA3D\" w14:textId=\"55EF7A47\" w:rsidR=\"00AF4B5B\" w:rsidRDefault=\"00DE2B94\" w:rsidP=\"00312" . |
||
441 | "23E\"><w:pPr><w:pStyle w:val=\"a4\"/></w:pPr><w:r><w:t xml:space=\"preserve\">- </w:t></w:r><w:proofErr " . |
||
442 | "w:type=\"gramStart\"/><w:r w:rsidRPr=\"00DE2B94\"><w:t xml:space=\"preserve\">Иванов Михаил Иванович" . |
||
443 | "</w:t></w:r><w:r w:rsidR=\"00126257\" w:rsidRPr=\"00126257\"><w:t xml:space=\"preserve\"> </w:t></w:" . |
||
444 | "r></w:p><w:p w14:paraId=\"45D5C362\" w14:textId=\"79C82D83\" w:rsidR=\"00AF4B5B\" w:rsidRDefault=\"0" . |
||
445 | "05D75A1\" w:rsidP=\"006B0D50\"><w:pPr><w:pStyle w:val=\"a4\"/><w:numPr><w:ilvl w:val=\"0\"/><w:numId" . |
||
446 | " w:val=\"2\"/></w:numPr></w:pPr><w:proofErr w:type=\"gramStart\"/><w:r w:rsidRPr=\"005D75A1\"><w:t x" . |
||
447 | "ml:space=\"preserve\">Петров Петр Петрович</w:t></w:r><w:r w:rsidR=\"00FE09C8\" w:rsidRPr=\"00FE09C8" . |
||
448 | "\"><w:t xml:space=\"preserve\">, </w:t></w:r><w:r w:rsidR=\"00FE09C8\"><w:t>возраст</w:t></w:r><w:r " . |
||
449 | "w:rsidR=\"00FE09C8\" w:rsidRPr=\"00FE09C8\"><w:t>:</w:t></w:r><w:r w:rsidR=\"005E422E\"><w:t xml:spa" . |
||
450 | "ce=\"preserve\"> </w:t></w:r><w:r w:rsidR=\"005E422E\" w:rsidRPr=\"00DE2B94\"><w:t>30</w:t></w:r></w" . |
||
451 | ":p><w:p w14:paraId=\"4B66446E\" w14:textId=\"2D5C0B86\" w:rsidR=\"0024376E\" w:rsidRDefault=\"002437" . |
||
452 | "6E\" w:rsidP=\"00AF4B5B\"/><w:p w14:paraId=\"3F32EC2C\" w14:textId=\"77777777\" w:rsidR=\"0024376E\"" . |
||
453 | " w:rsidRPr=\"008D21C0\" w:rsidRDefault=\"0024376E\" w:rsidP=\"00AF4B5B\"/><w:sectPr w:rsidR=\"002437" . |
||
454 | "6E\" w:rsidRPr=\"008D21C0\"><w:pgSz w:w=\"11906\" w:h=\"16838\"/><w:pgMar w:top=\"1134\" w:right=\"8" . |
||
455 | "50\" w:bottom=\"1134\" w:left=\"1701\" w:header=\"708\" w:footer=\"708\" w:gutter=\"0\"/><w:cols w:s" . |
||
456 | "pace=\"708\"/><w:docGrid w:linePitch=\"360\"/></w:sectPr></w:body></w:document>\n" |
||
457 | ); |
||
458 | } |
||
459 | |||
460 | public function testTable(): void |
||
461 | { |
||
462 | $reporter = new PhpDocxTemplate(self::TEMPLATE5); |
||
463 | $reporter->render(["records" => [ |
||
464 | [ |
||
465 | "a" => "a1", |
||
466 | "b" => "b1", |
||
467 | "c" => "c1" |
||
468 | ], |
||
469 | [ |
||
470 | "a" => "a2", |
||
471 | "b" => "b2", |
||
472 | "c" => "c2" |
||
473 | ] |
||
474 | ]]); |
||
475 | |||
476 | $this->assertEquals( |
||
477 | $reporter->getXml(), |
||
478 | "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" . |
||
479 | "<w:document xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\"><w:body><w:tbl>" . |
||
480 | "<w:tblPr/><w:tblGrid><w:gridCol w:w=\"1526\"/><w:gridCol w:w=\"1843\"/><w:gridCol w:w=\"5919\"/></w:" . |
||
481 | "tblGrid><w:tr><w:trPr><w:trHeight w:val=\"200\" w:hRule=\"auto\"/><w:jc w:val=\"left\"/></w:trPr><w:" . |
||
482 | "tc><w:tcPr><w:tcW w:w=\"1526\" w:type=\"dxa\"/><w:tcBorders><w:top w:val=\"single\" w:color=\"000000" . |
||
483 | "\" w:sz=\"4\"/><w:left w:val=\"single\" w:color=\"000000\" w:sz=\"4\"/><w:bottom w:val=\"single\" w:" . |
||
484 | "color=\"000000\" w:sz=\"4\"/><w:right w:val=\"single\" w:color=\"000000\" w:sz=\"4\"/></w:tcBorders>" . |
||
485 | "<w:shd w:color=\"000000\" w:fill=\"ffffff\" w:val=\"clear\"/><w:tcMar><w:left w:w=\"108\" w:type=\"d" . |
||
486 | "xa\"/><w:right w:w=\"108\" w:type=\"dxa\"/></w:tcMar><w:vAlign w:val=\"top\"/></w:tcPr><w:p><w:pPr><" . |
||
487 | "w:spacing w:before=\"0\" w:after=\"0\" w:line=\"240\"/><w:ind w:right=\"0\" w:left=\"0\" w:firstLine" . |
||
488 | "=\"0\"/><w:jc w:val=\"left\"/><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibr" . |
||
489 | "i\" w:eastAsia=\"Calibri\"/><w:color w:val=\"auto\"/><w:spacing w:val=\"0\"/><w:position w:val=\"0\"" . |
||
490 | "/><w:sz w:val=\"22\"/><w:shd w:fill=\"auto\" w:val=\"clear\"/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts " . |
||
491 | "w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Calibri\"/><w:color w:val=\"au" . |
||
492 | "to\"/><w:spacing w:val=\"0\"/><w:position w:val=\"0\"/><w:sz w:val=\"22\"/><w:shd w:fill=\"auto\" w:" . |
||
493 | "val=\"clear\"/></w:rPr><w:t xml:space=\"preserve\">A</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:" . |
||
494 | "w=\"1843\" w:type=\"dxa\"/><w:tcBorders><w:top w:val=\"single\" w:color=\"000000\" w:sz=\"4\"/><w:le" . |
||
495 | "ft w:val=\"single\" w:color=\"000000\" w:sz=\"4\"/><w:bottom w:val=\"single\" w:color=\"000000\" w:s" . |
||
496 | "z=\"4\"/><w:right w:val=\"single\" w:color=\"000000\" w:sz=\"4\"/></w:tcBorders><w:shd w:color=\"000" . |
||
497 | "000\" w:fill=\"ffffff\" w:val=\"clear\"/><w:tcMar><w:left w:w=\"108\" w:type=\"dxa\"/><w:right w:w=\"" . |
||
498 | "108\" w:type=\"dxa\"/></w:tcMar><w:vAlign w:val=\"top\"/></w:tcPr><w:p><w:pPr><w:spacing w:before=\"" . |
||
499 | "0\" w:after=\"0\" w:line=\"240\"/><w:ind w:right=\"0\" w:left=\"0\" w:firstLine=\"0\"/><w:jc w:val=" . |
||
500 | "\"left\"/><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Cal" . |
||
501 | "ibri\"/><w:color w:val=\"auto\"/><w:spacing w:val=\"0\"/><w:position w:val=\"0\"/><w:sz w:val=\"22\"" . |
||
502 | "/><w:shd w:fill=\"auto\" w:val=\"clear\"/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii=\"Calibri\" " . |
||
503 | "w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Calibri\"/><w:color w:val=\"auto\"/><w:spacing w:v" . |
||
504 | "al=\"0\"/><w:position w:val=\"0\"/><w:sz w:val=\"22\"/><w:shd w:fill=\"auto\" w:val=\"clear\"/></w:r" . |
||
505 | "Pr><w:t xml:space=\"preserve\">B</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"5919\" w:type=\"" . |
||
506 | "dxa\"/><w:tcBorders><w:top w:val=\"single\" w:color=\"000000\" w:sz=\"4\"/><w:left w:val=\"single\" " . |
||
507 | "w:color=\"000000\" w:sz=\"4\"/><w:bottom w:val=\"single\" w:color=\"000000\" w:sz=\"4\"/><w:right w:" . |
||
508 | "val=\"single\" w:color=\"000000\" w:sz=\"4\"/></w:tcBorders><w:shd w:color=\"000000\" w:fill=\"fffff" . |
||
509 | "f\" w:val=\"clear\"/><w:tcMar><w:left w:w=\"108\" w:type=\"dxa\"/><w:right w:w=\"108\" w:type=\"dxa\"" . |
||
510 | "/></w:tcMar><w:vAlign w:val=\"top\"/></w:tcPr><w:p><w:pPr><w:spacing w:before=\"0\" w:after=\"0\" w" . |
||
511 | ":line=\"240\"/><w:ind w:right=\"0\" w:left=\"0\" w:firstLine=\"0\"/><w:jc w:val=\"left\"/><w:rPr><w:" . |
||
512 | "rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Calibri\"/><w:color w:v" . |
||
513 | "al=\"auto\"/><w:spacing w:val=\"0\"/><w:position w:val=\"0\"/><w:sz w:val=\"22\"/><w:shd w:fill=\"au" . |
||
514 | "to\" w:val=\"clear\"/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" " . |
||
515 | "w:cs=\"Calibri\" w:eastAsia=\"Calibri\"/><w:color w:val=\"auto\"/><w:spacing w:val=\"0\"/><w:positio" . |
||
516 | "n w:val=\"0\"/><w:sz w:val=\"22\"/><w:shd w:fill=\"auto\" w:val=\"clear\"/></w:rPr><w:t xml:space=\"" . |
||
517 | "preserve\">C</w:t></w:r></w:p></w:tc></w:tr><w:tr><w:trPr><w:trHeight w:val=\"1\" w:hRule=\"atLeast\"" . |
||
518 | "/><w:jc w:val=\"left\"/></w:trPr><w:tc><w:tcPr><w:tcW w:w=\"1526\" w:type=\"dxa\"/><w:tcBorders><w:" . |
||
519 | "top w:val=\"single\" w:color=\"000000\" w:sz=\"4\"/><w:left w:val=\"single\" w:color=\"000000\" w:sz" . |
||
520 | "=\"4\"/><w:bottom w:val=\"single\" w:color=\"000000\" w:sz=\"4\"/><w:right w:val=\"single\" w:color=" . |
||
521 | "\"000000\" w:sz=\"4\"/></w:tcBorders><w:shd w:color=\"000000\" w:fill=\"ffffff\" w:val=\"clear\"/><w" . |
||
522 | ":tcMar><w:left w:w=\"108\" w:type=\"dxa\"/><w:right w:w=\"108\" w:type=\"dxa\"/></w:tcMar><w:vAlign " . |
||
523 | "w:val=\"top\"/></w:tcPr><w:p><w:pPr><w:spacing w:before=\"0\" w:after=\"0\" w:line=\"240\"/><w:ind w" . |
||
524 | ":right=\"0\" w:left=\"0\" w:firstLine=\"0\"/><w:jc w:val=\"left\"/><w:rPr><w:rFonts w:ascii=\"Calibr" . |
||
525 | "i\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Calibri\"/><w:color w:val=\"auto\"/><w:spacing" . |
||
526 | " w:val=\"0\"/><w:position w:val=\"0\"/><w:sz w:val=\"22\"/><w:shd w:fill=\"auto\" w:val=\"clear\"/><" . |
||
527 | "/w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:east" . |
||
528 | "Asia=\"Calibri\"/><w:color w:val=\"auto\"/><w:spacing w:val=\"0\"/><w:position w:val=\"0\"/><w:sz w:" . |
||
529 | "val=\"22\"/><w:shd w:fill=\"auto\" w:val=\"clear\"/></w:rPr><w:t xml:space=\"preserve\">a1</w:t></w:" . |
||
530 | "r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"1843\" w:type=\"dxa\"/><w:tcBorders><w:top w:val=\"single\"" . |
||
531 | " w:color=\"000000\" w:sz=\"4\"/><w:left w:val=\"single\" w:color=\"000000\" w:sz=\"4\"/><w:bottom w" . |
||
532 | ":val=\"single\" w:color=\"000000\" w:sz=\"4\"/><w:right w:val=\"single\" w:color=\"000000\" w:sz=\"4" . |
||
533 | "\"/></w:tcBorders><w:shd w:color=\"000000\" w:fill=\"ffffff\" w:val=\"clear\"/><w:tcMar><w:left w:w=" . |
||
534 | "\"108\" w:type=\"dxa\"/><w:right w:w=\"108\" w:type=\"dxa\"/></w:tcMar><w:vAlign w:val=\"top\"/></w:" . |
||
535 | "tcPr><w:p><w:pPr><w:spacing w:before=\"0\" w:after=\"0\" w:line=\"240\"/><w:ind w:right=\"0\" w:left" . |
||
536 | "=\"0\" w:firstLine=\"0\"/><w:jc w:val=\"left\"/><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calib" . |
||
537 | "ri\" w:cs=\"Calibri\" w:eastAsia=\"Calibri\"/><w:color w:val=\"auto\"/><w:spacing w:val=\"0\"/><w:po" . |
||
538 | "sition w:val=\"0\"/><w:sz w:val=\"22\"/><w:shd w:fill=\"auto\" w:val=\"clear\"/></w:rPr></w:pPr><w:r" . |
||
539 | "><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Calibri\"/><" . |
||
540 | "w:color w:val=\"auto\"/><w:spacing w:val=\"0\"/><w:position w:val=\"0\"/><w:sz w:val=\"22\"/><w:shd " . |
||
541 | "w:fill=\"auto\" w:val=\"clear\"/></w:rPr><w:t xml:space=\"preserve\">b1</w:t></w:r></w:p></w:tc><w:t" . |
||
542 | "c><w:tcPr><w:tcW w:w=\"5919\" w:type=\"dxa\"/><w:tcBorders><w:top w:val=\"single\" w:color=\"000000\"" . |
||
543 | " w:sz=\"4\"/><w:left w:val=\"single\" w:color=\"000000\" w:sz=\"4\"/><w:bottom w:val=\"single\" w:c" . |
||
544 | "olor=\"000000\" w:sz=\"4\"/><w:right w:val=\"single\" w:color=\"000000\" w:sz=\"4\"/></w:tcBorders><" . |
||
545 | "w:shd w:color=\"000000\" w:fill=\"ffffff\" w:val=\"clear\"/><w:tcMar><w:left w:w=\"108\" w:type=\"dx" . |
||
546 | "a\"/><w:right w:w=\"108\" w:type=\"dxa\"/></w:tcMar><w:vAlign w:val=\"top\"/></w:tcPr><w:p><w:pPr><w" . |
||
547 | ":spacing w:before=\"0\" w:after=\"0\" w:line=\"240\"/><w:ind w:right=\"0\" w:left=\"0\" w:firstLine=" . |
||
548 | "\"0\"/><w:jc w:val=\"left\"/><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri" . |
||
549 | "\" w:eastAsia=\"Calibri\"/><w:color w:val=\"auto\"/><w:spacing w:val=\"0\"/><w:position w:val=\"0\"/" . |
||
550 | "><w:sz w:val=\"22\"/><w:shd w:fill=\"auto\" w:val=\"clear\"/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w" . |
||
551 | ":ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Calibri\"/><w:color w:val=\"aut" . |
||
552 | "o\"/><w:spacing w:val=\"0\"/><w:position w:val=\"0\"/><w:sz w:val=\"22\"/><w:shd w:fill=\"auto\" w:v" . |
||
553 | "al=\"clear\"/></w:rPr><w:t xml:space=\"preserve\">c1</w:t></w:r></w:p></w:tc></w:tr><w:tr><w:trPr><w" . |
||
554 | ":trHeight w:val=\"1\" w:hRule=\"atLeast\"/><w:jc w:val=\"left\"/></w:trPr><w:tc><w:tcPr><w:tcW w:w=\"" . |
||
555 | "1526\" w:type=\"dxa\"/><w:tcBorders><w:top w:val=\"single\" w:color=\"000000\" w:sz=\"4\"/><w:left " . |
||
556 | "w:val=\"single\" w:color=\"000000\" w:sz=\"4\"/><w:bottom w:val=\"single\" w:color=\"000000\" w:sz=\"" . |
||
557 | "4\"/><w:right w:val=\"single\" w:color=\"000000\" w:sz=\"4\"/></w:tcBorders><w:shd w:color=\"000000" . |
||
558 | "\" w:fill=\"ffffff\" w:val=\"clear\"/><w:tcMar><w:left w:w=\"108\" w:type=\"dxa\"/><w:right w:w=\"10" . |
||
559 | "8\" w:type=\"dxa\"/></w:tcMar><w:vAlign w:val=\"top\"/></w:tcPr><w:p><w:pPr><w:spacing w:before=\"0\"" . |
||
560 | " w:after=\"0\" w:line=\"240\"/><w:ind w:right=\"0\" w:left=\"0\" w:firstLine=\"0\"/><w:jc w:val=\"l" . |
||
561 | "eft\"/><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Calibr" . |
||
562 | "i\"/><w:color w:val=\"auto\"/><w:spacing w:val=\"0\"/><w:position w:val=\"0\"/><w:sz w:val=\"22\"/><" . |
||
563 | "w:shd w:fill=\"auto\" w:val=\"clear\"/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii=\"Calibri\" w:h" . |
||
564 | "Ansi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Calibri\"/><w:color w:val=\"auto\"/><w:spacing w:val=" . |
||
565 | "\"0\"/><w:position w:val=\"0\"/><w:sz w:val=\"22\"/><w:shd w:fill=\"auto\" w:val=\"clear\"/></w:rPr>" . |
||
566 | "<w:t xml:space=\"preserve\">a2</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"1843\" w:type=\"dx" . |
||
567 | "a\"/><w:tcBorders><w:top w:val=\"single\" w:color=\"000000\" w:sz=\"4\"/><w:left w:val=\"single\" w:" . |
||
568 | "color=\"000000\" w:sz=\"4\"/><w:bottom w:val=\"single\" w:color=\"000000\" w:sz=\"4\"/><w:right w:va" . |
||
569 | "l=\"single\" w:color=\"000000\" w:sz=\"4\"/></w:tcBorders><w:shd w:color=\"000000\" w:fill=\"ffffff\"" . |
||
570 | " w:val=\"clear\"/><w:tcMar><w:left w:w=\"108\" w:type=\"dxa\"/><w:right w:w=\"108\" w:type=\"dxa\"/" . |
||
571 | "></w:tcMar><w:vAlign w:val=\"top\"/></w:tcPr><w:p><w:pPr><w:spacing w:before=\"0\" w:after=\"0\" w:l" . |
||
572 | "ine=\"240\"/><w:ind w:right=\"0\" w:left=\"0\" w:firstLine=\"0\"/><w:jc w:val=\"left\"/><w:rPr><w:rF" . |
||
573 | "onts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Calibri\"/><w:color w:val" . |
||
574 | "=\"auto\"/><w:spacing w:val=\"0\"/><w:position w:val=\"0\"/><w:sz w:val=\"22\"/><w:shd w:fill=\"auto" . |
||
575 | "\" w:val=\"clear\"/></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:" . |
||
576 | "cs=\"Calibri\" w:eastAsia=\"Calibri\"/><w:color w:val=\"auto\"/><w:spacing w:val=\"0\"/><w:position " . |
||
577 | "w:val=\"0\"/><w:sz w:val=\"22\"/><w:shd w:fill=\"auto\" w:val=\"clear\"/></w:rPr><w:t xml:space=\"pr" . |
||
578 | "eserve\">b2</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"5919\" w:type=\"dxa\"/><w:tcBorders><" . |
||
579 | "w:top w:val=\"single\" w:color=\"000000\" w:sz=\"4\"/><w:left w:val=\"single\" w:color=\"000000\" w:" . |
||
580 | "sz=\"4\"/><w:bottom w:val=\"single\" w:color=\"000000\" w:sz=\"4\"/><w:right w:val=\"single\" w:colo" . |
||
581 | "r=\"000000\" w:sz=\"4\"/></w:tcBorders><w:shd w:color=\"000000\" w:fill=\"ffffff\" w:val=\"clear\"/>" . |
||
582 | "<w:tcMar><w:left w:w=\"108\" w:type=\"dxa\"/><w:right w:w=\"108\" w:type=\"dxa\"/></w:tcMar><w:vAlig" . |
||
583 | "n w:val=\"top\"/></w:tcPr><w:p><w:pPr><w:spacing w:before=\"0\" w:after=\"0\" w:line=\"240\"/><w:ind" . |
||
584 | " w:right=\"0\" w:left=\"0\" w:firstLine=\"0\"/><w:jc w:val=\"left\"/><w:rPr><w:rFonts w:ascii=\"Cali" . |
||
585 | "bri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Calibri\"/><w:color w:val=\"auto\"/><w:spaci" . |
||
586 | "ng w:val=\"0\"/><w:position w:val=\"0\"/><w:sz w:val=\"22\"/><w:shd w:fill=\"auto\" w:val=\"clear\"/" . |
||
587 | "></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:ea" . |
||
588 | "stAsia=\"Calibri\"/><w:color w:val=\"auto\"/><w:spacing w:val=\"0\"/><w:position w:val=\"0\"/><w:sz " . |
||
589 | "w:val=\"22\"/><w:shd w:fill=\"auto\" w:val=\"clear\"/></w:rPr><w:t xml:space=\"preserve\">c2</w:t></" . |
||
590 | "w:r></w:p></w:tc></w:tr></w:tbl><w:p><w:pPr><w:spacing w:before=\"0\" w:after=\"200\" w:line=\"276\"" . |
||
591 | "/><w:ind w:right=\"0\" w:left=\"0\" w:firstLine=\"0\"/><w:jc w:val=\"left\"/><w:rPr><w:rFonts w:asci" . |
||
592 | "i=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Calibri\"/><w:color w:val=\"auto\"/>" . |
||
593 | "<w:spacing w:val=\"0\"/><w:position w:val=\"0\"/><w:sz w:val=\"22\"/><w:shd w:fill=\"auto\" w:val=\"" . |
||
594 | "clear\"/></w:rPr></w:pPr></w:p></w:body></w:document>\n" |
||
595 | ); |
||
596 | |||
597 | $this->assertEquals( |
||
598 | $reporter->getDocx()->getDocumentMainPart(), |
||
599 | "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:document xmlns:w=\"http://schemas.op" . |
||
600 | "enxmlformats.org/wordprocessingml/2006/main\"><w:body><w:tbl><w:tblPr /><w:tblGrid><w:gridCol w:w=\"" . |
||
601 | "1526\" /><w:gridCol w:w=\"1843\" /><w:gridCol w:w=\"5919\" /></w:tblGrid><w:tr><w:trPr><w:trHeight w" . |
||
602 | ":val=\"200\" w:hRule=\"auto\" /><w:jc w:val=\"left\" /></w:trPr><w:tc><w:tcPr><w:tcW w:w=\"1526\" w:" . |
||
603 | "type=\"dxa\" /><w:tcBorders><w:top w:val=\"single\" w:color=\"000000\" w:sz=\"4\" /><w:left w:val=\"" . |
||
604 | "single\" w:color=\"000000\" w:sz=\"4\" /><w:bottom w:val=\"single\" w:color=\"000000\" w:sz=\"4\" />" . |
||
605 | "<w:right w:val=\"single\" w:color=\"000000\" w:sz=\"4\" /></w:tcBorders><w:shd w:color=\"000000\" w:" . |
||
606 | "fill=\"ffffff\" w:val=\"clear\" /><w:tcMar><w:left w:w=\"108\" w:type=\"dxa\" /><w:right w:w=\"108\"" . |
||
607 | " w:type=\"dxa\" /></w:tcMar><w:vAlign w:val=\"top\" /></w:tcPr><w:p><w:pPr><w:spacing w:before=\"0\"" . |
||
608 | " w:after=\"0\" w:line=\"240\" /><w:ind w:right=\"0\" w:left=\"0\" w:firstLine=\"0\" /><w:jc w:val=\"" . |
||
609 | "left\" /><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Cali" . |
||
610 | "bri\" /><w:color w:val=\"auto\" /><w:spacing w:val=\"0\" /><w:position w:val=\"0\" /><w:sz w:val=\"2" . |
||
611 | "2\" /><w:shd w:fill=\"auto\" w:val=\"clear\" /></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii=\"Calib" . |
||
612 | "ri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Calibri\" /><w:color w:val=\"auto\" /><w:spac" . |
||
613 | "ing w:val=\"0\" /><w:position w:val=\"0\" /><w:sz w:val=\"22\" /><w:shd w:fill=\"auto\" w:val=\"clea" . |
||
614 | "r\" /></w:rPr><w:t xml:space=\"preserve\">A</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"1843\"" . |
||
615 | " w:type=\"dxa\" /><w:tcBorders><w:top w:val=\"single\" w:color=\"000000\" w:sz=\"4\" /><w:left w:va" . |
||
616 | "l=\"single\" w:color=\"000000\" w:sz=\"4\" /><w:bottom w:val=\"single\" w:color=\"000000\" w:sz=\"4\"" . |
||
617 | " /><w:right w:val=\"single\" w:color=\"000000\" w:sz=\"4\" /></w:tcBorders><w:shd w:color=\"000000\"" . |
||
618 | " w:fill=\"ffffff\" w:val=\"clear\" /><w:tcMar><w:left w:w=\"108\" w:type=\"dxa\" /><w:right w:w=\"1" . |
||
619 | "08\" w:type=\"dxa\" /></w:tcMar><w:vAlign w:val=\"top\" /></w:tcPr><w:p><w:pPr><w:spacing w:before=\"" . |
||
620 | "0\" w:after=\"0\" w:line=\"240\" /><w:ind w:right=\"0\" w:left=\"0\" w:firstLine=\"0\" /><w:jc w:va" . |
||
621 | "l=\"left\" /><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"" . |
||
622 | "Calibri\" /><w:color w:val=\"auto\" /><w:spacing w:val=\"0\" /><w:position w:val=\"0\" /><w:sz w:val" . |
||
623 | "=\"22\" /><w:shd w:fill=\"auto\" w:val=\"clear\" /></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii=\"C" . |
||
624 | "alibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Calibri\" /><w:color w:val=\"auto\" /><w:" . |
||
625 | "spacing w:val=\"0\" /><w:position w:val=\"0\" /><w:sz w:val=\"22\" /><w:shd w:fill=\"auto\" w:val=\"" . |
||
626 | "clear\" /></w:rPr><w:t xml:space=\"preserve\">B</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"5" . |
||
627 | "919\" w:type=\"dxa\" /><w:tcBorders><w:top w:val=\"single\" w:color=\"000000\" w:sz=\"4\" /><w:left " . |
||
628 | "w:val=\"single\" w:color=\"000000\" w:sz=\"4\" /><w:bottom w:val=\"single\" w:color=\"000000\" w:sz=" . |
||
629 | "\"4\" /><w:right w:val=\"single\" w:color=\"000000\" w:sz=\"4\" /></w:tcBorders><w:shd w:color=\"000" . |
||
630 | "000\" w:fill=\"ffffff\" w:val=\"clear\" /><w:tcMar><w:left w:w=\"108\" w:type=\"dxa\" /><w:right w:w" . |
||
631 | "=\"108\" w:type=\"dxa\" /></w:tcMar><w:vAlign w:val=\"top\" /></w:tcPr><w:p><w:pPr><w:spacing w:befo" . |
||
632 | "re=\"0\" w:after=\"0\" w:line=\"240\" /><w:ind w:right=\"0\" w:left=\"0\" w:firstLine=\"0\" /><w:jc " . |
||
633 | "w:val=\"left\" /><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsi" . |
||
634 | "a=\"Calibri\" /><w:color w:val=\"auto\" /><w:spacing w:val=\"0\" /><w:position w:val=\"0\" /><w:sz w" . |
||
635 | ":val=\"22\" /><w:shd w:fill=\"auto\" w:val=\"clear\" /></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii" . |
||
636 | "=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Calibri\" /><w:color w:val=\"auto\" /" . |
||
637 | "><w:spacing w:val=\"0\" /><w:position w:val=\"0\" /><w:sz w:val=\"22\" /><w:shd w:fill=\"auto\" w:va" . |
||
638 | "l=\"clear\" /></w:rPr><w:t xml:space=\"preserve\">C</w:t></w:r></w:p></w:tc></w:tr><w:tr><w:trPr><w:" . |
||
639 | "trHeight w:val=\"1\" w:hRule=\"atLeast\" /><w:jc w:val=\"left\" /></w:trPr><w:tc><w:tcPr><w:tcW w:w=" . |
||
640 | "\"9288\" w:type=\"dxa\" /><w:gridSpan w:val=\"3\" /><w:tcBorders><w:top w:val=\"single\" w:color=\"0" . |
||
641 | "00000\" w:sz=\"4\" /><w:left w:val=\"single\" w:color=\"000000\" w:sz=\"4\" /><w:bottom w:val=\"sing" . |
||
642 | "le\" w:color=\"000000\" w:sz=\"4\" /><w:right w:val=\"single\" w:color=\"000000\" w:sz=\"4\" /></w:t" . |
||
643 | "cBorders><w:shd w:color=\"000000\" w:fill=\"ffffff\" w:val=\"clear\" /><w:tcMar><w:left w:w=\"108\" " . |
||
644 | "w:type=\"dxa\" /><w:right w:w=\"108\" w:type=\"dxa\" /></w:tcMar><w:vAlign w:val=\"top\" /></w:tcPr>" . |
||
645 | "<w:p><w:pPr><w:spacing w:before=\"0\" w:after=\"0\" w:line=\"240\" /><w:ind w:right=\"0\" w:left=\"0" . |
||
646 | "\" w:firstLine=\"0\" /><w:jc w:val=\"left\" /><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri" . |
||
647 | "\" w:cs=\"Calibri\" w:eastAsia=\"Calibri\" /><w:color w:val=\"auto\" /><w:spacing w:val=\"0\" /><w:p" . |
||
648 | "osition w:val=\"0\" /><w:sz w:val=\"22\" /><w:shd w:fill=\"auto\" w:val=\"clear\" /></w:rPr></w:pPr>" . |
||
649 | "<w:r><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Calibri\"" . |
||
650 | " /><w:color w:val=\"auto\" /><w:spacing w:val=\"0\" /><w:position w:val=\"0\" /><w:sz w:val=\"22\" " . |
||
651 | "/><w:shd w:fill=\"auto\" w:val=\"clear\" /></w:rPr><w:t xml:space=\"preserve\">{%tr for record in re" . |
||
652 | "cords %}</w:t></w:r></w:p></w:tc></w:tr><w:tr><w:trPr><w:trHeight w:val=\"1\" w:hRule=\"atLeast\" />" . |
||
653 | "<w:jc w:val=\"left\" /></w:trPr><w:tc><w:tcPr><w:tcW w:w=\"1526\" w:type=\"dxa\" /><w:tcBorders><w:t" . |
||
654 | "op w:val=\"single\" w:color=\"000000\" w:sz=\"4\" /><w:left w:val=\"single\" w:color=\"000000\" w:sz" . |
||
655 | "=\"4\" /><w:bottom w:val=\"single\" w:color=\"000000\" w:sz=\"4\" /><w:right w:val=\"single\" w:colo" . |
||
656 | "r=\"000000\" w:sz=\"4\" /></w:tcBorders><w:shd w:color=\"000000\" w:fill=\"ffffff\" w:val=\"clear\" " . |
||
657 | "/><w:tcMar><w:left w:w=\"108\" w:type=\"dxa\" /><w:right w:w=\"108\" w:type=\"dxa\" /></w:tcMar><w:v" . |
||
658 | "Align w:val=\"top\" /></w:tcPr><w:p><w:pPr><w:spacing w:before=\"0\" w:after=\"0\" w:line=\"240\" />" . |
||
659 | "<w:ind w:right=\"0\" w:left=\"0\" w:firstLine=\"0\" /><w:jc w:val=\"left\" /><w:rPr><w:rFonts w:asci" . |
||
660 | "i=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Calibri\" /><w:color w:val=\"auto\" " . |
||
661 | "/><w:spacing w:val=\"0\" /><w:position w:val=\"0\" /><w:sz w:val=\"22\" /><w:shd w:fill=\"auto\" w:v" . |
||
662 | "al=\"clear\" /></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"" . |
||
663 | "Calibri\" w:eastAsia=\"Calibri\" /><w:color w:val=\"auto\" /><w:spacing w:val=\"0\" /><w:position w:" . |
||
664 | "val=\"0\" /><w:sz w:val=\"22\" /><w:shd w:fill=\"auto\" w:val=\"clear\" /></w:rPr><w:t xml:space=\"p" . |
||
665 | "reserve\">{{ record.a }}</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"1843\" w:type=\"dxa\" />" . |
||
666 | "<w:tcBorders><w:top w:val=\"single\" w:color=\"000000\" w:sz=\"4\" /><w:left w:val=\"single\" w:colo" . |
||
667 | "r=\"000000\" w:sz=\"4\" /><w:bottom w:val=\"single\" w:color=\"000000\" w:sz=\"4\" /><w:right w:val=" . |
||
668 | "\"single\" w:color=\"000000\" w:sz=\"4\" /></w:tcBorders><w:shd w:color=\"000000\" w:fill=\"ffffff\"" . |
||
669 | " w:val=\"clear\" /><w:tcMar><w:left w:w=\"108\" w:type=\"dxa\" /><w:right w:w=\"108\" w:type=\"dxa\"" . |
||
670 | " /></w:tcMar><w:vAlign w:val=\"top\" /></w:tcPr><w:p><w:pPr><w:spacing w:before=\"0\" w:after=\"0\" " . |
||
671 | "w:line=\"240\" /><w:ind w:right=\"0\" w:left=\"0\" w:firstLine=\"0\" /><w:jc w:val=\"left\" /><w:rPr" . |
||
672 | "><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Calibri\" /><w:colo" . |
||
673 | "r w:val=\"auto\" /><w:spacing w:val=\"0\" /><w:position w:val=\"0\" /><w:sz w:val=\"22\" /><w:shd w:" . |
||
674 | "fill=\"auto\" w:val=\"clear\" /></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"" . |
||
675 | "Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Calibri\" /><w:color w:val=\"auto\" /><w:spacing w:val=\"0\"" . |
||
676 | " /><w:position w:val=\"0\" /><w:sz w:val=\"22\" /><w:shd w:fill=\"auto\" w:val=\"clear\" /></w:rPr><" . |
||
677 | "w:t xml:space=\"preserve\">{{ record.b }}</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"5919\" " . |
||
678 | "w:type=\"dxa\" /><w:tcBorders><w:top w:val=\"single\" w:color=\"000000\" w:sz=\"4\" /><w:left w:val=" . |
||
679 | "\"single\" w:color=\"000000\" w:sz=\"4\" /><w:bottom w:val=\"single\" w:color=\"000000\" w:sz=\"4\" " . |
||
680 | "/><w:right w:val=\"single\" w:color=\"000000\" w:sz=\"4\" /></w:tcBorders><w:shd w:color=\"000000\" " . |
||
681 | "w:fill=\"ffffff\" w:val=\"clear\" /><w:tcMar><w:left w:w=\"108\" w:type=\"dxa\" /><w:right w:w=\"108" . |
||
682 | "\" w:type=\"dxa\" /></w:tcMar><w:vAlign w:val=\"top\" /></w:tcPr><w:p><w:pPr><w:spacing w:before=\"0" . |
||
683 | "\" w:after=\"0\" w:line=\"240\" /><w:ind w:right=\"0\" w:left=\"0\" w:firstLine=\"0\" /><w:jc w:val=" . |
||
684 | "\"left\" /><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Ca" . |
||
685 | "libri\" /><w:color w:val=\"auto\" /><w:spacing w:val=\"0\" /><w:position w:val=\"0\" /><w:sz w:val=\"" . |
||
686 | "22\" /><w:shd w:fill=\"auto\" w:val=\"clear\" /></w:rPr></w:pPr><w:r><w:rPr><w:rFonts w:ascii=\"Cal" . |
||
687 | "ibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Calibri\" /><w:color w:val=\"auto\" /><w:sp" . |
||
688 | "acing w:val=\"0\" /><w:position w:val=\"0\" /><w:sz w:val=\"22\" /><w:shd w:fill=\"auto\" w:val=\"cl" . |
||
689 | "ear\" /></w:rPr><w:t xml:space=\"preserve\">{{ record.c }}</w:t></w:r></w:p></w:tc></w:tr><w:tr><w:t" . |
||
690 | "rPr><w:trHeight w:val=\"1\" w:hRule=\"atLeast\" /><w:jc w:val=\"left\" /></w:trPr><w:tc><w:tcPr><w:t" . |
||
691 | "cW w:w=\"9288\" w:type=\"dxa\" /><w:gridSpan w:val=\"3\" /><w:tcBorders><w:top w:val=\"single\" w:co" . |
||
692 | "lor=\"000000\" w:sz=\"4\" /><w:left w:val=\"single\" w:color=\"000000\" w:sz=\"4\" /><w:bottom w:val" . |
||
693 | "=\"single\" w:color=\"000000\" w:sz=\"4\" /><w:right w:val=\"single\" w:color=\"000000\" w:sz=\"4\" " . |
||
694 | "/></w:tcBorders><w:shd w:color=\"000000\" w:fill=\"ffffff\" w:val=\"clear\" /><w:tcMar><w:left w:w=\"" . |
||
695 | "108\" w:type=\"dxa\" /><w:right w:w=\"108\" w:type=\"dxa\" /></w:tcMar><w:vAlign w:val=\"top\" /></" . |
||
696 | "w:tcPr><w:p><w:pPr><w:spacing w:before=\"0\" w:after=\"0\" w:line=\"240\" /><w:ind w:right=\"0\" w:l" . |
||
697 | "eft=\"0\" w:firstLine=\"0\" /><w:jc w:val=\"left\" /><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"" . |
||
698 | "Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Calibri\" /><w:color w:val=\"auto\" /><w:spacing w:val=\"0\"" . |
||
699 | " /><w:position w:val=\"0\" /><w:sz w:val=\"22\" /><w:shd w:fill=\"auto\" w:val=\"clear\" /></w:rPr><" . |
||
700 | "/w:pPr><w:r><w:rPr><w:rFonts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"C" . |
||
701 | "alibri\" /><w:color w:val=\"auto\" /><w:spacing w:val=\"0\" /><w:position w:val=\"0\" /><w:sz w:val=" . |
||
702 | "\"22\" /><w:shd w:fill=\"auto\" w:val=\"clear\" /></w:rPr><w:t xml:space=\"preserve\">{%tr endfor %}" . |
||
703 | "</w:t></w:r></w:p></w:tc></w:tr></w:tbl><w:p><w:pPr><w:spacing w:before=\"0\" w:after=\"200\" w:line" . |
||
704 | "=\"276\" /><w:ind w:right=\"0\" w:left=\"0\" w:firstLine=\"0\" /><w:jc w:val=\"left\" /><w:rPr><w:rF" . |
||
705 | "onts w:ascii=\"Calibri\" w:hAnsi=\"Calibri\" w:cs=\"Calibri\" w:eastAsia=\"Calibri\" /><w:color w:va" . |
||
706 | "l=\"auto\" /><w:spacing w:val=\"0\" /><w:position w:val=\"0\" /><w:sz w:val=\"22\" /><w:shd w:fill=\"" . |
||
707 | "auto\" w:val=\"clear\" /></w:rPr></w:pPr></w:p></w:body></w:document>" |
||
708 | ); |
||
709 | } |
||
710 | |||
711 | public function testImages(): void |
||
712 | { |
||
713 | $reporter = new PhpDocxTemplate(self::TEMPLATE8); |
||
714 | |||
715 | $reporter->render(["records" => [ |
||
716 | [ |
||
717 | "a" => "a1", |
||
718 | "b" => "b1", |
||
719 | "c" => "https://www.google.ru", |
||
720 | "d" => __DIR__ . "/images/planet1.png" |
||
721 | ], |
||
722 | [ |
||
723 | "a" => "a2", |
||
724 | "b" => "b2", |
||
725 | "c" => "https://yandex.ru/", |
||
726 | "d" => __DIR__ . "/images/planet2.png" |
||
727 | ], |
||
728 | [ |
||
729 | "a" => "a3", |
||
730 | "b" => "b2", |
||
731 | "c" => "https://mail.ru/", |
||
732 | "d" => __DIR__ . "/images/planet3.png" |
||
733 | ] |
||
734 | ]]); |
||
735 | |||
736 | $docName = "./tests/templates/image.docx"; |
||
737 | |||
738 | $reporter->save($docName); |
||
739 | |||
740 | $expectedDocumentZip = new ZipArchive(); |
||
741 | $expectedDocumentZip->open($docName); |
||
742 | $expectedContentTypesXml = $expectedDocumentZip->getFromName('[Content_Types].xml'); |
||
0 ignored issues
–
show
Unused Code
introduced
by
![]() |
|||
743 | $expectedDocumentRelationsXml = $expectedDocumentZip->getFromName('word/_rels/document.xml.rels'); |
||
0 ignored issues
–
show
|
|||
744 | $expectedMainPartXml = $expectedDocumentZip->getFromName('word/document.xml'); |
||
0 ignored issues
–
show
|
|||
745 | $expectedImage = $expectedDocumentZip->getFromName('word/media/image_rId5_document.png'); |
||
746 | if (false === $expectedDocumentZip->close()) { |
||
747 | throw new \Exception("Could not close zip file \"{$docName}\"."); |
||
748 | } |
||
749 | |||
750 | $this->assertNotEmpty($expectedImage, 'Embed image doesn\'t found.'); |
||
751 | } |
||
752 | |||
753 | public function testSections(): void |
||
754 | { |
||
755 | $reporter = new PhpDocxTemplate(self::TEMPLATE9); |
||
756 | /* $this->assertEquals( |
||
757 | $reporter->buildXml(["object" => "world"]), |
||
758 | "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" . |
||
759 | "<w:document xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" " . |
||
760 | "xmlns:cx=\"http://schemas.microsoft.com/office/drawing/2014/chartex\" " . |
||
761 | "xmlns:cx1=\"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex\" " . |
||
762 | "xmlns:cx2=\"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex\" " . |
||
763 | "xmlns:cx3=\"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex\" " . |
||
764 | "xmlns:cx4=\"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex\" " . |
||
765 | "xmlns:cx5=\"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex\" " . |
||
766 | "xmlns:cx6=\"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex\" " . |
||
767 | "xmlns:cx7=\"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex\" " . |
||
768 | "xmlns:cx8=\"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex\" " . |
||
769 | "xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" " . |
||
770 | "xmlns:aink=\"http://schemas.microsoft.com/office/drawing/2016/ink\" " . |
||
771 | "xmlns:am3d=\"http://schemas.microsoft.com/office/drawing/2017/model3d\" " . |
||
772 | "xmlns:o=\"urn:schemas-microsoft-com:office:office\" " . |
||
773 | "xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" " . |
||
774 | "xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" " . |
||
775 | "xmlns:v=\"urn:schemas-microsoft-com:vml\" " . |
||
776 | "xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" " . |
||
777 | "xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" " . |
||
778 | "xmlns:w10=\"urn:schemas-microsoft-com:office:word\" " . |
||
779 | "xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" " . |
||
780 | "xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" " . |
||
781 | "xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" " . |
||
782 | "xmlns:w16cid=\"http://schemas.microsoft.com/office/word/2016/wordml/cid\" " . |
||
783 | "xmlns:w16se=\"http://schemas.microsoft.com/office/word/2015/wordml/symex\" " . |
||
784 | "xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" " . |
||
785 | "xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" " . |
||
786 | "xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" " . |
||
787 | "xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" " . |
||
788 | "mc:Ignorable=\"w14 w15 w16se w16cid wp14\"><w:body><w:p w14:paraId=\"504F2588\" " . |
||
789 | "w14:textId=\"54DF26C8\" w:rsidR=\"0090657C\" w:rsidRPr=\"00FA3F61\" " . |
||
790 | "w:rsidRDefault=\"00FA3F61\" w:rsidP=\"00C13DD6\"><w:pPr><w:rPr><w:lang w:val=\"en-US\"/>" . |
||
791 | "</w:rPr></w:pPr><w:r><w:rPr><w:lang w:val=\"en-US\"/></w:rPr><w:t>Hello world!</w:t>" . |
||
792 | "</w:r><w:bookmarkStart w:id=\"0\" w:name=\"_GoBack\"/><w:bookmarkEnd w:id=\"0\"/></w:p>" . |
||
793 | "<w:sectPr w:rsidR=\"0090657C\" w:rsidRPr=\"00FA3F61\"><w:pgSz w:w=\"11906\" w:h=\"16838\"/>" . |
||
794 | "<w:pgMar w:top=\"1134\" w:right=\"850\" w:bottom=\"1134\" w:left=\"1701\" w:header=\"708\" " . |
||
795 | "w:footer=\"708\" w:gutter=\"0\"/><w:cols w:space=\"708\"/><w:docGrid w:linePitch=\"360\"/>" . |
||
796 | "</w:sectPr></w:body></w:document>\n" |
||
797 | );*/ |
||
798 | $docName = './doc9.docx'; |
||
799 | $reporter->render(["object" => "test", "section" => [["id" => "test section"]]]); |
||
800 | $reporter->save($docName); |
||
801 | // $reporter->close(); |
||
802 | |||
803 | $expectedDocumentZip = new ZipArchive(); |
||
804 | $expectedDocumentZip->open($docName); |
||
805 | $header = $expectedDocumentZip->getFromName('word/header2.xml'); |
||
806 | $this->assertEquals('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . PHP_EOL . |
||
807 | '<w:hdr xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" ' . |
||
808 | 'xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1=' . |
||
809 | '"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http:' . |
||
810 | '//schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://sche' . |
||
811 | 'mas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.micro' . |
||
812 | 'soft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/' . |
||
813 | 'office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/dra' . |
||
814 | 'wing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5' . |
||
815 | '/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex' . |
||
816 | '" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="h' . |
||
817 | 'ttp://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.micros' . |
||
818 | 'oft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office"' . |
||
819 | ' xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m' . |
||
820 | '="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-mic' . |
||
821 | 'rosoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessi' . |
||
822 | 'ngDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDr' . |
||
823 | 'awing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openx' . |
||
824 | 'mlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/offi' . |
||
825 | 'ce/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" ' . |
||
826 | 'xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="' . |
||
827 | 'http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16="http://schemas.mi' . |
||
828 | 'crosoft.com/office/word/2018/wordml" xmlns:w16sdtdh="http://schemas.microsoft.com/offi' . |
||
829 | 'ce/word/2020/wordml/sdtdatahash" xmlns:w16se="http://schemas.microsoft.com/office/word' . |
||
830 | '/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordproce' . |
||
831 | 'ssingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk' . |
||
832 | '" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://s' . |
||
833 | 'chemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 w15 w16se' . |
||
834 | ' w16cid w16 w16cex w16sdtdh wp14"><w:p w14:paraId="41482033" w14:textId="76B90B7C" w:r' . |
||
835 | 'sidR="0023643A" w:rsidRPr="008D02AA" w:rsidRDefault="0023643A" w:rsidP="008D02AA"><w:r' . |
||
836 | ' w:rsidRPr="008D02AA"><w:t xml:space="preserve">Opa </w:t></w:r><w:r w:rsidR="00AB4EBE' . |
||
837 | '" w:rsidRPr="00AB4EBE"><w:t>test section</w:t></w:r></w:p></w:hdr>', $header); |
||
838 | } |
||
839 | } |
||
840 |