]> source.dussan.org Git - poi.git/commitdiff
Fix bug #55196 - Correct XWPF createTOC handling of short style names
authorNick Burch <nick@apache.org>
Thu, 31 Jul 2014 16:11:35 +0000 (16:11 +0000)
committerNick Burch <nick@apache.org>
Thu, 31 Jul 2014 16:11:35 +0000 (16:11 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1614930 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java

index be2348ee0ef08c2356519a83080b07ef7f1bd7b1..568681dee4ed076c84b3c2d221560440eeca905b 100644 (file)
@@ -892,7 +892,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
         TOC toc = new TOC(block);
         for (XWPFParagraph par : paragraphs) {
             String parStyle = par.getStyle();
-            if (parStyle != null && parStyle.substring(0, 7).equals("Heading")) {
+            if (parStyle != null && parStyle.startsWith("Heading")) {
                 try {
                     int level = Integer.valueOf(parStyle.substring("Heading".length())).intValue();
                     toc.addRow(level, par.getText(), 1, "112723803");