3

我的库 apache poi 有问题,我想复制单元格的样式,为此我使用函数 cloneStyleFrom(),除了边框样式的副本外,所有的工作都很好。我不明白是我的错误还是这个函数没有实现边框样式的副本。

这是我的代码:

int stHashCode = oldCell.getCellStyle().hashCode();
XSSFCellStyle newCellStyle = styleMap.get(stHashCode);
if (newCellStyle == null) {
    newCellStyle = newCell.getSheet().getWorkbook().createCellStyle();
    newCellStyle.cloneStyleFrom(oldCell.getCellStyle());
    styleMap.put(stHashCode, newCellStyle);
}
    newCell.setCellStyle(newCellStyle);

有人可以帮助我吗?我的错误在哪里?

谢谢

4

0 回答 0