I am trying to create a word document using HWPFDocument. I can create a document with some function, but I am not able to get a few things. My problem is simple, but I canβt understand a few things. I want to convert this simple HTML to generated worddoc:
<div xmlns="http://www.w3.org/1999/xhtml" class="formatted_content"> <strong>cloudHQ.tester.4</strong> β this is the bold text <br/> this is italic text <br/> <ul> <li>bullets 1</li> <li>bullets 2</li> <li>bullets 3</li> </ul> <br/> <ol> <li>Number1</li> <li>Number2</li> <li>Number3</li> </ol> <br/> <pre>this is simple quote</pre> <br> this is simple quote </div>
Here I can convert bold and italic text. But unable to figure out how to create
1) <ul><li>.... 2) <ol><li>... 3) break <br> 4) <pre>
in WordDoc.
Is there any example for this, then please let me know I really appreciate the effort, thanks in advance.
Edited by:
library included:
include_class "org.apache.poi.poifs.filesystem.POIFSFileSystem" include_class "org.apache.poi.hwpf.usermodel.ParagraphProperties" include_class "org.apache.poi.hwpf.usermodel.CharacterRun" include_class "org.apache.poi.hwpf.usermodel.CharacterProperties"
And this is the main code for converting html to doc, for example:
def convert_from_html_to_doc(html_file_name, comment_files) puts("Script start.....") puts("Parsing document comments start.....NEW") default_file = "misc/poi_experiment/empty.doc" fs = JavaPoi::POIFSFileSystem.new(JavaPoi::FileInputStream.new(default_file))
Hope this helps you understand.
source share