JSP uses freemarker to generate word documents based on the word template, jspfreemarker

Source: Internet
Author: User

JSP uses freemarker to generate word documents based on the word template, jspfreemarker

Use freemarker to generate word Documents Based on word Templates

Freemarker Introduction

FreeMarker is a Java template engine that generates text output based on the template. FreeMarker has nothing to do with the Web Container, that is, when the Web is running, it does not know Servlet or HTTP. It can not only be used as the Implementation Technology of the presentation layer, but also be used to generate XML, JSP or Java.

Freemarker:

Http://freemarker.incubator.apache.org/freemarkerdownload.html

Word template to ftl Template

Find the word template file, use $ {paramName} as the parameter name [paramName is just an example], and save word as an xml file

Modify the xml file. After opening the xml file, we can see the possible placeholders.

Will be separated by xml tags. We need to modify it to delete the tags around the placeholder so that the parameter placeholder can be used as a whole.

 

Compile project code

4. Controller call code

 

Reference: http://blog.csdn.net/jackfrued/article/details/39449021

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.