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

Table of Contents

5.1. Getting started
5.1.1. Creating an invoice template in 10 minutes or less
5.1.2. Installing a template
5.1.3. About Freemarker
5.2. Using the template editor
5.2.1. Basic settings
5.2.1.1. Logo
5.2.1.2. QR-bill
5.2.2. Adjust the look and format using CSS (for advanced users only!)
5.2.3. Adjust the meta-template (for advanced users only!)
5.3. The anatomy of a simple template
5.3.1. Placeholders or how to access fields
5.3.2. Built-ins or how to get more details about a field
5.3.3. Directives or how to perform operations on fields
5.4. Creating templates the easy way
5.4.1. Using directives in tables (important!)
5.4.2. HyperText Markup Language (.html)
5.4.3. Microsoft Word (.docx)
5.4.4. OpenDocument Text (.odt)
5.4.5. OpenDocument Spreadsheet (.ods)
5.5. Creating templates like a professional (HTML and CSS)
5.5.1. Page formatting
5.5.2. Fonts
5.6. Creating templates like a professional (Plain Text and XML)
5.6.1. Example: Quicken
5.6.2. Example: Scribus (DTP)
5.7. A comparison of all supported file formats
5.8. Placeholders reference
5.8.1. Business
5.8.2. Client
5.8.3. Invoice
5.8.4. Item
5.8.5. Payment
5.8.6. Deposit
5.8.7. Tax
5.8.8. Invoice Project
5.8.9. Time Entry
5.8.10. Task
5.8.11. Expense
5.8.12. Trip
5.8.13. Projects Report
5.8.14. Time Report
5.8.15. Tasks Report
5.8.16. Expenses Report
5.8.17. Trips Report
5.8.18. Sales Report
5.9. The qrbill Freemarker directive (for advanced users)
5.9.1. Parameters
5.9.2. Integrating qrbill in HTML
5.10. The jfreechart Freemarker directive (for advanced users)
5.10.1. Parameters
5.10.2. Chart types
5.10.2.1. Area charts
5.10.2.1.1. Category area charts
5.10.2.1.2. XY area charts
5.10.2.1.3. Time series area charts
5.10.2.2. Bar charts
5.10.2.2.1. Bar charts
5.10.2.2.2. Stacked bar charts
5.10.2.3. Line charts
5.10.2.3.1. Category line charts
5.10.2.3.2. XY line charts
5.10.2.3.3. Time series line charts
5.10.2.4. Pie charts
5.10.2.4.1. Pie charts
5.10.2.4.2. Ring charts
5.10.3. Chart properties
5.10.3.1. Chart
5.10.3.2. Title and subtitles
5.10.3.3. Legend
5.10.3.4. Plot
5.10.3.5. Renderer
5.10.3.6. Domain axis
5.10.3.7. Range axis

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

5.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.

5.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.

5.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.

5.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.