HSSFRichTextString ts= new HSSFRichTextString(" 經審核,我司已同意其出庫申請。請你部按規定將托管銀行承兌匯票辦理出庫。" +
"我公司指派___________________(身份證號:_____________________________________)" +
"、___________________(身份證號:_____________________________________)" +
"和___________________(身份證號:_____________________________________)" +
"持本通知書辦理提票事項,並請你部將出庫票據移交_________________和_________________兩人簽收。");
________ 在宋體格式下顯示為_ _ ,所以將"___"字體設置為Arial,將文字字體設置為宋體
HSSFFont font = xls.createFont();
font.setFontHeightInPoints((short)10); // 設置字體大小
font.setFontName("宋體");
ts.applyFont(0, 45, font);
ts.applyFont(64, 70, font);
ts.applyFont(107, 109, font);
ts.applyFont(128, 134, font);
ts.applyFont(171, 173, font);
ts.applyFont(193, 198, font);
ts.applyFont(235, 258, font);
ts.applyFont(275, 275, font);
ts.applyFont(294, 299, font);
HSSFFont font1 = xls.createFont();
font1.setFontHeightInPoints((short)10); // 設置字體大小
font1.setFontName("Arial");
ts.applyFont(45, 64, font1);
ts.applyFont(70, 107, font1);
ts.applyFont(109, 128, font1);
ts.applyFont(134, 171, font1);
ts.applyFont(173, 192, font1);
ts.applyFont(198, 235, font1);
ts.applyFont(258, 275, font1);
ts.applyFont(276, 294, font1);
cell.setCellValue(ts);