Java code
public class CreateWordDemo {
public void createDocContext(String le) throws
DocumentException,
IOException {
// 设置纸张大小
Document document = new
Document(PageSize.A4);
// 建立一个书写器(Writer)与 document 对象关联,通过
书写器(Writer)可以将文档写入到磁盘中
RtfWriter2.getInstance(document, new
FileOutputStream(le));
document.open();
// 设置中文字体
BaseFont bfChinese =
BaseFont.createFont("STSongStd-Light",
"UniGB-UCS2-H",
BaseFont.NOT_EMBEDDED);
// 标题字体风格
Font titleFont = new Font(bfChinese, 12,
Font.BOLD);
评论0
最新资源