An opinionated solution for creating documents from JSON objects (API payloads) based on Word templates and Excel formula configuration.
Create Word documents and HTML pages by combining Word templates (documents with content controls) and JSON data via transformations defined as Excel formulas.
- Try the quickstart to create a document in four steps.
- View the API documentation
Given the data
{
"x1": 10,
"x2": 2,
"x3": { "firstname": "john", "surname": "smith" },
"x4": [100, 200, 300, 400],
"x5": {
"y1": "A quick brown fox jumps over the lazy dog",
"y2": "brown",
"y3": "#red#",
"y4": [ 1, 2, 3]
}
}
we can evaluate the following expressions
expression | result (in el-GR culture) |
---|---|
8 / 2 * (2 + 2) |
16 |
x1 * x2 - x1 / x2 |
15 |
CONCATENATE(x3.firstname, " ", x3.surname) |
john smith |
SUM(x4) * 24% |
240,00 |
x4 |
['100','200','300','400'] |
PROPER(REPLACE(x5.y1, SEARCH(x5.y2, x5.y1), LEN(x5.y2), x5.y3)) |
A Quick #Red# Fox Jumps Over The Lazy Dog |
IF(x1 + IFNA(missing.path, x2) > 10, ">10", "<=10") |
>10 |
DATE(2020, 4, 28) + x5.y4[1] |
30/4/2020 |
IF(__A1 > __A2, UPPER(__A3), "?") |
JOHN SMITH |
See the full list of supported Excel functions. Suggest the implementation of missing functions by opening an issue.
You can test it live here.
TBD
- ASP.NET Core
- Open XML SDK - to generate documents and extract content from Word and Excel files
- Open XML PowerTools - to convert Word documents to HTML/CSS
Contributions are welcome. Please contact the project maintainer.
For the versions available, see the tags on this repository.
- Panos - Initial work - pkokki
This project is licensed under the MIT License - see the LICENSE.TXT file for details
- Tim Hall, JSON conversion and parsing for VBA
- E. W. Bachtal, Excel Formula Parsing in C#
- Eric White, Open XML PowerTools