Announcement Announcement Module
Collapse
No announcement yet.
Generate ms-word documents using Velocity Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Generate ms-word documents using Velocity

    In a Spring Controller I’m using Velocity to generate ms-word documents. I have a rtf “template” containing both header/footer, fixed texts and of course velocity tags for dynamic texts fetched from a database.

    Code:
    Map model = new HashMap();
    // populate model...
    String template = "template.rtf";
    response.setContentType("application/msword");
    VelocityEngineUtils.mergeTemplate(velocityEngine, template, model, response.getWriter());
    This works pretty slick, but I'm facing one problem...

    Some of the dynamic texts is authored on a web page using an html inline editor, so it contains a lot of html-markup, i.e. html tables etc. And when merging, the resulting document obviously has a lot of raw html code in it.

    Anyone facing the same or similar scenarios? Any velocity macros or other tools that convert html to rtf?
Working...
X