更新时间:2022-02-28 08:31:30
你可以这样做 whiteFont.setColor(new XSSFColor(new Color(255,255,255)));
但是,Apache POI 中有一个错误,正在切换黑白.看起来他们在 XSSFColor.java(查看 XSSFColor.correctRGB())以纠正 Excel 中的问题.Excel 可能已修复,但 Apache POI 未更新.
However, there is a bug in Apache POI, where it is switching black and white. It looks like they put a 'fix' in XSSFColor.java (look at XSSFColor.correctRGB()) to correct for a problem in Excel. It's likely that Excel was fixed, but Apache POI wasn't updated.
你可以这样做:whiteFont.setColor(HSSFColor.WHITE.index)
或 whiteFont.setColor(IndexedColors.WHITE.index);
(已弃用)
Instead you can do: whiteFont.setColor(HSSFColor.WHITE.index)
or whiteFont.setColor(IndexedColors.WHITE.index);
(this is deprecated)
或者如果你做 whiteFont.setColor(new XSSFColor(new Color(255,255,254)));
它会非常接近白色.
or if you do whiteFont.setColor(new XSSFColor(new Color(255,255,254)));
it'll be really close to white.