简体   繁体   English

连字号转换为菱形黑色问号,同时使用apache POI设置Excel列标题

[英]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. 带问号的黑色菱形是缺少字符的符号:标题中的“连字符”是非ASCII字符(可能由文本编辑器代替了键入的“-”插入),但在用于显示的字体。 There is also an ascii hyphen character, but clearly you are not using it. 还有一个ascii连字符,但显然您没有使用它。

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. 通常,当文本编辑器(例如Word)用印刷上更好但使用范围较广的符号替换键入的连字符, 引号或其他字符时,会发生这种情况。 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. 听起来您是从其他地方复制粘贴了有问题的文本,所以要解决此问题,只需在编程编辑器或API中编辑代码,然后手动输入ascii连字符即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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