diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetAutosizeColumn.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetAutosizeColumn.java index 5adc9ee78..d4b68a0c8 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetAutosizeColumn.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetAutosizeColumn.java @@ -252,4 +252,43 @@ public abstract class BaseTestSheetAutosizeColumn extends TestCase { assertTrue(sheet.getColumnWidth(0) > defaulWidth); } + + /** + * Auto-Sizing a column needs to work when we have rows + * passed the 32767 boundary. See bug #48079 + */ + public void testLargeRowNumbers() throws Exception { + Workbook workbook = _testDataProvider.createWorkbook(); + Sheet sheet = workbook.createSheet(); + + Row r0 = sheet.createRow(0); + r0.createCell(0).setCellValue("I am ROW 0"); + Row r200 = sheet.createRow(200); + r200.createCell(0).setCellValue("I am ROW 200"); + + // This should work fine + sheet.autoSizeColumn(0); + + // Get close to 32767 + Row r32765 = sheet.createRow(32765); + r32765.createCell(0).setCellValue("Nearly there..."); + sheet.autoSizeColumn(0); + + // To it + Row r32767 = sheet.createRow(32767); + r32767.createCell(0).setCellValue("At the boundary"); + sheet.autoSizeColumn(0); + + // And passed it + Row r32768 = sheet.createRow(32768); + r32768.createCell(0).setCellValue("Passed"); + Row r32769 = sheet.createRow(32769); + r32769.createCell(0).setCellValue("More Passed"); + sheet.autoSizeColumn(0); + + // Long way passed + Row r60708 = sheet.createRow(60708); + r60708.createCell(0).setCellValue("Near the end"); + sheet.autoSizeColumn(0); + } } \ No newline at end of file