Java Word doc docx font -
i trying read font size of words in docx file in java. have used apache poi library convert file try read txt file.
first of all, .docx
documents, you'll need xwpf-library, , .doc
hwpf - can't use 1 library both of them.
here's code, reads .docx
fontsize:
public void readfontsizefromdocx() throws ioexception { inputstream = this.getclass().getclassloader().getresourceasstream("templates/examplefontsize.docx"); xwpfdocument doc = new xwpfdocument(is); (xwpfparagraph paragraph : doc.getparagraphs()) { (xwpfrun run : paragraph.getruns()) { system.out.println(run.getfontsize()); } } }
also, take @ apache documentation - there many useful examples explain, how use it.