Show last authors
1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
4
5 = I- Introduction =
6
7 (((
8 The "XMLToExcel" connector allows you to transform an XML file into an Excel file following a given format.
9 The connector uses the Apache POI library to perform the transformation.
10 )))
11
12 (((
13 Here is what you can do very easily (You can do much better by making the view much prettier 😊):
14 )))
15
16 (((
17
18 )))
19
20 [[image:1619519065381-729.png||height="220" width="664"]]
21
22
23 [[image:1619519086074-417.png]]
24
25 [[image:1619519092034-893.png]]
26
27 Let's get to the heart of the matter.
28
29
30 = II- Parameters & Templates =
31
32
33 == Parameters ==
34
35 {{{You will find the "XMLToExcel" connector in the connectors palette:}}}
36
37 [[image:1619519234897-825.png]]
38
39 {{{Here are the parameters of the "XMLToExcel" connector:
40 - Format: The format that specifies all the visual parameters of the document
41 - Template: A Template file can be specified pre-filled with images / shapes… ==> Parameter not required.
42 - File name: The name of the output file.
43 - Input file: The input must take the form's format.}}}
44
45 == [[image:1619519361984-295.png]] ==
46
47
48 == Templates ==
49
50 {{{The connector will be based on a Template if exist, otherwise it will create a new Excel file.
51 The Template parameter is optional.}}}
52
53
54 = III- 1st Example: File with a template containing datas =
55
56 == Template ==
57
58 Below the following Template: An Excel file with two sheets (Preamble and Jobs)
59
60 - Preamble :
61
62 [[image:1619519878302-168.png||height="282" width="709"]]
63
64
65 - Jobs :
66
67
68 [[image:1658745886978-898.png||height="242" width="605"]]
69
70
71 == **/! Important\** ==
72
73 {{{The new version of the XMLToExcel connector forces us to delete cells in the template before inserting data. The new version uses streaming's data and it use no resources (RAM - CPU...)
74
75 }}}
76
77
78 {{{The “Jobs” sheet contains a conditional display in the status and duration column:
79 - Status “OK” will be displayed in green
80 - Status “KO” will be displayed in red
81 - status “Warn” will be displayed in orange
82 - Time greater than 500 seconds will be displayed in red.}}}
83
84 == Output File ==
85
86 {{{In this example, we want to generate this Excel file : }}}
87
88 [[image:1619521020905-384.png||height="206" width="725"]]
89
90 And a filled data table :
91
92 [[image:1619521047676-484.png||height="314" width="723"]]
93
94 Datas will be inserted into the Excel file taking into account the initial format of the Template (including conditional display)
95
96
97 == File format ==
98
99 The format file used for this transformation :
100
101 {{code language="xml"}}
102
103 <iXDoc>
104 <styleSheet1 styleSheetName="Preamble" actif="true">
105 <Preambule type="table">
106 <Date beginLine="4">
107 <value column="E"></value>
108 </Date>
109 <Description>
110 <value column="E"></value>
111 </Description>
112 </Preambule>
113 </styleSheet1>
114 <styleSheet2 styleSheetName="Jobs" >
115 <Jobs type="table">
116 <Job beginLine="3">
117 <JOBID column="B" formatType="numeric" ></JOBID>
118 <DESCRIPTION></DESCRIPTION>
119 <DURATION formatType="numeric" ></DURATION>
120 <STARTDATE></STARTDATE>
121 <STATUSTYPEID formatType="numeric"></STATUSTYPEID>
122 </Job>
123 </Jobs>
124 </styleSheet2>
125 </iXDoc>
126
127 {{/code}}
128
129
130 == Input File ==
131
132
133 The input file used for this transformation is :
134
135 {{code language="xml"}}
136 <iXDoc>
137 <styleSheet1>
138 <Preambule>
139 <Date>
140 <value>27/04/2021</value>
141 </Date>
142 <Description>
143 <value>Generated dynamically</value>
144 </Description>
145 </Preambule>
146 </styleSheet1>
147 <styleSheet2>
148 <Jobs>
149 <Job>
150 <JOBID>227140</JOBID>
151 <DESCRIPTION>Session 227140 : FTP - R-LIV-076597601-3.XML</DESCRIPTION>
152 <DURATION>164</DURATION>
153 <STARTDATE>2021-01-20 13:13:01.0</STARTDATE>
154 <STATUSTYPEID>0</STATUSTYPEID>
155 </Job>
156 <Job>
157 <JOBID>227141</JOBID>
158 <DESCRIPTION>Received file : /R-LIV-076597601-3.XML' from : 'FML_REPORT</DESCRIPTION>
159 <DURATION>130</DURATION>
160 <STARTDATE>2021-01-20 13:13:01.0</STARTDATE>
161 <STATUSTYPEID>0</STATUSTYPEID>
162 </Job>…
163 </Jobs>…
164
165 {{/code}}
166
167
168 Note that those datas can be retrieved dynamically from a BDDToXML connector for instance.
169
170
171 == Format explanation ==
172
173 The file format and the input file begin with an iXDoc node, followed by "Sheet" type nodes. Each "Sheet" node must contain attribut: type = "Table" or type = "Chart", in the example above, we have the sheet "Preamble" which contains small tables. Here are the properties encountered:
174
175
176 (% style="margin-left:auto; margin-right:auto" %)
177 |=Properties|= Description|=Example
178 |styleSheetName|The name of the Excel document sheet, **mandatory value**. If the sheet does not exist, the connector created it with the name of the property|styleSheetName= " Preamble"
179 |actif|Designates whether the page should be active when opening the document or not.
180 This property only exists for "sheet" type tags (which have the "styleSheetName" attribute)|Actif = "true"
181 |type|The type of the sheet element, either "table" or "chart"|(((
182 Type= "table"
183
184 Type= "chart"
185 )))
186 |beginLine|The start line on the chosen sheet|beginLine="4"
187 |column|The start column (in letters)|column= "B"
188 |formatType|The format type of the file's cell|formatType= "numeric"
189
190 = IV- Example 2 : File with a template containing data and graphs =
191
192 == Template ==
193
194 In this part, we want to create a simple Excel file with graphs. Here are the Templates we want to have:
195
196 - "charts" sheet: which contains charts created by the iXPath connector.
197
198 - "datas" sheet: which  contains the appropriate datas.
199
200 [[image:1619522412969-991.png]]
201
202 == OutputFile ==
203
204 The "Charts" sheet:
205
206 [[image:1619522453939-314.png]]
207
208
209 The "Datas" sheet :
210
211 [[image:1619522483742-898.png]]
212
213 == ==
214
215 == File format ==
216
217 {{code language="xml"}}
218 <?xml version="1.0" encoding="UTF-8"?>
219 <iXDoc>
220 <styleSheet1 styleSheetName="datas">
221 <Exemples type="table">
222 <Header beginLine="5">
223 <Date1 column="C" bold="true" color="red" ></Date1>
224 <Date2 column="D" bold="true" color="red" ></Date2>
225 <Date3 column="E" bold="true" color="red" ></Date3>
226 <Date4 column="F" bold="true" color="red" ></Date4>
227 <Date5 column="G" bold="true" color="red" ></Date5>
228 <Date6 column="H" bold="true" color="red" ></Date6>
229 </Header>
230
231 <exemple>
232 <Date1 column="C" formatType="numeric" ></Date1>
233 <Date2 column="D" formatType="numeric" ></Date2>
234 <Date3 column="E" formatType="numeric" ></Date3>
235 <Date4 column="F" formatType="numeric" ></Date4>
236 <Date5 column="G" formatType="numeric" ></Date5>
237 <Date6 column="H" formatType="numeric" ></Date6>
238 </exemple>
239
240 </Exemples>
241 <Exemples2 type="table">
242
243 <Header2 beginLine="5">
244 <Date12 column="J" bold="true" color="red" ></Date12>
245 <Date22 bold="true" color="red" ></Date22>
246 <Date32 bold="true" color="red" ></Date32>
247 </Header2>
248 <exemple2>
249 <Date12 column="J" formatType="numeric" ></Date12>
250 <Date22 formatType="numeric" ></Date22>
251 <Date32 formatType="numeric" ></Date32>
252 </exemple2>
253
254 </Exemples2>
255 </styleSheet1>
256
257 <styleSheet2 styleSheetName="charts" actif="true">
258 <chart1 type="chart" AreaRange="3-17-B-I" sheet="datas" chartType="LINE3D" horizontal="true" bottomAxisTitle="Dates" leftAxisTitle="flows type" legend="Number of flows per day (LINE)" ></chart1>
259
260 <chart2 type="chart" AreaRange="3-17-J-Q" sheet="datas" chartType="BAR3D" horizontal="true" bottomAxisTitle="Dates" stacked="true" leftAxisTitle="flows type" legend="Number of flows per day (BAR)" ></chart2>
261
262 <chart3 type="chart" AreaRange="3-17-R-Y" sheet="datas" chartType="PIE3D" bottomAxisTitle="" leftAxisTitle="" legend="Number of flows per TYPE (SCATTER)" stacked="true" ></chart3>
263
264 </styleSheet2>
265 </iXDoc>
266
267
268 {{/code}}
269
270
271 == Input file ==
272
273 {{code language="xml"}}
274 <?xml version="1.0" encoding="UTF-8"?>
275 <iXDoc>
276 <styleSheet1>
277 <Exemples>
278 <Header>
279 <Date1>10/04/2021</Date1>
280 <Date2>11/04/2021</Date2>
281 <Date3>12/04/2021</Date3>
282 <Date4>13/04/2021</Date4>
283 <Date5>14/04/2021</Date5>
284 <Date6>15/04/2021</Date6>
285 </Header>
286 <exemple>
287 <Date1>1033</Date1>
288 <Date2>1042</Date2>
289 <Date3>900</Date3>
290 <Date4>1313</Date4>
291 <Date5>1502</Date5>
292 <Date6>1432</Date6>
293 </exemple>
294 <exemple>
295 <Date1>801</Date1>
296 <Date2>743</Date2>
297 <Date3>1032</Date3>
298 <Date4>802</Date4>
299 <Date5>998</Date5>
300 <Date6>1203</Date6>
301 </exemple>
302 <exemple>
303 <Date1>1203</Date1>
304 <Date2>902</Date2>
305 <Date3>1320</Date3>
306 <Date4>730</Date4>
307 <Date5>1503</Date5>
308 <Date6>1094</Date6>
309 </exemple>
310 </Exemples>
311
312 <Exemples2>
313 <Header2>
314 <Date12>INVOICE</Date12>
315 <Date22>ORDER</Date22>
316 <Date32>DESADV</Date32>
317 </Header2>
318 <exemple2>
319 <Date12>4670</Date12>
320 <Date22>3780</Date22>
321 <Date32>5490</Date32>
322 </exemple2>
323 </Exemples2>
324
325 </styleSheet1>
326 <styleSheet2>
327 <chart1 keysRange="5-5-C-H" valuesRange="6-6-C-H:7-7-C-H:8-8-C-H" aliasValue="INVOICE:ORDER:DESADV" ></chart1>
328 <chart2 keysRange="5-5-C-H" valuesRange="6-6-C-H:7-7-C-H:8-8-C-H" aliasValue="INVOICE:ORDER:DESADV" ></chart2>
329 <chart3 keysRange="5-5-C-H" valuesRange="6-6-C-H:7-7-C-H:8-8-C-H" aliasValue="INVOICE:ORDER:DESADV" ></chart3>
330 </styleSheet2>
331
332 </iXDoc>
333
334
335
336 {{/code}}
337
338
339 == Format explanation ==
340
341 (% style="margin-left:auto; margin-right:auto" %)
342 |**Properties**|**Description **|**Example**
343 |bold|The "bold" property can be applied to a column of data to make the style of the cell bold|bold= "true"
344 |color|Change a color of a cell|color = "red"
345 |italic|The "italic" property can be applied to a column of data to make the style of the cell in italic|italic= "true"
346 |AreaRange|The range of the graph position.
347 Example: AreaRange = "3-17-J-Q"  Means that the graph must be positioned from the 3rd row to the 17th row, and from column J to column Q|AreaRange="3-17-J-Q"
348 |sheet|The sheet where the chart data is located|Sheet = "Datas"
349 |chartType|
350 The types of the graph, here is the exhaustive list:
351 - PIE
352 - PIE3D
353 - LINE
354 - LINE3D
355 - BAR (Stacked, unstacked, horizontal / vertical)
356 - BAR3D (Stacked, unstacked, horizontal / vertical)
357 - AREA
358 - SCATTER
359 - RADAR|chartType="LINE3D"
360 |horizontal|Applicable for the Bar & BAR3D type graph, this makes the graph horizontal, by default the graph is vertical|horizontal="true"
361 |bottomAxisTitle|The wording of the x-axis|bottomAxisTitle="Dates"
362 |leftAxisTitle|The label of the y-axis|leftAxisTitle="Flows"
363 |legend|The legend of the graph|legend="Number of flows per TYPE (SCATTER)"
364 |Stacked|Application for the BAR & BAR3D type graph, this makes the graph stored on a single column. "False" is the default.|stacked="true"
365
366 == Input File explanation ==
367
368
369 (% style="margin-left:auto; margin-right:auto" %)
370 |**Properties**|**Description **|**Example**
371 |keysRange|The range (The position) of the data keys.Example: keysRange = "5-5-C-H" ==> it Means the data keys are in the 5th row and from column C to column H.|keysRange="5-5-C-H"
372 |valuesRange|The range of data values ​​(Separated by ":" if several types of data exist).|valuesRange="6-6-C-H:7-7-C-H:8-8-C-H"
373 |aliasValue|Label of the traces, the number of labels must be the same as the number of the row of data.|aliasValue="INVOICE:ORDER:DESADV"
374 |hide|Hide a row in the Excel sheet|<exemple Hide="true"/>
375
376
This wiki is hosted and managed by iXPath
Powered by XWiki 13.3 debian