Microsoft Excel Writer
The Microsoft Excel Writer converts an XML document with a specific table structure to a Microsoft Excel file (in the XLS format Excel 97 - 2003 or in the XML-based OOXML format .xlsx ) or populates an existing Excel file (in the XLS format Excel 97 - 2003 or in the XML-based OOXML format .xlsx) with data from an XML document with a specific table structure.
Properties
| Describes which operation the adapter performs. Possible values:
|
Parameters
|
Adapter main class (do not change!) Possible values: de.softproject.integration.adapter.excel.ExcelWriter: Main class (Default) |
| Defines the Excel file format (Microsoft Excel 97 – 2003 or OOXML). Possible values:
|
| URL to the Excel template (if the Operation property is set to Possible values:
|
| Defines whether formulas are recalculated and field values are updated before saving. Possible values:
|
Status values
| The operation was executed successfully |
| The operation failed due to a technical error. |
Input
Depending on the selected operation, the adapter expects a specific input structure:
Create Spreadsheet operation
For this operation, the adapter expects the following XML structure, which corresponds to the structure of (X)HTML tables. The <table> element creates a table sheet, each <tr> element creates a new table row, and each <td> element creates a new cell or <th> creates a head cell. If multiple spreadsheets are to be created, the <table> elements must be enclosed by a root element with any name.
Notes:
The name of the table specified by the
nameattribute in the<table>element can be a maximum of 31 characters long.The formatting of the individual cells can be controlled via various attributes. These are explained in the Possible attributes section.
With the
forceString="true"attribute, the content is not interpreted as a number or date, but written directly into the Excel document.Example: Without the
forceString="true"attribute,008.07300will be interpreted as the number8.073in the Excel document. With theforceString="true"attribute, the value is interpreted as a string and008.07300is written into the Excel document.
Example input for Create Spreadsheet operation
<?xml version="1.0" encoding="UTF-8"?>
<root>
<table name="Name of the first spreadsheet">
<tr autofit="true" height="10">
<th fontHeight="12" forceString="true" autofit="true" bold="true">Header1</th>
<th fontHeight="12" forceString="true" autofit="true" bold="true">Header2</th>
</tr>
<tr>
<td>Value1</td>
<td>Value11</td>
</tr>
<tr>
<td>Value2</td>
<td>Value22</td>
</tr>
<tr>
<td>Value3</td>
<td>Value33</td>
</tr>
</table>
</root>
Fill Template operation
The adapter expects the following XML input structure for this operation: In the optional templateURL=".." attribute, you can define a valid URL to a template file, e.g. templateUrl="file:///C:/Template.xlsx". This setting overrides the value of the TemplateURL adapter parameter. Each <cell> element corresponds to a cell in the table. For row and column numbers, if applicable, the count starts at 0.
Note:
The formatting of the individual cells can be controlled via various attributes. These are explained in the Possible attributes section.
Example input for the Fill Template operation
<TemplateFill templateUrl="URL to template file">
<cell sheet = "Name of the spreadsheet"
row = "Row number"
col = "Column ID "
value = "Cell content"
formatNumber = "Format number"
wrapText="true"/>
</TemplateFill>
Possible attributes
The formatting of each cell can be controlled by the following attributes:
Attribute | Description |
|---|---|
| Number format Note: If required, user-defined number formats can also be defined. Known formatting issue: The possible values correspond to the formatting options available in Excel. If you select one of the number values Possible values:
|
| Font, e.g. |
| Horizontal alignment of the text within the cell Possible values:
|
| Vertical alignment of the text within the cell Possible values:
|
| Font size |
| Font color Possible values:
|
| Bold font Possible values:
|
| Italic font Possible values:
|
| Type of underscore Possible values:
|
| Fill color of the cell Possible values:
|
| Type of cell frame Possible values:
|
| Color of the cell frame Possible values:
|
| Text alignment Possible values:
|
|
This attribute is optional. Allow automatic line wrapping in cells Possible values:
|
|
This attribute is optional. Automatically adjust column width Notes on setting the attribute:
Possible values:
|
|
This attribute is optional. Define fixed column width Note: If the Notes on setting the attribute:
Possible values: Number between 0 and 255 If the defined number is greater than |
|
This attribute is optional. Define row height Note: Excel only applies automatic height adjustment with the Notes on setting the attribute:
Possible values: Number between 0 and 409 If the defined number is greater than |