POI导出的excel,ofiice打开出现上述的问题,只需要在导出excel的时候强制设置单元格的背景颜色为白色即可;

单元格的颜色设设置的时候,有背景颜色设置方法[setFillBackgroundColor()]和前景颜色设置方法[setFillForegroundColor()];设置的时候要区别开,根据需要调用相应的方法;

关于背景颜色和前景颜色:

前景颜色:一般指字体颜色

背景颜色:一般指单元格的填充颜色

         // 设置背景颜色
//         style.setFillBackgroundColor(new HSSFColor.WHITE().getIndex());
         //设置前景颜色 修复wps展示正常,office展示变黑问题
         style.setFillForegroundColor(new HSSFColor.WHITE().getIndex());

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-17
  • 2021-08-07
  • 2021-11-28
  • 2021-08-26
  • 2022-12-23
猜你喜欢
  • 2022-01-05
  • 2023-03-19
  • 2021-05-02
  • 2022-12-23
  • 2022-12-23
  • 2021-08-25
相关资源
相似解决方案