poi导入图片到word

package com.inspur.mng.project.config.action;


import java.io.IOException;
import java.io.InputStream;

import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlToken;
import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps;
import org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D;
import org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTInline;
  
/** 
 * @author POI 导出图片bug修复
 *  
 */  
public  class  CustomXWPFDocument extends XWPFDocument {  
    public CustomXWPFDocument(InputStream in) throws IOException {  
        super(in);  
    }  
  
    /** 
     *  
     */  
    public CustomXWPFDocument() {  
        super();  
        // TODO Auto-generated constructor stub   
    }  
  
    /** 
     * @param pkg 
     * @throws IOException 
     */  
    public CustomXWPFDocument(OPCPackage pkg) throws IOException {  
        super(pkg);  
        // TODO Auto-generated constructor stub   
    }  // picAttch 图片后面追加的字符串 可以是空格
    public void createPicture(XWPFParagraph paragraph,int id, int width, int height,String picAttch) {  
        final int EMU = 9525;  
        width *= EMU;  
        height *= EMU; 
// <span style="font-family: Arial, Helvetica, sans-serif;">getAllPictures()方法可以获得所有图片的属性</span>

        String blipId = getAllPictures().get(id).getPackageRelationship()  
    
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值