XSSFSheet (Javadoc XSSFSheet)
has a method addIgnoredErrors(...). SXSSFSheet (Javadoc SXSSFSheet) hasn't got this method.
How can I ignore errors in a SXSSFSheet based sheet?
I can't use XSSFSheet, because I have 105,000 Rows and XSSFSheet will blow up the memory.
I put a text field in the table that may consist of digits only. Shitty Excel will show up an Warning Number stored as text for this cells. Even if I set the CellType to STRING and format as Text "@", no matter in which order.
Minimal runnable Demo:
public void run() {
try {
final SXSSFWorkbook workbook = new SXSSFWorkbook(-1);
final DataFormat dataFormat = workbook.createDataFormat();
CellStyle styleDef;
styleDef = workbook.createCellStyle();
styleDef.setDataFormat(dataFormat.getFormat("@"));
final SXSSFSheet sheet = workbook.createSheet();
final SXSSFRow row = sheet.createRow(0);
final SXSSFCell cell = row.createCell(0);
final String text = "123";
cell.setCellType(CellType.STRING);
cell.setCellValue(text);
cell.setCellStyle(styleDef);
workbook.write(new FileOutputStream("test.xlsx"));
workbook.close();
// Hint from Axel Richter, to make it a full working example
workbook.dispose();
} catch (final Exception e) {
e.printStackTrace();
}
}