Merge

Merge ODT/ODS templates from Clojure data structure

View the Project on GitHub Kaleidocs/merge

Kaleidocs/merge

A Clojure wrapper for XDocReport. Works on Open Document Format for Office Applications and Velocity syntax.

Installation

Include Kaleidocs/merge in your project.clj:

Clojars

(require '[kaleidocs.merge :refer [merge-doc]])

Usage

Simple structure

Create ODT/ODS templates with LibreOffice / OpenOffice. Templates are just normal office files with some placeholders typed directly inside. Follow velocity syntax, something like this:

Hello $name!

Now execute from clojure:

(merge-doc "simple-template.odt"
           "simple-output.odt"
           {:name "World"})
Hello World!

ODS templates work the same way.

Documents with repeated rows in tables (ODT only)

Making template

(merge-doc "simple-template.odt"
           "simple-output.odt"
           ;; columns
           ["developers.Name", "developers.Mail", "developers.LastName"]
           ;; data
           {:project {"Name" "XDocReport"},
            "developers"
            [{"Name" "ZERR",
              "Mail" "angelo.zerr@gmail.com",
              "LastName" "Angelo"},
             {"Name" "Leclercq",
              "Mail" "pascal.leclercq@gmail.com",
              "LastName" "Pascal"}]})

Result

More information about creating templates (about XDocReport extension for LibreOffice / OpenOffice, too)

License

Copyright © 2014 Hoang Minh Thang

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.