Dear all
I want to replace all bookmarks (placed in tables). But a simple iteration
over all tables and their paragraphs causes an Format Problem with my docx
after saving it.
For GETTING the bookmarks I can create a copy and save the original docx.
But I want to REPLACE the bookmarks. For this it does not work. Because of
this simple reading/replacement a new row is placed in every cell of every
table.
Can you help me - here my code
Iterator<XWPFTable> tables_it1 = doc.getTablesIterator();
while (tables_it1.hasNext()) {
XWPFTable table1 = tables_it1.next();
// 2.3) ausgeben aller Textmarken in Tabellen wiederum
in
// Paragraphen gespeichert sind
int size = table1.getRow(0).getCtRow().sizeOfTcArray();
for (int i = 0; i < table1.getNumberOfRows(); i++) {
for (int j = 0; j < size; j++) {
XWPFTableCell c =
table1.getRow(i).getCell(j);
XWPFParagraph paragraph =
c.getParagraph();
CTP ctp = paragraph.getCTP();
CTBookmark[] bookmarks =
ctp.getBookmarkStartArray();
for (CTBookmark bookmark : bookmarks) {
bookmarkList.add(bookmark.getName());
}
}
}
}
best regards
Thomas
--
View this message in context:
http://apache-poi.1045710.n5.nabble.com/Format-problems-after-getting-all-textmarks-tp4612687p4612687.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]