Hi Everybody,
how can I recognize whether a paragraph is a Heading1-....?
Right now I use the code below however this is not reliable. I have for example a German docx document where heading is reported as "berschrift" however in English Libreoffice when I navigate to this paragraph I do see "Heading 1".
Regards,
Zsolt
private final static Pattern heading = Pattern.compile("(berschrift|style|heading)\\s*([1-9])", Pattern.CASE_INSENSITIVE);
....
// Check for heading.
PPr ppr = paragraph.getPPr();
if (ppr != null && ppr.getPStyle() != null && ppr.getPStyle().getVal() != null) {
PStyle pStyle = ppr.getPStyle();
String style = pStyle.getVal();
Matcher m = heading.matcher(style);
boolean styleMatches = m.matches();