Вам потребуется импортировать библиотеку ODF Kit в зависимости:
[org.odftoolkit/simple-odf "0.9.0-RC1"]]
Версия Clojure:
(ns clj-odf.core
(:import java.net.URI
org.odftoolkit.simple.TextDocument
org.odftoolkit.simple.table.Cell
org.odftoolkit.simple.table.Table
org.odftoolkit.simple.text.list.List))
(defn generate-odf [filename]
(let [outputOdt (TextDocument/newTextDocument)
uri (URI. "/home/manuel/Documents/lisplogo_fancy_256.png")
items (into-array String ["Primer Asunto" "Segundo punto" "Tercer negocio" "Too long list"])]
(try
(println "Generating ODF file")
(.addParagraph outputOdt "Hello World, taradazo Hello Simple ODF!")
(.newImage outputOdt uri)
(.addParagraph outputOdt "Hello World, taradazo Hello Simple ODF AFTER IMAGE!")
(.addParagraph outputOdt "The following is a list.")
;; doto macro, first argument is passed to all the next nested forms
(doto (.addList outputOdt)
(.addItems items))
;; ".." threading macro, Expands into a member access (.) of the first member on the first
;; argument, followed by the next member on the result, etc.
(.. outputOdt
(addTable 2 2)
(getCellByPosition 0 1)
(setStringValue "I'm in some cell table!"))
(.save outputOdt filename)
(catch Exception e (str "ERROR: unable to create output file: " (.getMessage e))))))
Результат: