Skip to content Skip to sidebar Skip to footer

How To Set Font Size And Font Family In Document Using Docx4j

FileReader fr=new FileReader('E://HtmlToDoc//LETTER.html' ); BufferedReader br=new BufferedReader(fr); while( (s=br.readLine())!= null ){ html=html+s;} html='<

Solution 1:

You're pulling HTML content in to a Word document as a collection of AltChunk instances, which means the HTML exists in the docx 'bundle' as separate file, and not as part of the flow of the actual Word document.

If you want to manipulate the imported content as native MS Word content, you need to import the source XHTML instead. This means that docx4j takes the mark-up and (some) related styles, converting them into the various constituent parts of a docx file (for example, table, text, run and paragraph elements). Once you have content imported in that way, you can style it as you would any other docx entities.

Post a Comment for "How To Set Font Size And Font Family In Document Using Docx4j"