package com.text.exportpdf; import java.io.IOException; import com.lowagie.text.*; import com.lowagie.text.pdf.BaseFont; public class PdfParagraph extends Paragraph { private static final long serialVersionUID = -244970043180837974L; public PdfParagraph(String content) { super(content, getChineseFont(12, false)); } public PdfParagraph(String content, int fontSize, boolean isBold) { super(content, getChineseFont(fontSize, isBold)); } // ��������-������������ protected static Font getChineseFont(int nfontsize, boolean isBold) { BaseFont bfChinese; Font fontChinese = null; try { bfChinese = BaseFont.createFont("c://windows//fonts//simsun.ttc,1", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); if (isBold) { fontChinese = new Font(bfChinese, nfontsize, Font.BOLD); } else { fontChinese = new Font(bfChinese, nfontsize, Font.NORMAL); } } catch (DocumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return fontChinese; } // ת������ protected Cell ChangeCell(String str, int nfontsize, boolean isBold) throws IOException, BadElementException, DocumentException { Phrase ph = ChangeChinese(str, nfontsize, isBold); Cell cell = new Cell(ph); // cell.setBorderWidth(3); return cell; } // ת������ protected Chunk ChangeChunk(String str, int nfontsize, boolean isBold) throws IOException, BadElementException, DocumentException { Font FontChinese = getChineseFont(nfontsize, isBold); Chunk chunk = new Chunk(str, FontChinese); return chunk; } // ת������ protected Phrase ChangeChinese(String str, int nfontsize, boolean isBold) throws IOException, BadElementException, DocumentException { Font FontChinese = getChineseFont(nfontsize, isBold); Phrase ph = new Phrase(str, FontChinese); return ph; } }

lcqlcl LV11
2023年8月29日
funcrit LV2
2022年7月18日
beibei2020 LV12
2021年12月1日
llm9016 LV1
2021年10月26日
yy0000 LV1
2021年3月25日
yangtongyong LV16
2020年12月15日
2235140624 LV17
2020年12月5日
tangsheng LV10
2020年9月15日
shiopaaa LV13
2020年6月17日
乐乐0o0 LV1
2020年6月10日

wbbhappy LV13
2024年1月10日
XG_Yang LV1
2023年12月27日
EFWAGGFAWGR
2023年10月18日
暂无贡献等级
lcqlcl LV11
2023年8月29日
Niderongyan LV9
2023年5月26日
sunjianping LV11
2023年5月14日
xinshofh LV9
2023年2月7日
zdh3907 LV15
2022年11月19日
best2018 LV46
2022年10月13日
newhaijun LV16
2022年8月31日