I need to generate an .xls (Excel) file, using the Java library Apache POI for spreadsheets.
The file will contain a list of phone numbers in column A, formatted as \"02
A better way to set it now using POI is to use the BuiltinFormats
class.
Eg:
To convert the column type to numeric
CellStyle numericStyle = workbook.createCellStyle();
numericStyle.setDataFormat(BuiltinFormats.getBuiltinFormat(2)); // 2 For Number
worksheet.setDefaultColumnStyle(colId, numericStyle);
The complete list of BuiltinFormats
formats can be seen, here