Skip to content

Commit

Permalink
Templater v4.0.0
Browse files Browse the repository at this point in the history
Support for PowerPoint.
Html fixes/changes for Java 11.
New examples:

 * simple PowerPoint
 * PowerPoint with tables and dynamic resize
 * charts sharing same data source in PowerPoint
  • Loading branch information
zapov committed Sep 8, 2019
1 parent 5615fb0 commit 095c3d6
Show file tree
Hide file tree
Showing 182 changed files with 1,021 additions and 177 deletions.
2 changes: 1 addition & 1 deletion Advanced/CsvStreaming/CsvStreaming.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<Private>True</Private>
</Reference>
<Reference Include="NGS.Templater">
<HintPath>..\..\packages\Templater.3.2.1\lib\Net40\NGS.Templater.dll</HintPath>
<HintPath>..\..\packages\Templater.4.0.0\lib\Net40\NGS.Templater.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System" />
Expand Down
2 changes: 1 addition & 1 deletion Advanced/CsvStreaming/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DotNetZip" version="1.13.0" targetFramework="net40-Client" />
<package id="Templater" version="3.2.1" targetFramework="net40-Client" />
<package id="Templater" version="4.0.0" targetFramework="net40-Client" />
</packages>
2 changes: 1 addition & 1 deletion Advanced/CsvStreaming/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>hr.ngs.templater.example</groupId>
<artifactId>csv-streaming-example</artifactId>
<packaging>jar</packaging>
<version>3.2.1</version>
<version>4.0.0</version>
<name>CSV streaming</name>
<url>https://github.com/ngs-doo/TemplaterExamples</url>

Expand Down
2 changes: 1 addition & 1 deletion Advanced/DepartmentReport/DepartmentReport.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="NGS.Templater">
<HintPath>..\..\packages\Templater.3.2.1\lib\Net40\NGS.Templater.dll</HintPath>
<HintPath>..\..\packages\Templater.4.0.0\lib\Net40\NGS.Templater.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
2 changes: 1 addition & 1 deletion Advanced/DepartmentReport/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Templater" version="3.2.1" targetFramework="net40-Client" />
<package id="Templater" version="4.0.0" targetFramework="net40-Client" />
</packages>
2 changes: 1 addition & 1 deletion Advanced/DepartmentReport/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>hr.ngs.templater.example</groupId>
<artifactId>department-report-example</artifactId>
<packaging>jar</packaging>
<version>3.2.1</version>
<version>4.0.0</version>
<name>DepartmentReportExample</name>
<url>https://github.com/ngs-doo/TemplaterExamples</url>

Expand Down
2 changes: 1 addition & 1 deletion Advanced/DoubleProcessing/DoubleProcessing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="NGS.Templater">
<HintPath>..\..\packages\Templater.3.2.1\lib\Net40\NGS.Templater.dll</HintPath>
<HintPath>..\..\packages\Templater.4.0.0\lib\Net40\NGS.Templater.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
Expand Down
2 changes: 1 addition & 1 deletion Advanced/DoubleProcessing/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Templater" version="3.2.1" targetFramework="net40-Client" />
<package id="Templater" version="4.0.0" targetFramework="net40-Client" />
</packages>
2 changes: 1 addition & 1 deletion Advanced/DoubleProcessing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>hr.ngs.templater.example</groupId>
<artifactId>double-processing-example</artifactId>
<packaging>jar</packaging>
<version>3.2.1</version>
<version>4.0.0</version>
<name>DoubleProcessingExample</name>
<url>https://github.com/ngs-doo/TemplaterExamples</url>

Expand Down
2 changes: 1 addition & 1 deletion Advanced/PowerQuery/PowerQuery.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="NGS.Templater">
<HintPath>..\..\packages\Templater.3.2.1\lib\Net40\NGS.Templater.dll</HintPath>
<HintPath>..\..\packages\Templater.4.0.0\lib\Net40\NGS.Templater.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
Expand Down
2 changes: 1 addition & 1 deletion Advanced/PowerQuery/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Templater" version="3.2.1" targetFramework="net40-Client" />
<package id="Templater" version="4.0.0" targetFramework="net40-Client" />
</packages>
17 changes: 16 additions & 1 deletion Advanced/PowerQuery/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>hr.ngs.templater.example</groupId>
<artifactId>power-query-example</artifactId>
<packaging>jar</packaging>
<version>3.2.1</version>
<version>4.0.0</version>
<name>PowerQueryExample</name>
<url>https://github.com/ngs-doo/TemplaterExamples</url>

Expand All @@ -18,6 +18,21 @@
<artifactId>templater</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>

<build>
Expand Down
2 changes: 1 addition & 1 deletion Advanced/SalesOrderMVP (.NET)/SalesOrderMVP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<Private>True</Private>
</Reference>
<Reference Include="NGS.Templater">
<HintPath>..\..\packages\Templater.3.2.1\lib\Net40\NGS.Templater.dll</HintPath>
<HintPath>..\..\packages\Templater.4.0.0\lib\Net40\NGS.Templater.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
Expand Down
2 changes: 1 addition & 1 deletion Advanced/SalesOrderMVP (.NET)/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Fluent.Ribbon" version="3.6.1.236" targetFramework="net40-Client" />
<package id="Templater" version="3.2.1" targetFramework="net40-Client" />
<package id="Templater" version="4.0.0" targetFramework="net40-Client" />
</packages>
2 changes: 1 addition & 1 deletion Advanced/SheetReport/SheetReport.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<Private>True</Private>
</Reference>
<Reference Include="NGS.Templater">
<HintPath>..\..\packages\Templater.3.2.1\lib\Net40\NGS.Templater.dll</HintPath>
<HintPath>..\..\packages\Templater.4.0.0\lib\Net40\NGS.Templater.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
Expand Down
2 changes: 1 addition & 1 deletion Advanced/SheetReport/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="SharpZipLib" version="0.86.0" targetFramework="net40-Client" />
<package id="Templater" version="3.2.1" targetFramework="net40-Client" />
<package id="Templater" version="4.0.0" targetFramework="net40-Client" />
</packages>
2 changes: 1 addition & 1 deletion Advanced/SheetReport/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>hr.ngs.templater.example</groupId>
<artifactId>sheet-report-example</artifactId>
<packaging>jar</packaging>
<version>3.2.1</version>
<version>4.0.0</version>
<name>SheetReportExample</name>
<url>https://github.com/ngs-doo/TemplaterExamples</url>

Expand Down
2 changes: 1 addition & 1 deletion Advanced/TemplaterServer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM ubuntu:18.10

RUN apt update && apt install openjdk-11-jre-headless libreoffice-common libreoffice-java-common libreoffice-writer libreoffice-calc wget -yq

RUN wget -q https://github.com/ngs-doo/TemplaterExamples/releases/download/v3.2.1/templater-server.jar
RUN wget -q https://github.com/ngs-doo/TemplaterExamples/releases/download/v4.0.0/templater-server.jar

COPY templater.lic .

Expand Down
36 changes: 24 additions & 12 deletions Advanced/TemplaterServer/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ Pushdown will move tables to appropriate position.

Tags are also supported in sheet names.

#### Board report

Templater also supports PowerPoint.

Simple replace, table resize or even embedded chart processing is supported.

When tag is repeated in multiple collections it will be processed accordingly,
which means that same data source can be displayed in various different ways.

#### Charts

Excel charts can be created based on data source (either table or range).
Expand All @@ -85,7 +94,14 @@ Default implementation will collapse region of document if null, empty or true v
In this example, :clone is required, since two elements are being sent for processing and Templater doesn't cope with it otherwise.
While :collapse will remove tags, processor will still continue trying to replace the missing tags, so empty values will end up on the next context.

#### Links
#### Dynamic resize

Dynamic resize works on Object[][] or List<List<Object>> types as long as dimensions are the same.
In .NET special two dimensional type: Array[,] is also supported.

When combined with **merge-nulls** and **span-nulls** multiple cells can be combined into one.

#### External links

Anchors are also analyzed for tags. This allows custom parts of the link to be populated with Templater.

Expand All @@ -99,34 +115,30 @@ Templater will rewrite formulas when cells are duplicated or moved around.
Since Excel doesn't allow defining tag within formula, Templater has an "alternative way" to convert tag into formula.
Tags which start with [[equals]] are converted into formula at the end of processing.

#### Groceries

Dynamic resize works on Object[][] or List<List<Object>> types.

#### Label

Templater is build so that templates can be designed with Word/Excel.
This means utilizing various their features for layout, such as multiple columns in Word.
Table can be defined without border, so it doesn't look like table, but behaves as one.

#### Dynamic data types

Built-in processors for map/collections allow for working with dynamic types (even without reflection).
It's also possible to combine several processors on a single object.

#### Nesting

Collections can be nested in other collections. This allows usage of Templater for very complex documents.
Lists can be embedded within Tables.

#### Table pushdown
#### Pushdown

During processing in non trivial Excel documents, cells are often moved around.
Special rules exists for tables, named ranges, merge cells, formulas and various other objects.
Templater will rewrite formulas, ranges for data sources so they are still valid after tables/ranges have been resized.
Depending on the context, objects such as merge cells and ranges can be stretched or moved.

#### Sales order cloning
#### Resume

Document layout can be tuned to fit specific look.
Tags can be combined with static/dynamic pictures in each row/page.

#### Sales order

Row context can span multiple rows/columns.
Since context can be nested, this allows for very complex document layouts.
Expand Down
2 changes: 1 addition & 1 deletion Advanced/TemplaterServer/TemplaterServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.1" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="Templater" Version="3.2.1" />
<PackageReference Include="Templater" Version="4.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Advanced/TemplaterServer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>hr.ngs.templater.example</groupId>
<artifactId>templater-server</artifactId>
<packaging>jar</packaging>
<version>3.2.1</version>
<version>4.0.0</version>
<name>TemplaterServer</name>
<url>https://github.com/ngs-doo/TemplaterExamples</url>

Expand Down
48 changes: 48 additions & 0 deletions Advanced/TemplaterServer/resources/examples/BoardReport.pptx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"title": "Company monthly report",
"subtitle": "Powered by Templater",
"date": "Today",
"state": "On track",
"action": [
{"description": "Hire more experts"},
{"description": "Remove obstacles"},
{"description": "Marketing"},
{"description": "Marketing"},
{"description": "Marketing"}
],
"sales": [
{
"country": "Croatia",
"lead": "Hrvoje Horvat",
"churn": 50,
"new": 220
},
{
"country": "USA",
"lead": "John Doe",
"churn": 450,
"new": 1500
},
{
"country": "Australia",
"lead": "Jack Smith",
"churn": 0,
"new": 3060
},
{
"country": "Japan",
"lead": "Keiko Suzuki",
"churn": 260,
"new": 820
}
],
"history": [
{"period": "2018/Q1", "total": 5030},
{"period": "2018/Q2", "total": 5050},
{"period": "2018/Q3", "total": 6120},
{"period": "2018/Q4", "total": 6650},
{"period": "2019/Q1", "total": 7660},
{"period": "2019/Q2", "total": 7540},
{"period": "2019/Q3", "total": 8220}
]
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"myArr": [
"array": [
[
"Apples",
"Milk",
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
10 changes: 7 additions & 3 deletions Advanced/TemplaterServer/src/TemplaterController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,13 @@ public IActionResult Templates(string file)

private static string MimeType(string file)
{
return file.EndsWith(".docx")
? "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
if (file.EndsWith(".docx"))
return "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
if (file.EndsWith(".xlsx"))
return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
if (file.EndsWith(".pptx"))
return "application/vnd.openxmlformats-officedocument.presentationml.presentation";
return "application/octet-stream";
}

public class Argument
Expand Down
Loading

0 comments on commit 095c3d6

Please sign in to comment.