XMLCursor を使用してテーブルを XWPFDocument に挿入すると、テーブルは正しい位置に挿入されますが、最初の列の下に余分なボックスが追加されます。ボックスはテーブルに結合されているため、追加のテーブル セルのように見えますが、XMLCursor を使用せずにテーブルを挿入すると、テーブルは正しく、ボックスは XMLCursor の位置にあります。追加のテーブル セルのように見えるボックスを削除する方法はありますか。
XWPFDocument part1Document = new XWPFDocument(part1Package);
XmlCursor xmlCursor = part1Document.getDocument().getBody().getPArray(26).newCursor();
//create first row
XWPFTable tableOne = part1Document.createTable();
XWPFTableRow tableOneRowOne = tableOne.getRow(0);
tableOneRowOne.getCell(0).setText("Hello");
tableOneRowOne.addNewTableCell().setText("World");
XWPFTableRow tableOneRowTwo = tableOne.createRow();
tableOneRowTwo.getCell(0).setText("This is");
tableOneRowTwo.getCell(1).setText("a table");
tableOne.getRow(1).getCell(0).setText("only text");
XmlCursor c2 = tableOne.getCTTbl().newCursor();
c2.moveXml(xmlCursor);
c2.dispose();
XWPFTable tables = part1Document.insertNewTbl(xmlCursor);
xmlCursor.dispose();
26 段落目の位置に空のボックスが表示されます。どんな助けでも素晴らしいでしょう。ありがとう。