在向XSLFTable中填充内容时出现xmlvaluedisconnectedException的错误

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/guo147369/article/details/79237832

如下所示:

XSLFTable  hslfTable = (XSLFTable) hslfShape;
int rowSize = hslfTable.getNumberOfRows();
int columnSize = hslfTable.getNumberOfColumns();

for (int i = 0; i < rowSize; i++) {
for (int j = 0; j < columnSize; j++) {

hslfTable.getCell(i, j).setText("填充内容");

}

}

在第6行填充内容时报xmlvaluedisconnectedException的错误,网上找了好多方法,解决方法如下:将其替换如下

XSLFTextRun t = hslfTable.getCell(i, j).addNewTextParagraph().addNewTextRun();
t.setText("填充内容");
原因暂不知晓,希望有知道的留言,交流。

猜你喜欢

转载自blog.csdn.net/guo147369/article/details/79237832