apache poi cell- getCellstyle和cellstyle- setCellstyle提供不同的背景颜色

发布于 2025-01-19 05:23:08 字数 605 浏览 1 评论 0原文

我正在尝试复制单元格样式(背景颜色、格式等)并将其设置为另一个单元格。

使用这种方法:

CellStyle style = originalCell.getCellStyle();
newCell.setCellStyle(style);

CellStyle cellstyle = workbook.createCellStyle();
cellstyle.cloneStyleFrom(originalCell.getCellStyle())

但不知何故,新的单元格样式具有与原始单元格样式不同的背景颜色。

这就是我的单元格背景的样子

这就是结果

有什么建议吗?

I'm trying to copy a cell style (background color, format, etc) and set that to another cell.

Using this methods:

CellStyle style = originalCell.getCellStyle();
newCell.setCellStyle(style);

CellStyle cellstyle = workbook.createCellStyle();
cellstyle.cloneStyleFrom(originalCell.getCellStyle())

But somehow the new cell style has different background color then the original one.

This is how my cell backgrounds looks like

Thats the result

Any suggestion why is that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文