Page 1 of 1

find the font size of a word

PostPosted: Thu May 19, 2011 6:28 pm
by cairokl
thanks, its works now.
one more question its there any method to find the font size of a word ?

Re: find the font size of a word

PostPosted: Fri May 20, 2011 12:56 pm
by jason
You can look at the way the PDF or HTML output does this.

See org.docx4j.model.PropertyResolver, and in particular:

Code: Select all
public RPr getEffectiveRPr(RPr expressRPr, PPr pPr)


Font size is one of the elements of rPr. Bear in mind that the measurement is half points, so a value of 28 means 14pt.

The essence of getting the font size is to see whether a font size is applied expressly to the run in question, and if it is not to work out what the style hierarchy applies (including default fonts).