Page 1 of 1

Export docx to multi-part MIME with images?

PostPosted: Wed Jun 06, 2012 6:30 am
by jallen
I searched and didn't find any reference to this. Is this within the realm of possiblity? I am guessing converting images to be inline base64 encoded would be the biggest issue. I am basically looking to convert Word docs to mime, including all images, and then email the result out. If this doesn't exist I would be willing to try and put it together with a little help.

I have studied the HtmlExporterNG2 class and its not entirely clear to me the best way to tackle this.

Re: Export docx to multi-part MIME with images?

PostPosted: Wed Jun 06, 2012 1:23 pm
by jason
Actually converting images to be inline base64 encoded is easy. imageDirPath.equals("") forces createEncodedImage for internal images; see https://github.com/plutext/AndroidDocxT ... ndler.java for example of usage.

Note that IE has limits on the size of images it can read from data URLs, so maybe using data URLs is not a good idea (Outlook?).

Maybe you are looking at 2 steps:

Step 1: HtmlExporterNG2, with an appropriate ConversionImageHandler (one that encodes your images as MimeBodyPart appropriately for step 2)

Step 2: Java Mail API (take the HTML and MimeBodyParts from step 1).

See further http://stackoverflow.com/questions/2996 ... g-javamail

Re: Export docx to multi-part MIME with images?

PostPosted: Thu Jun 07, 2012 7:05 am
by jallen
ok thanks. I will see what I can come up with.