Documents

Feel free to browse Templater library documentation. You can find it later in the document, after the installation steps are explained.

Installation

Templater installation is done in two simple steps:

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

…and you're ready to use it.


Code sample

using System;
using System.Diagnostics;
using NGS.Templater;

namespace SimpleDocument
{
    class Program
    {
        static void Main(string[] args)
        {
            var myFile = "MyDocument.docx";
            var data = new { Tag = "a moon" };

            using (var document = Configuration.Factory.Open(myFile))
            {
                document.Process(data);
            }

            Process.Start(myFile);
        }
    }
}
using System;
using System.Diagnostics;
using NGS.Templater;

namespace SimpleDocument
{
    class Program
    {
        static void Main(string[] args)
        {
            var myFile = "MySpreadsheet.xlsx";
            var teacher = new
            {
                Teacher = "Zuri",
                Age = 38
            };

            var students = new []
            {
              new { Name = "Regina" },
              new { Name = "Jordan" },
              new { Name = "Paulina" },
              new { Name = "Kenley" },
              new { Name = "Sydnee" }
            };

            using (var document = Configuration.Factory.Open(myFile))
            {
                document.Process(teacher);
                document.Process(students);
            }

            Process.Start(myFile);
        }
    }
}

Full documentation

There are only a few methods that you need to use in order to start 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 stream, string extension)
  • opens a document from the stream
  • the extension string indicates the type of document in the stream
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

Javadoc

Javadoc is available here.

t