This article will demonstrate how to import a Dataset produced from XML in Lasernet, and export this as Excel output. You will need to first create a Dataset file, see the following article How do I create a Dataset in Lasernet?
Ensure that the Dataset XML grab has a Parent Table, which should appear in your Dataset like the layout in the image below:
The presence of Parent table will affect the eventual output in Excel. This is because there are two reference points for the Excel Form. The following image shows the output of Fields in Excel when the Data Member and Detail point at the same table level (No Parent Table). As you can see the data rows will split into different workbooks
For this scenario we will use the following layout as our data, with SaleOrder as our Parent:
1. Under the Form option, create a Form and then select XLSX as the Output Format. The Input Format will then automatically select the option Dataset.
3. Once the Form is created, ensure that the Toolbar can be seen from the top. If the Toolbar buttons cannot be viewed, right-click and select which of them should be displayed on the interface.
4. Open you Dataset grab (Form > Select Grab File(s) option) and select your dataset data. Then select a large area to be the Detail area in the spreadsheet. Then click the Detail button on the Toolbar at the top and the specified area will become the Detail Range.
Lasernet should now appear as follows:
5. It is now necessary to select the Data Member for the Detail Range. The Parent Table SalesOrder will be used here as the Data Member for the Detail Range.
6. A Header or Footer can be added to the Detail Range. To do this, select the area above the Detail Range and click on the Header button.
The Header should now look like this:
7. We’ll now return to our Main Detail. Select an area to be used for the Table within Detail. In this example, the Items Table will be used. When the selected area has been specified, click on the Master Detail and select Detail Level, creating DetailLevel0.
8. DetailsLevel0 will now need to be associated with the Items Table. To do this, click on Master Detail and select Data Member to specify the desired table.
9. After the correct Data Member has been assigned to DetailLevel0, we will then select the fields for Items. Select cell F7 and then double-click on Value. It should look like this:
10. Now, the same process must be followed for the other columns. The columns in the spreadsheet can be adjusted as needed to correctly display the cell contents.
11. Titles can also now be added to the top of the fields.
12. The text can also be centered. To do this, select the rows for the titles and then click the Center button, as shown below:
14. The background colors of the cells can be changed by selecting the desired cells to color and clicking on Fill.
All of these options allow for extensive customization of the Excel output. To see how the output of the Excel document will appear, select Preview on the top-left of the Toolbar. If the Preview shows multiple Excel Workbooks, then review the Data Member selection.