tomfaulhaber/excel-templates — pull request #1 by jebberjeb (2014-10-19 05:39:53+00:00)
Title: added fn to write doc to output stream

This new function is essentially a convenience wrapper which leverages (but hides) the existing temp-file based approach. Tested successfully using the following ring handler.

(ns foozle.core
(:require [excel-templates.build :as excel]
[ring.util.io :as io]))

(defn handler
[req]
{:status 200
:headers {"content-type"
"application/excel"

"content-disposition"
"attachment; filename=foo.xlsx"}
:body
(io/piped-input-stream (fn [output-stream]
(excel/render-document-to-stream!
"foo.xlsx"
output-stream
{"Sheet1" {0 [[1 1 1 1 1]]}
"Sheet2" {0 [[2 2 2 2 2]]}
"Sheet3" {0 [[3 3 3 3 3]]}})))})