poi HSSFRichTextString 对cell中的每一段文字设置字体

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);

转载于:https://www.cnblogs.com/hyiam/p/3624983.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值