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
Here's some example code inspired by Vlad's answer:
DataFormat fmt = workbook.createDataFormat();
CellStyle textStyle = workbook.createCellStyle();
textStyle.setDataFormat(fmt.getFormat("@"));
worksheet.setDefaultColumnStyle(0, textStyle);
The above code sets the default style for the first column of worksheet to TEXT.
Thanks, Vlad!