I have in my disposal a Spring MVC backed server, using AngularJS in client side to display dynamic content. Was researching possibility to get current content displayed in the browser and convert it to a word document.
I assume there's a way to do build word documents with Java, but to do so i'll have to send existing HTML to the server side - how would i do that? just send the document DOM object?
Suppose i'll be able to do so, what if i want to include 2 images? I do know its possible to send images as base64 string.
To conclude, my general approach would be to try and send all client side data to the server and use Java to generate word document.
I have found docx4j so this approach seems possible.
Is that the right way to go? Any thoughts would be appriciated.
Asked
Active
Viewed 4,515 times
0
-
Maybe of interest http://www.docx4java.org/blog/2014/10/web-based-docx-editing/ – JasonPlutext Jan 10 '15 at 09:36
-
Thank you @JasonPlutext, but it didn't work for me- will try again after Apache POI attempt. – bks Jan 16 '15 at 10:45
-
Meanwhile, i'd appreciate some input regarding the downvote – bks Jan 16 '15 at 10:46
1 Answers
2
On the server side, you can use a library like Apache POI for creating docx documents.
There are multiple ways to pass data from client to server:
- Make an AJAX call
- Submit a form from the client side to the server using POST. Using multi-part forms will allow you to send attachments to the server
On the client side, there are some JS libraries available for creating docx documents: