https://issues.apache.org/bugzilla/show_bug.cgi?id=55196

            Bug ID: 55196
           Summary: XWPFDocument createTOC Exception when style names less
                    than 7 characters
           Product: POI
           Version: 3.9
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XWPF
          Assignee: [email protected]
          Reporter: [email protected]

OpenXML Word Documents.

Using createTOC will raise an exception if any of your styles are less than
7 characters. This is caused by the method createTOC and the line

            if (parStyle != null && parStyle.substring(0,
7).equals("Heading")) {

Quick fix is to extend this class and override createTOC. The line should be
something like

            if (parStyle != null && parStyle.startsWith("Heading")) {

Also remember to position to the location you want the TOC to be inserted.

If somebody can point me in the right direction I would happy to try to write a
patch.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to