zoukankan      html  css  js  c++  java
  • IText 生成横向的doc文档

    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();
        }
    
    }
  • 相关阅读:
    变量1
    PHP 函数
    发送post请求
    XXE
    CSRF
    Html基础
    暴力破解
    Brup sute
    XSS
    URL 传参转义 (特殊符号转义)
  • 原文地址:https://www.cnblogs.com/wuyou/p/3236688.html
Copyright © 2011-2022 走看看