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 [[image:1619520073569-407.png||height="291" width="721"]]
68
69
70 {{{The “Jobs” sheet contains a conditional display in the status and duration column:
71 - Status “OK” will be displayed in green
72 - Status “KO” will be displayed in red
73 - status “Warn” will be displayed in orange
74 - Time greater than 500 seconds will be displayed in red.}}}
75
76 == Output File ==
77
78 {{{In this example, we want to generate this Excel file : }}}
79
80 [[image:1619521020905-384.png||height="206" width="725"]]
81
82 And a filled data table :
83
84 [[image:1619521047676-484.png||height="314" width="723"]]
85
86 Datas will be inserted into the Excel file taking into account the initial format of the Template (including conditional display)
87
88
89 == File format ==
90
91 The format file used for this transformation :
92
93 {{code language="xml"}}
94
95 <iXDoc>
96 <styleSheet1 styleSheetName="Preamble" actif="true">
97 <Preambule type="table">
98 <Date beginLine="4">
99 <value column="E"></value>
100 </Date>
101 <Description>
102 <value column="E"></value>
103 </Description>
104 </Preambule>
105 </styleSheet1>
106 <styleSheet2 styleSheetName="Jobs" >
107 <Jobs type="table">
108 <Job beginLine="3">
109 <JOBID column="B" formatType="numeric" ></JOBID>
110 <DESCRIPTION></DESCRIPTION>
111 <DURATION formatType="numeric" ></DURATION>
112 <STARTDATE></STARTDATE>
113 <STATUSTYPEID formatType="numeric"></STATUSTYPEID>
114 </Job>
115 </Jobs>
116 </styleSheet2>
117 </iXDoc>
118
119 {{/code}}
120
121
122 == Input File ==
123
124
125 The input file used for this transformation is :
126
127 {{code language="xml"}}
128 <iXDoc>
129 <styleSheet1>
130 <Preambule>
131 <Date>
132 <value>27/04/2021</value>
133 </Date>
134 <Description>
135 <value>Generated dynamically</value>
136 </Description>
137 </Preambule>
138 </styleSheet1>
139 <styleSheet2>
140 <Jobs>
141 <Job>
142 <JOBID>227140</JOBID>
143 <DESCRIPTION>Session 227140 : FTP - R-LIV-076597601-3.XML</DESCRIPTION>
144 <DURATION>164</DURATION>
145 <STARTDATE>2021-01-20 13:13:01.0</STARTDATE>
146 <STATUSTYPEID>0</STATUSTYPEID>
147 </Job>
148 <Job>
149 <JOBID>227141</JOBID>
150 <DESCRIPTION>Received file : /R-LIV-076597601-3.XML' from : 'FML_REPORT</DESCRIPTION>
151 <DURATION>130</DURATION>
152 <STARTDATE>2021-01-20 13:13:01.0</STARTDATE>
153 <STATUSTYPEID>0</STATUSTYPEID>
154 </Job>…
155 </Jobs>…
156
157 {{/code}}
158
159
160 Note that those datas can be retrieved dynamically from a BDDToXML connector for instance.
161
162
163 == Format explanation ==
164
165 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:
166
167
168 (% style="margin-left:auto; margin-right:auto" %)
169 |=Properties|= Description|=Example
170 |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"
171 |actif|Designates whether the page should be active when opening the document or not.
172 This property only exists for "sheet" type tags (which have the "styleSheetName" attribute)|Actif = "true"
173 |type|The type of the sheet element, either "table" or "chart"|(((
174 Type= "table"
175
176 Type= "chart"
177 )))
178 |beginLine|The start line on the chosen sheet|beginLine="4"
179 |column|The start column (in letters)|column= "B"
180 |formatType|The format type of the file's cell|formatType= "numeric"
181
182 = IV- Example 2 : File with a template containing data and graphs =
183
184 == Template ==
185
186 In this part, we want to create a simple Excel file with graphs. Here are the Templates we want to have:
187
188 - "charts" sheet: which contains charts created by the iXPath connector.
189
190 - "datas" sheet: which  contains the appropriate datas.
191
192 [[image:1619522412969-991.png]]
193
194 == OutputFile ==
195
196 The "Charts" sheet:
197
198 [[image:1619522453939-314.png]]
199
200
201 The "Datas" sheet :
202
203 [[image:1619522483742-898.png]]
204
205 == ==
206
207 == File format ==
208
209 {{code language="xml"}}
210 <?xml version="1.0" encoding="UTF-8"?>
211 <iXDoc>
212 <styleSheet1 styleSheetName="datas">
213 <Exemples type="table">
214 <Header beginLine="5">
215 <Date1 column="C" bold="true" color="red" ></Date1>
216 <Date2 column="D" bold="true" color="red" ></Date2>
217 <Date3 column="E" bold="true" color="red" ></Date3>
218 <Date4 column="F" bold="true" color="red" ></Date4>
219 <Date5 column="G" bold="true" color="red" ></Date5>
220 <Date6 column="H" bold="true" color="red" ></Date6>
221 </Header>
222
223 <exemple>
224 <Date1 column="C" formatType="numeric" ></Date1>
225 <Date2 column="D" formatType="numeric" ></Date2>
226 <Date3 column="E" formatType="numeric" ></Date3>
227 <Date4 column="F" formatType="numeric" ></Date4>
228 <Date5 column="G" formatType="numeric" ></Date5>
229 <Date6 column="H" formatType="numeric" ></Date6>
230 </exemple>
231
232 </Exemples>
233 <Exemples2 type="table">
234
235 <Header2 beginLine="5">
236 <Date12 column="J" bold="true" color="red" ></Date12>
237 <Date22 bold="true" color="red" ></Date22>
238 <Date32 bold="true" color="red" ></Date32>
239 </Header2>
240 <exemple2>
241 <Date12 column="J" formatType="numeric" ></Date12>
242 <Date22 formatType="numeric" ></Date22>
243 <Date32 formatType="numeric" ></Date32>
244 </exemple2>
245
246 </Exemples2>
247 </styleSheet1>
248
249 <styleSheet2 styleSheetName="charts" actif="true">
250 <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>
251
252 <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>
253
254 <chart3 type="chart" AreaRange="3-17-R-Y" sheet="datas" chartType="PIE3D" bottomAxisTitle="" leftAxisTitle="" legend="Number of flows per TYPE (SCATTER)" stacked="true" ></chart3>
255
256 </styleSheet2>
257 </iXDoc>
258
259
260 {{/code}}
261
262
263 == Input file ==
264
265 {{code language="xml"}}
266 <?xml version="1.0" encoding="UTF-8"?>
267 <iXDoc>
268 <styleSheet1>
269 <Exemples>
270 <Header>
271 <Date1>10/04/2021</Date1>
272 <Date2>11/04/2021</Date2>
273 <Date3>12/04/2021</Date3>
274 <Date4>13/04/2021</Date4>
275 <Date5>14/04/2021</Date5>
276 <Date6>15/04/2021</Date6>
277 </Header>
278 <exemple>
279 <Date1>1033</Date1>
280 <Date2>1042</Date2>
281 <Date3>900</Date3>
282 <Date4>1313</Date4>
283 <Date5>1502</Date5>
284 <Date6>1432</Date6>
285 </exemple>
286 <exemple>
287 <Date1>801</Date1>
288 <Date2>743</Date2>
289 <Date3>1032</Date3>
290 <Date4>802</Date4>
291 <Date5>998</Date5>
292 <Date6>1203</Date6>
293 </exemple>
294 <exemple>
295 <Date1>1203</Date1>
296 <Date2>902</Date2>
297 <Date3>1320</Date3>
298 <Date4>730</Date4>
299 <Date5>1503</Date5>
300 <Date6>1094</Date6>
301 </exemple>
302 </Exemples>
303
304 <Exemples2>
305 <Header2>
306 <Date12>INVOICE</Date12>
307 <Date22>ORDER</Date22>
308 <Date32>DESADV</Date32>
309 </Header2>
310 <exemple2>
311 <Date12>4670</Date12>
312 <Date22>3780</Date22>
313 <Date32>5490</Date32>
314 </exemple2>
315 </Exemples2>
316
317 </styleSheet1>
318 <styleSheet2>
319 <chart1 keysRange="5-5-C-H" valuesRange="6-6-C-H:7-7-C-H:8-8-C-H" aliasValue="INVOICE:ORDER:DESADV" ></chart1>
320 <chart2 keysRange="5-5-C-H" valuesRange="6-6-C-H:7-7-C-H:8-8-C-H" aliasValue="INVOICE:ORDER:DESADV" ></chart2>
321 <chart3 keysRange="5-5-C-H" valuesRange="6-6-C-H:7-7-C-H:8-8-C-H" aliasValue="INVOICE:ORDER:DESADV" ></chart3>
322 </styleSheet2>
323
324 </iXDoc>
325
326
327
328 {{/code}}
329
330
331 == Format explanation ==
332
333 (% style="margin-left:auto; margin-right:auto" %)
334 |**Properties**|**Description **|**Example**
335 |bold|The "bold" property can be applied to a column of data to make the style of the cell bold|bold= "true"
336 |color|Change a color of a cell|color = "red"
337 |italic|The "italic" property can be applied to a column of data to make the style of the cell in italic|italic= "true"
338 |AreaRange|The range of the graph position.
339 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"
340 |sheet|The sheet where the chart data is located|Sheet = "Datas"
341 |chartType|
342 The types of the graph, here is the exhaustive list:
343 - PIE
344 - PIE3D
345 - LINE
346 - LINE3D
347 - BAR (Stacked, unstacked, horizontal / vertical)
348 - BAR3D (Stacked, unstacked, horizontal / vertical)
349 - AREA
350 - SCATTER
351 - RADAR|chartType="LINE3D"
352 |horizontal|Applicable for the Bar & BAR3D type graph, this makes the graph horizontal, by default the graph is vertical|horizontal="true"
353 |bottomAxisTitle|The wording of the x-axis|bottomAxisTitle="Dates"
354 |leftAxisTitle|The label of the y-axis|leftAxisTitle="Flows"
355 |legend|The legend of the graph|legend="Number of flows per TYPE (SCATTER)"
356 |Stacked|Application for the BAR & BAR3D type graph, this makes the graph stored on a single column. "False" is the default.|stacked="true"
357
358 == Input File explanation ==
359
360
361 (% style="margin-left:auto; margin-right:auto" %)
362 |**Properties**|**Description **|**Example**
363 |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"
364 |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"
365 |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"
366 |hide|Hide a row in the Excel sheet|<exemple Hide="true"/>
367
368
This wiki is hosted and managed by iXPath
Powered by XWiki 13.3 debian