https://bz.apache.org/bugzilla/show_bug.cgi?id=69267
Bug ID: 69267 Summary: Inconsistent Behavior in Grouping and Ungrouping Columns in Apache POI Product: POI Version: unspecified Hardware: PC OS: Mac OS X 10.1 Status: NEW Severity: normal Priority: P2 Component: POI Overall Assignee: dev@poi.apache.org Reporter: nikknp.du...@gmail.com Target Milestone: --- I encountered an issue while working with Apache POI to programmatically group and ungroup columns in an Excel sheet. The problem arises when attempting to first group multiple sets of columns (e.g., columns 1-3, 7-10, and 10-11) and then ungroup them immediately afterward. Despite using the ungroupColumn method to remove the grouping, the resulting Excel file still shows grouped columns or exhibits unexpected behavior, such as the persistence of collapsed groups or partial ungrouping. The expected behavior is that the resulting file should have no grouped columns after the ungrouping operation is applied. This issue impacts the accuracy and reliability of generating Excel files with dynamic grouping and ungrouping requirements. The code used to reproduce this issue is as follows: import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import java.io.FileOutputStream; import java.io.IOException; public class GroupUngroupColumnsExample { public static void main(String[] args) { // Create a new workbook and a sheet Workbook workbook = new XSSFWorkbook(); Sheet sheet = workbook.createSheet("Example Sheet"); // Group columns 1-3 (index 0-2) sheet.groupColumn(0, 2); // Group columns 7-10 (index 6-9) sheet.groupColumn(6, 9); // Group columns 10-11 (index 9-10) sheet.groupColumn(9, 10); // Now ungroup the columns // Ungroup columns 1-3 (index 0-2) sheet.ungroupColumn(0, 2); // Ungroup columns 7-10 (index 6-9) sheet.ungroupColumn(6, 9); // Ungroup columns 10-11 (index 9-10) sheet.ungroupColumn(9, 10); // Write the output to a file try (FileOutputStream fileOut = new FileOutputStream("UngroupedColumns.xlsx")) { workbook.write(fileOut); } catch (IOException e) { e.printStackTrace(); } // Close the workbook try { workbook.close(); } catch (IOException e) { e.printStackTrace(); } System.out.println("Excel file generated successfully."); } } -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org