Bug 68490 - in class XWPFDocument, there is no possiblity to add new XWPFSDT to the IBodyElement list
Summary: in class XWPFDocument, there is no possiblity to add new XWPFSDT to the IBody...
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: XWPF (show other bugs)
Version: unspecified
Hardware: PC All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2024-01-16 12:24 UTC by Majd Azzam
Modified: 2024-02-25 12:31 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Majd Azzam 2024-01-16 12:24:44 UTC
In the XWPFDocument, I am utilizing the following methods:

- insertNewParagraph
- insertNewTbl

In the implementation of these two methods, a new XWPFParagraph object or XWPFTable object will be added to the IBodyElement list.

However, I encounter a problem: I would like to add a new XWPFSDT element to the IBodyElement list, which is not possible now (in version 5.2.5) because the IBodyElement list is protected, and there is no implemented method to achieve this.

It would be beneficial if the insertNewSdt method were implemented in class XWPFDocument, or at least any public method to add elements to IBodyElement!

Thank you,
Comment 1 PJ Fanning 2024-01-16 12:48:25 UTC
There are no active POI committers who have much experience with the XWPF code base. If you would like to try creating your own PR, I will have a look at it.

I would also recommend stackoverflow.com. There are a few active users there who might be able to help you with doing what you want to do with the existing POI releases. For instance, you could write your own subclass of XWPFDocument that exposes a public method to add an XWPFSDT instance.