Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Apache POI网格线在设置新的cellstyle后消失_Java_Excel_Apache Poi_Cell - Fatal编程技术网

Java Apache POI网格线在设置新的cellstyle后消失

Java Apache POI网格线在设置新的cellstyle后消失,java,excel,apache-poi,cell,Java,Excel,Apache Poi,Cell,我正在生成HSSF样式的工作簿 创建新单元样式后,网格线消失。我不想把BorderStyle.DORDER_放薄,因为这不仅仅是网格线。我有更大的优势。 我在sheet currentSheet.setDisplayGridlines中尝试过(false) 我的代码: HssfCellStyle hssfCellStyle = hssfWorkbook.createCellStyle Font hssfFont = this.getFontFor(rowCellStyle.cellFont) h

我正在生成HSSF样式的工作簿

创建新单元样式后,网格线消失。我不想把BorderStyle.DORDER_放薄,因为这不仅仅是网格线。我有更大的优势。 我在sheet currentSheet.setDisplayGridlines中尝试过(false)

我的代码:

HssfCellStyle hssfCellStyle = hssfWorkbook.createCellStyle
Font hssfFont = this.getFontFor(rowCellStyle.cellFont)
hssfCellStyle.setFont(hssfFont)
               hssfCellStyle.setFillForegroundColor(rowCellStyle.backgroundColor.hssfColor.getIndex)             
hssfCellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
因此,这将使gdi线消失

解决方案:

我有点傻。 默认网格线不是边框,所以如果您使用某种颜色,则默认网格线将填充该颜色。 默认单元格颜色是自动的->什么是透明的,因为可以看到默认网格


default color=new HSSFColor.AUTOMATIC()

您使用的是什么版本的POI?您是否尝试过在Excel中使您的单元格看起来像您想要的,然后在Apache POI中读取并检查其上的单元格样式?谢谢您的回答。我误解了默认网格,我认为它是一个正常的网格,但它不是。答案是贝娄。