Try this:
import java.io.FileOutputStream;
import org.apache.poi.xssf.streaming.*;
class CreateSXSSFUnicode {
public static void main(String[] args) throws Exception {
char st = '\u2713';
String[] headers = new String[] {"Area", "MOB Target", "Area Result", "MOB > Area"};
try (SXSSFWorkbook workbook = new SXSSFWorkbook();
FileOutputStream fileout = new FileOutputStream("Excel.xlsx") ) {
SXSSFSheet sheet = workbook.createSheet();
SXSSFRow row;
int rowNum = 0;
row = sheet.createRow(rowNum++);
for (int c = 0; c < headers.length; c++) {
row.createCell(c).setCellValue(headers[c]);
}
row = sheet.createRow(rowNum++);
int c = 0;
row.createCell(c++).setCellValue("City");
row.createCell(c++).setCellValue("85%");
row.createCell(c++).setCellValue("80%");
//row.createCell(c++).setCellValue(st); // does not work as st is a char
row.createCell(c++).setCellValue(String.valueOf(st)); // this works
workbook.write(fileout);
workbook.dispose();
}
}
}
Result: