You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2024/05/23 15:31:09 UTC

[Bug 69042] New: Calling `insertNewParagraph` pointing to object in header leads to `ClassCastException`

https://bz.apache.org/bugzilla/show_bug.cgi?id=69042

            Bug ID: 69042
           Summary: Calling `insertNewParagraph` pointing to object in
                    header leads to `ClassCastException`
           Product: POI
           Version: 5.2.3-FINAL
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: XWPF
          Assignee: dev@poi.apache.org
          Reporter: aoellerer@protonmail.com
  Target Milestone: ---

When trying to insert an object into a document via
`XWPFDocument#insertNewParagraph(XmlCursor cursor)`, where the cursor points to
something in the header/footer, a `ClassCastException` is thrown.

The reason for this is in `insertIntoParentElement(IBodyElement iBodyElement,
Deque<XmlObject> path)`, where I assumed that the element can only be nested in
a table, when in reality it can also be in a header or footer.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 69042] Calling `insertNewParagraph` pointing to object in header leads to `ClassCastException`

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69042

Sayi <sa...@163.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #3 from Sayi <sa...@163.com> ---
Of course, insertNewParagraph should be called in each container, such as
XWPFHeaderFooter, XWPFTableCell.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org