Question

I have JSF RichFaces rich:editor running and I am able to upload and open documents or just stream them to the editor. The issue is that .doc or docx or other richText documents will show lots of stuff that is not what I see in the actual document when I open it with Office, and the only format that I am able to actually get rigth is when I get it from a HTML file.

My questions are:

Is there any way to open the documents online and have them edited similar to what Google Docs have?

Is there any way to tweak RichFaces rich:editor component to do what I want to do?

NOTE: If I copy and Paste from .doc then its works just ok, but here I have to get it from streaming

Was it helpful?

Solution

You basically need to convert DOC(X) to HTML for editing and HTML to DOC(X) after saving. That's also what Google Docs is basically doing.

Your next question shall most probably be, "How do I convert from DOC(X) to HTML and back?". You can use among others Open Office API for this, or a library on top of it like JDOCConverter. Alternatively, you can also parse the DOC(X) yourself with help of a low level API like Apache POI HWPF and then generate the desired HTML accordingly based on the infomation collected in Java objects.

No, this is not a trivial task. You need to have a good understanding of the DOC(X) format (this question alone already shows that you don't have) and the limitations during the conversion step. I'd personally recommend to just use Google Docs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top