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.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -