https://issues.apache.org/bugzilla/show_bug.cgi?id=50315
Summary: XSSF sheet.setAutoFilter() crashes Excel by sorting.
Product: POI
Version: 3.7
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: XSSF
AssignedTo: [email protected]
ReportedBy: [email protected]
Created an attachment (id=26330)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=26330)
two .xlsx files, one's autofilter created by POI, the other one's created
manually.
Steps to Reproduce:
After using the following code to generate a XLSX file, if you open that
generated file (I attached here as "AutofilterGeneratedWithPOI.xlsx" in the zip
file) and click autofilter to sort any of the columns, MS Excel would crash.
However, if you delete the autofilter and using Excel to add it back again (I
attached here as "AutofilterGeneratedWithinExcel.xlsx"), everything would work
just fine. I recreated this scenario on two boxes and two separated projects.
Actual Results:
Excel Application Crashes.
Build Date & Platform:
Windows XP, NetBean, Excel 2007, 10/28/2011
Additional Builds and Platforms:
Windows XP, RAD 7.5 11/15/2011, samething happens.
#####################################################################
import java.io.FileOutputStream;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class RptJobController {
public static void main(String args[])
{
FileOutputStream fileOut = null;
try {
XSSFWorkbook wb = new XSSFWorkbook();
fileOut = new FileOutputStream("c:\\workbook.xlsx");
XSSFSheet sheet = wb.createSheet("new sheet");
// Create a row and put some cells in it.
XSSFRow row = sheet.createRow((short) 0);
// Create a cell and put a value in it.
row.createCell(0).setCellValue("irrelevant");
row.createCell(1).setCellValue("Number");
row.createCell(2).setCellValue("String");
row = sheet.createRow((short) 1);
row.createCell(1).setCellValue(1);
row.createCell(2).setCellValue("This is a string");
row = sheet.createRow((short) 2);
row.createCell(1).setCellValue(2);
row.createCell(2).setCellValue("This is a string");
row = sheet.createRow((short) 3);
row.createCell(1).setCellValue(3);
row.createCell(2).setCellValue("This is a string");
sheet.setAutoFilter(CellRangeAddress.valueOf("B1:C1"));
sheet.autoSizeColumn((short) 2);
wb.write(fileOut);
fileOut.close();
} catch (Exception ex) {
}
}
}
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]