Skip to content

pkokki/DocumentCreator

Repository files navigation

Document Creator

An opinionated solution for creating documents from JSON objects (API payloads) based on Word templates and Excel formula configuration.

.NET Core GitHub tag (latest by date) GitHub commits since latest release (by date including pre-releases) GitHub code size in bytes GitHub issues

Getting Started

Create Word documents and HTML pages by combining Word templates (documents with content controls) and JSON data via transformations defined as Excel formulas.

Transformation examples

Nuget

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.

Installation

TBD

Built with

API

Web client

Tests

Contributing

Contributions are welcome. Please contact the project maintainer.

Versions

For the versions available, see the tags on this repository.

Authors

  • Panos - Initial work - pkokki

License

This project is licensed under the MIT License - see the LICENSE.TXT file for details

Credits