Chapter 4. Templates guide: How to create and edit templates for Fanurio

This guide shows you how to create or edit templates that you can use to export documents like invoices.

4.1. Getting started

This guide shows you how to create a template from scratch but in most cases, you won't have to do that. Almost any template can be created a lot easier using the template editor. Even our support team prefers to use the editor instead of coding templates by hand.

Fanurio can handle templates in several file formats like HTML, Microsoft Word 2007 or OpenDocument Text. However, HTML is the recommended format for templates in Fanurio. The template editor also creates HTML templates. You can find a list of all supported file formats with comments on each one of them at the end of this guide.

If you create templates in HTML or any other format, it's important that you read the template language section and the section on how to use directives in tables.

4.1.1. Creating an invoice template in 10 minutes or less

The most recommended way of creating an invoice template is to use the template editor. Even power users can do a lot of tweaks just from the editor.

Here's how to create your first template:

  1. Go to File » Template Editor to open the template editor.

  2. Go through all the sections of the editor and check the fields you want to include in your template. You can configure things like your logo, the visible columns, the totals or the names of the columns.

    To see how it looks like after you make some changes, click Update or press F5 (Windows), Ctrl+R (Linux) or Cmd+R (Mac OS X).

  3. Click Save to save the template to the templates folder when you're done. Later, when you'll want to export an invoice to HTML, you can use this template.

If you want to make further adjustments to the template, use the template editor and click the Open button to open it. To learn more about the template editor, make sure you read the section that describes it.

If you have problems customizing or creating a template, you can always contact us for help.

4.1.2. Installing a template

Installing a template is just a matter of copying one or more files to a certain folder. Go to File » Open Templates Folder to open the folder where you want to install the template. For invoice templates, use File » Open Templates Folder » Invoices.

If you are using an HTML template that uses specific fonts and images, make sure you also copy those files to the templates folder.

4.1.3. About Freemarker

Fanurio uses the FreeMarker template language for its templates. Freemarker is a powerful and mature template language that can be used to create both simple and complex templates. FreeMarker can be used to generate any kind of text: HTML, XML, RTF, etc.

This guide doesn't cover all FreeMarker concepts but only those that are absolutely necessary. For a detailed guide on the FreeMarker language, go to http://freemarker.sourceforge.net/docs/dgui.html.