简体   繁体   中英

hyphen is converted into diamond black question mark, while setting Excel column header using apache POI

work book creation

HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet dashboardData = workbook.createSheet("name of the excel sheet");

this is where I am creating the header

cell = row.createCell(3);
cell.setCellValue("Subscriber Count - Active");
cell.setCellStyle(style);

The black diamond with a question mark is a missing-character symbol: The "hyphen" in your header is a non-ascii character (probably inserted by your text editor in place of a typed "-"), which is not available in the font you are using for display. There is also an ascii hyphen character, but clearly you are not using it.

Usually this happens when a text editor (eg, Word) replaces a typed hyphen, quote , or other character with a typographically nicer but less widely available symbol. This is a well-known source of problems with online text. Sounds like you copy-pasted the offending text from elsewhere, so to fix the problem, simply edit your code in your programming editor or API and manually type in an ascii hyphen.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM