Generate Documents Effortlessly

Templater is a library designed to generate documents from existing Word, Excel and PowerPoint templates. It lets you create professional reports, spreadsheets and presentations in a fraction of the time compared to other solutions.

Minimal Interface, Maximum Flexibility

Its minimal and stable API allows seamless integration into third-party applications, without requiring any custom coding. Designers and domain experts can work directly in Microsoft Office, boosting productivity and allowing end-users to customize templates easily.

Comprehensive Feature Support

Templater understands most Office features, enabling companies, non-profits and individuals worldwide to generate documents cost-effectively. Detailed examples and use cases are available on Github.

Proven and Mature

With over 15 years of development, Templater is a mature product. The change log lists updates and improvements over the years.

Easy Installation

Templater installation is done in two simple steps:

  1. Grab the latest copy of Templater library
  2. Include it in your project…

…or just use it through package managers such as Maven and Nuget


Code sample

using NGS.Templater;

class Program
{
    static void Main(string[] args)
    {
        using (var document = Configuration.Factory.Open("Spreadsheet.xlsx"))
        {
            document.Process(new { Teacher = "Elizabeth", Age = 30 });
            document.Process(new [] {
                new { Name = "Angelina" },
                new { Name = "Andrea" },
                new { Name = "Evelyn" },
                new { Name = "Addison" },
                new { Name = "Audrey" }
            });
        }
    }
}
import hr.ngs.templater.*;
import java.io.*;

class Program {
    static void main(String[] args) {
        try(FileInputStream fis = new FileInputStream("Template.docx");
            FileOutputStream fos = new FileOutputStream("Result.docx");
            TemplateDocument document = Configuration.factory().open(fis, "docx", fos)) {
                document.process(new Object() { public final String Tag = "a basketball"; });
        }
    }
}
import hr.ngs.templater.*

object Program {
  case class Student(Name: String)
  def main(args: Array[String]) {
    val document = Configuration.factory.open("Presentation.pptx")
    document.process(new { val Teacher = "Elizabeth"; val Age = "30" })
    document.process(List(
        Student("Trinity"),
        Student("Alexandra"),
        Student("Jasmine"),
        Student("Emily"),
        Student("Madeline")
    ))
    document.close()
  }
}

Full documentation

Templater provides a minimal set of methods to get started with processing your templates.

method IDocumentFactory.Open
Use the Open method to load your template.
Open(string path)
  • opens a document from the specified path
  • Templater will recognize the appropriate document format from the file extension
Open(Stream input, string extension, Stream output, CancellationToken cancelToken)
  • opens a document from the input stream
  • the extension string indicates the type of document in the stream
  • writes the document to the output stream
  • cancellation token to cancel the processing
Returns ITemplateDocument
method ITemplateDocument.Process
Method Process will replace tags with corresponding data.
Process(data)
  • modifies the ITemplateDocument file or stream by replacing tags with rules according to specific data types
Returns ITemplateDocument

Articles

Templater Editor

While Templater works without a separate editor, Templater Editor seamlessly integrates into Microsoft Office tools to provide a richer editing experience.

  • Tag listing can be managed by your application to expose domain-specific insights, explanations and examples
  • Tag detection and analysis validates the document, highlights potential issues and suggests solutions with helpful explanations
  • Debugging functionality allows you to track every step of Templater execution. Adjusting templates or modifying data becomes trivial with replay capabilities
  • The familiar Office interface requires minimal training and can even be used directly by end users

Videos

Explore these videos to see Templater Editor in action, understand how tags and templates work and learn how to quickly generate documents without complex coding.

User manual

More information about how Templater works is available in the PDF documentation

Readme can also be found in quick (zip) download.

Javadoc

Javadoc is available here.