Please note that formatting is applied on a few different levels. For example, let’s consider formatting of simple text. Text in documents is represented by Run element and a Run can only be a child of a Paragraph. You can apply formatting
- to Run nodes by using Character Styles e.g. a Glyph Style .
- to the parent of those Run nodes i.e. a Paragraph node ( possibly via paragraph Styles ).
- you can also apply direct formatting to Run nodes by using Run attributes ( Font ). In this case the Run will inherit formatting of Paragraph Style, a Glyph Style and then direct formatting.
In your document the
Normal style is applied and direct formatting is applied to Run nodes. So, you need to iterate over Run node and check if all nodes are formatted as bold.
If the style applied to text has bold formatting, you can use Paragraph.ParagraphFormat property as shown below.
Document doc = new Document(MyDir + "paramiss.docx");
for (Paragraph para : (Iterable<Paragraph>) doc.getChildNodes(NodeType.PARAGRAPH, true))