CKEditor issue (text and images convert to word doc)

0
How to convert CKEditor (HTML) text into Word doc including images also.
asked
2 answers
1

Hi,

 

If I'm correct you'll need to replace all HTML tags with their corresponding 'marks/signs' (&amp for example becomes &).

You could achieve this with a custom java action (Unescape HTML - more or less like the EscapeHTML in the CommunityCommons), you can find an example below:

		// BEGIN USER CODE
		return HTML.replace(""", "\"")
				.replace("&", "&")
				.replace("&lt;", "<")
				.replace("&gt;", ">")
				.replace("&#39;", "'")
				.replace("&nbsp;", " ")
				.replace("&#43;", "+");
		// END USER CODE

You can also try to resolve this with normal microflow actions using the replace or replaceAll functions, but I think the custom java action will get you there more easily.

Regarding the images: this is something I haven't tried myself yet, so maybe someone else could give some more advice on this.

Jordy

answered
1

Hi,

There are some standard modules to convert text / images from HTML to plain / filedocuments. 
You could try and use the "HTMLToPlainText" java action from the CommunityCommons module.
Images are either uploaded as a document or as a base64 string, you can convert the base64 string to an image with the "Base64DecodeToFile" Java action, also in the CommunityCommons module.

Directly from CKEditor to Word isn't a Mendix standard, you could try and use the CommunityCommons Module in combination with the DocumentTemplates or write a Java action to create this for you, based on the html string from the CKEditor.

Roy

answered