// Create a new workbook Workbook workbook = new Workbook(); Object[][] data = new Object[][]{ {"Name", "City", "Birthday", "Eye color", "Weight", "Height"}, {"Richard", "New York", LocalDateTime.of(1968, 6, 8, 0, 0, 0), "Blue", "67", "165"}, {"Damon", "Washington", LocalDateTime.of(1986, 2, 2, 0, 0, 0), "Hazel", "76", "176"}, {"Angela", "Washington", LocalDateTime.of(1993, 2, 15, 0, 0, 0), "Brown", "68", "145"} }; // Following code does not ignore the error of the first range. IWorksheet worksheet = workbook.getWorksheets().get(0); worksheet.getRange("A:F").setColumnWidth(15); worksheet.getRange("A1:F1").merge(); worksheet.getRange("A1:F1").setValue("Range errors not ignored"); worksheet.getRange("A1:F1").getFont().setBold(true); worksheet.getRange("A1:F1").setHorizontalAlignment(HorizontalAlignment.Center); worksheet.getRange("A2:F5").setValue(data); worksheet.getTables().add(worksheet.getRange("A2:F5"), true); // Following code ignores the error of the second range. worksheet.getRange("A7:F7").merge(); worksheet.getRange("A7:F7").setValue("Range errors ignored"); worksheet.getRange("A7:F7").getFont().setBold(true); worksheet.getRange("A7:F7").setHorizontalAlignment(HorizontalAlignment.Center); worksheet.getRange("A8:F11").setValue(data); worksheet.getTables().add(worksheet.getRange("A8:F11"), true); worksheet.getRange("A8:F11").setIgnoredError(EnumSet.allOf(IgnoredErrorType.class)); // Save to an excel file workbook.save("IgnoreRangeError.xlsx");