I am trying to find the default font size of a doc/ docx document using apache poi. I have used the XWPFRun class method getFontSize(). But it returns the value -1 if the font size is default. I couldn't find any other method that returns the same in the documentation. Is there a way i can get the "actal" default font size of the document?
Asked
Active
Viewed 1,576 times
2
-
Did you try checking the font size on the style applied to the run? – Gagravarr Feb 28 '12 at 09:48
-
yeah i did, and it is returning correct results. But if the font size of a run is default, it shows -1 (which "means" it is the default font size) and not the actual font size. – srjit Feb 28 '12 at 10:16
-
as of 3.12, which said " Initial XWPFStyles support for working with default document paragraph and run styles" and implemented XWPFDefaultRunStyle class. but document.getStyles().getDefaultRunStyles().getFontSize() still returns -1. – neutrino Jun 13 '15 at 05:14
1 Answers
1
In my case,
document.getStyles().getDefaultRunStyles().getFontSize();
solved the problem.

user1419243
- 1,655
- 3
- 19
- 33