AnsweredAssumed Answered

Forcing a download of common mimetypes (xls, csv, txt)

Question asked by sgomez on Aug 28, 2009
Latest reply on Feb 3, 2015 by
Hello,  I've looked all over for an answer to my question and have been unsuccessful thus far.  The wiki pages helped in giving me a better understanding of how to output my template through the browser, but not as an attachment that can be downloaded.  The closest I've come to an answer is from the following thread:, although this topic was for a different file type (xls) which required adding a custom mimetype dfinition.  In my case, I want to give the user the option to download the output as a textfile. 

Is there a way to add a header file to a freemarker template so I can allow the user to download the output result of my template as text or any other common mimetype?  Thanks in advance.

My code is below and it works fine, I just don't know how to add a header to it.

Result: ${total} found
   <#list nodes as document>
      <#if document.isDocument>
                   {"name": "${}"
         <#if>, "author":"${}"</#if>
         <#if>, "creator":"${}"</#if>
         <#if>, "modified":"${}"</#if>
         <#if>, "created":"${}"</#if>
         <#if>, "description":"${}"</#if>