我想将文本字体设置为7.5到Excel工作表中的特定文本.我使用下面的代码来准备字体.
HSSFCellStyle txtStyle = (HSSFCellStyle)workbook.createCellStyle();
HSSFFont txtFont = (HSSFFont)workbook.createFont();
txtFont.setFontName("Arial");
txtFont.setFontHeightInPoints((short)7.5);
txtStyle.setFont(txtFont);
Run Code Online (Sandbox Code Playgroud)
但由于短类型转换,它总是将字体设为7,因此excel表中的目标文本采用字体7而不是7.5.我也尝试过'setFontHeight'方法,但这也是简短的参数.那么有什么方法可以将文本字体设置为十进制数?