Document doc = new Document("C:\\Working\\Features\\Special_Chart\\" + "TestFile.doc ");
NodeCollection runs = doc.getChildNodes(NodeType.RUN, true);
for( Run run : (Iterable) runs )
{
System.out.println(run.getFont().getStyleIdentifier() + " " + run.getText());
if (run.getFont().getStyleIdentifier() == StyleIdentifier.HEADING_1)
{
System.out.println(run.getFont().getStyleName());
}
}
It never enters into if-condition.
You can find test file: TestFile.doc in attachements and result program log in another attachment.
P.S. in general only these styles are detected:
public static final int DEFAULT_PARAGRAPH_FONT = 65;
public static final int INTENSE_EMPHASIS = 261;
public static final int SUBTLE_EMPHASIS = 260;
public static final int EMPHASIS = 88;
public static final int STRONG = 87;
public static final int SUBTLE_REFERENCE = 262;
public static final int INTENSE_REFERENCE = 263;
public static final int BOOK_TITLE = 264;
but I would like to find NORMAL, HEADING_1 and HEADING_2.