Created attachment 29536 [details] Output I have a nested grouping with one parent and two children. The first level is expanded. The first child is expanded and the second one collapsed. I expand/collapse the groups using setRowGroupCollapsed. The problem is that if I set the second child as NOT expanded, the first one is also closed (see attachment) Here the code: import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class ExcelGroupRowTest { /** * @param args */ public static void main(String[] args) { try{ Workbook wb = new XSSFWorkbook(); Sheet sheet = wb.createSheet("Mysheet"); sheet.groupRow(1, 20); sheet.setRowGroupCollapsed(1, false); sheet.groupRow(5, 10); sheet.setRowGroupCollapsed(5, false); sheet.groupRow(12, 14); sheet.setRowGroupCollapsed(12, true); FileOutputStream fileOut = new FileOutputStream("workbook.xlsx"); wb.write(fileOut); fileOut.close(); }catch (IOException e){ e.printStackTrace(); } } }
I have looked at the source code, one possible patch would be to modify the writeHidden method in this way: private int writeHidden(XSSFRow xRow, int rowIndex, boolean hidden) { int level = xRow.getCTRow().getOutlineLevel(); int currentRow; for (currentRow = rowIndex; currentRow < getLastRowNum(); currentRow++) { if (getRow(currentRow) == null || getRow(currentRow).getCTRow().getOutlineLevel() < level) { break; }else{ getRow(currentRow).getCTRow().setHidden(hidden); } } return currentRow; }
*** Bug 53582 has been marked as a duplicate of this bug. ***
still no official fix for this Bug?