Hi, I am trying to generate a HTML document which only has a String, but that string is created as a html file with the corresponding tags. Unfortunately, the file is being generated with < and > instead of < and >. This makes the browser not recognize the tags and displays it as a string instead of a table as I’m meaning to. The solution to change everything into a document template with a table is not one I would choose because the functionality would need a lot of refactoring. Here is a sample: <tr> <th style="padding: 5px">Categorie</th> <th style="padding: 5px">Vraag</th> vs what I need it to look like: <tr> <th style="padding: 5px">Categorie</th> <th style="padding: 5px">Vraag</th> Does anybody know how to make it generate with the tags instead of the < and > ? Thanks, Razvan
Sounds like you want to use HTML Decoding. Luckily, this is really easy in Mendix!
Download the CommunityCommons module from the appstore, if you haven’t done so already. (IMO this is a go-to for any app you make, but that’s just a side note).
Once that’s in your app, you can use the “Call Java Action” in a microflow. Select the Java Action “HtmlToPlainText”, and use your <tr>
<th style="padding: 5px">Categorie</th>
<th style="padding: 5px">Vraag</th> as the input parameter. It should output with your tags, and any other decoded HTML you had in there, to be used in the rest of the flow.
Hope this helps!
Luke, I think that that java action uses javax.swing.text.html.HTMLEditorKit to convert the arg to plain text, so you’re going to loose all the tags. Try implement commons/lang3/StringEscapeUtils, it has what your after