The "Generate/Update a Word file" action allows the creation of documents quite easily. In the past, we stumbled upon some challenges:
During the last partner day, Daniel Krüger gave me a look at how they use the Aspose Template Syntax. Have a quick look at the possibilities of the template syntax and become a big fan of it as I did.
Beginning of this year, we did a PoC and the first version of an SDK action. We decided to use JSON as a datasource, as in our opinion it offers the most versatile usage.
For most users, more complex JSON structures, e.g. with one-to-many relations, will be a challenging task. So we decided to add a JSON-builder, that generates the structure based on the form fields. It is quite simple, but it also groups fields to its nearest grouping element (group, tab). Also, item lists, data tables, and data rows are supported. For most scenarios, this should be sufficient.
In addition, you can still create your own JSON, by whatever means you prefer.
Here is a simple example of how the template syntax looks like and the resulting output based on the JSON that has been generated by the JSON-builder
{
"Hersteller": {
"Hersteller": {
"ID": "539",
"DisplayName": "Musterfirma",
"Translations": [
]
},
"Strassennummer": "28",
"Strasse": "Mustergasse",
"Zusatz": "",
"PLZ": "1234",
"Land": {
"ID": "0f865973-11c9-4762-bf0c-839d2be05d89",
"DisplayName": "Österreich",
"Translations": [
]
},
"Ort": "Münster",
"Firmenname": "Musterfirma"
},
"Produkt": {
"Beschreibung_DE": "",
"Untergruppe": {
"ID": "4653778a-fbb2-44dc-b866-0c59844f025f",
"DisplayName": "",
"Translations": [
{
"LanguageCode": "de-de",
"Value": "Dach - Blechprofile"
},
{
"LanguageCode": "fr-fr",
"Value": "Toiture - Profilés en tôle"
},
{
"LanguageCode": "it-it",
"Value": "Dach - Blechprofile"
}
]
},
"Anwendungstext_DE": "<p style="text-align: center;"><span style="font-size: 16pt;">Demo</span></p><p style="text-align: left;"><br />Test mit <strong>Richtext und <span style="color: #e03e2d;">Formatierung</span></strong></p><p> </p><p style="text-align: center;"><span style="color: #333333;">Zentiert</span></p><p style="text-align: center;"> </p><p style="text-align: right;"><span style="color: #333333;">Rechtsbündig</span></p>",
"Produktname_DE": "test",
}
}
The Aspose template syntax does not allow using names with whitespace characters. So we replace whitespace by "_" and also remove "/".
E.g.
The fieldname "Produktname DE" becomes "Produktname_D".
So it can be used in the template as <<[Produkt.Produktname_DE]>>
By using the Add-In, we
The SDK custom action has two configuration sections, one for the input and one for the output
The code for the SDK action is available on Nexplore Github.
Feel free to download, add the license file, compile, and use it!