博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
IText 生成横向的doc文档
阅读量:4588 次
发布时间:2019-06-09

本文共 780 字,大约阅读时间需要 2 分钟。

IText生成doc文档需要三个包:iTextAsian.jar,iText-rtf-2.1.4.jar,iText-2.1.4.jar

亲测无误,代码如下:

import com.lowagie.text.*;import com.lowagie.text.Rectangle;import com.lowagie.text.rtf.RtfWriter2;import java.io.FileOutputStream;/** * 纸张方向横向测试 * User: HYY * Date: 13-8-1 * Time: 下午9:54 * To change this template use File | Settings | File Templates. */public class RotatePageTest {      public static void main(String[] args) throws Exception {        //设置纸张的大小对象        Rectangle rectangle = new Rectangle(PageSize.A4);        // 创建word文档,并旋转,使其横向        Document document = new Document(rectangle.rotate());        RtfWriter2.getInstance(document, new FileOutputStream("C:/無幽之路IText教程.doc"));        document.open();        document.close();    }}

 

转载于:https://www.cnblogs.com/wuyou/p/3236688.html

你可能感兴趣的文章
c# 私有构造函数
查看>>
c# 构造函数
查看>>
c# 静态方法
查看>>
c# 析构函数
查看>>
c# 字段成员
查看>>
c# 静态变量
查看>>
c# 值传递
查看>>
c# 输出参数-out
查看>>
c# 静态构造函数
查看>>
c# 属性说明
查看>>
c# 方法成员
查看>>
c# 定义和调用索引器
查看>>
c# 引用参数-ref
查看>>
c# 多态
查看>>
c# 参数数组
查看>>
c# 虚属性
查看>>
c# 子类的声明
查看>>
c# 类嵌套
查看>>
c# 方法的隐藏
查看>>
c# 接口实现
查看>>