org.jeecgframework.poi.word.entity.MyXWPFDocument Java Examples

The following examples show how to use org.jeecgframework.poi.word.entity.MyXWPFDocument. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ParseWord07.java    From autopoi with Apache License 2.0 6 votes vote down vote up
private void parseWordSetValue(MyXWPFDocument doc, Map<String, Object> map) throws Exception {
	// 第一步解析文档
	parseAllParagraphic(doc.getParagraphs(), map);
	// 第二步解析页眉,页脚
	parseHeaderAndFoot(doc, map);
	// 第三步解析所有表格
	XWPFTable table;
	Iterator<XWPFTable> itTable = doc.getTablesIterator();
	while (itTable.hasNext()) {
		table = itTable.next();
		if (table.getText().indexOf("{{") != -1) {
			parseThisTable(table, map);
		}
	}

}
 
Example #2
Source File: ParseWord07.java    From autopoi with Apache License 2.0 6 votes vote down vote up
/**
 * 解析页眉和页脚
 * 
 * @param doc
 * @param map
 * @throws Exception
 */
private void parseHeaderAndFoot(MyXWPFDocument doc, Map<String, Object> map) throws Exception {
	List<XWPFHeader> headerList = doc.getHeaderList();
	for (XWPFHeader xwpfHeader : headerList) {
		for (int i = 0; i < xwpfHeader.getListParagraph().size(); i++) {
			parseThisParagraph(xwpfHeader.getListParagraph().get(i), map);
		}
	}
	List<XWPFFooter> footerList = doc.getFooterList();
	for (XWPFFooter xwpfFooter : footerList) {
		for (int i = 0; i < xwpfFooter.getListParagraph().size(); i++) {
			parseThisParagraph(xwpfFooter.getListParagraph().get(i), map);
		}
	}

}
 
Example #3
Source File: ParseWord07.java    From jeasypoi with Apache License 2.0 6 votes vote down vote up
private void parseWordSetValue(MyXWPFDocument doc, Map<String, Object> map) throws Exception {
	// 第一步解析文档
	parseAllParagraphic(doc.getParagraphs(), map);
	// 第二步解析页眉,页脚
	parseHeaderAndFoot(doc, map);
	// 第三步解析所有表格
	XWPFTable table;
	Iterator<XWPFTable> itTable = doc.getTablesIterator();
	while (itTable.hasNext()) {
		table = itTable.next();
		if (table.getText().indexOf("{{") != -1) {
			parseThisTable(table, map);
		}
	}

}
 
Example #4
Source File: ParseWord07.java    From jeasypoi with Apache License 2.0 6 votes vote down vote up
/**
 * 解析页眉和页脚
 * 
 * @param doc
 * @param map
 * @throws Exception
 */
private void parseHeaderAndFoot(MyXWPFDocument doc, Map<String, Object> map) throws Exception {
	List<XWPFHeader> headerList = doc.getHeaderList();
	for (XWPFHeader xwpfHeader : headerList) {
		for (int i = 0; i < xwpfHeader.getListParagraph().size(); i++) {
			parseThisParagraph(xwpfHeader.getListParagraph().get(i), map);
		}
	}
	List<XWPFFooter> footerList = doc.getFooterList();
	for (XWPFFooter xwpfFooter : footerList) {
		for (int i = 0; i < xwpfFooter.getListParagraph().size(); i++) {
			parseThisParagraph(xwpfFooter.getListParagraph().get(i), map);
		}
	}

}
 
Example #5
Source File: ParseWord07.java    From easypoi with Apache License 2.0 6 votes vote down vote up
/**
 * 添加图片
 * 
 * @Author JueYue
 * @date 2013-11-20
 * @param obj
 * @param currentRun
 * @throws Exception
 */
private void addAnImage(WordImageEntity obj, XWPFRun currentRun) throws Exception {
    Object[] isAndType = PoiPublicUtil.getIsAndType(obj);
    String picId;
    try {
        picId = currentRun.getParagraph().getDocument()
            .addPictureData((byte[]) isAndType[0], (Integer) isAndType[1]);
        ((MyXWPFDocument) currentRun.getParagraph().getDocument()).createPicture(currentRun,
            picId,
            currentRun.getParagraph().getDocument()
                .getNextPicNameNumber((Integer) isAndType[1]), obj.getWidth(), obj.getHeight());

    } catch (Exception e) {
        LOGGER.error(e.getMessage(),e);
    }

}
 
Example #6
Source File: ParseWord07.java    From easypoi with Apache License 2.0 6 votes vote down vote up
private void parseWordSetValue(MyXWPFDocument doc, Map<String, Object> map) throws Exception {
    // 第一步解析文档
    parseAllParagraphic(doc.getParagraphs(), map);
    // 第二步解析页眉,页脚
    parseHeaderAndFoot(doc, map);
    // 第三步解析所有表格
    XWPFTable table;
    Iterator<XWPFTable> itTable = doc.getTablesIterator();
    while (itTable.hasNext()) {
        table = itTable.next();
        if (table.getText().indexOf("{{") != -1) {
            parseThisTable(table, map);
        }
    }

}
 
Example #7
Source File: ParseWord07.java    From easypoi with Apache License 2.0 6 votes vote down vote up
/**
 * 解析页眉和页脚
 * @param doc
 * @param map
 * @throws Exception
 */
private void parseHeaderAndFoot(MyXWPFDocument doc, Map<String, Object> map) throws Exception {
    List<XWPFHeader> headerList = doc.getHeaderList();
    for (XWPFHeader xwpfHeader : headerList) {
        for (int i = 0; i < xwpfHeader.getListParagraph().size(); i++) {
            parseThisParagraph(xwpfHeader.getListParagraph().get(i), map);
        }
    }
    List<XWPFFooter> footerList = doc.getFooterList();
    for (XWPFFooter xwpfFooter : footerList) {
        for (int i = 0; i < xwpfFooter.getListParagraph().size(); i++) {
            parseThisParagraph(xwpfFooter.getListParagraph().get(i), map);
        }
    }

}
 
Example #8
Source File: ParseWord07.java    From autopoi with Apache License 2.0 5 votes vote down vote up
/**
 * 添加图片
 * 
 * @Author JEECG
 * @date 2013-11-20
 * @param obj
 * @param currentRun
 * @throws Exception
 */
private void addAnImage(WordImageEntity obj, XWPFRun currentRun) throws Exception {
	Object[] isAndType = PoiPublicUtil.getIsAndType(obj);
	String picId;
	try {
		picId = currentRun.getParagraph().getDocument().addPictureData((byte[]) isAndType[0], (Integer) isAndType[1]);
		((MyXWPFDocument) currentRun.getParagraph().getDocument()).createPicture(currentRun, picId, currentRun.getParagraph().getDocument().getNextPicNameNumber((Integer) isAndType[1]), obj.getWidth(), obj.getHeight());

	} catch (Exception e) {
		LOGGER.error(e.getMessage(), e);
	}

}
 
Example #9
Source File: ParseWord07.java    From jeasypoi with Apache License 2.0 5 votes vote down vote up
/**
 * 添加图片
 * 
 * @Author JueYue
 * @date 2013-11-20
 * @param obj
 * @param currentRun
 * @throws Exception
 */
private void addAnImage(WordImageEntity obj, XWPFRun currentRun) throws Exception {
	Object[] isAndType = PoiPublicUtil.getIsAndType(obj);
	String picId;
	try {
		picId = currentRun.getParagraph().getDocument().addPictureData((byte[]) isAndType[0], (Integer) isAndType[1]);
		((MyXWPFDocument) currentRun.getParagraph().getDocument()).createPicture(currentRun, picId, currentRun.getParagraph().getDocument().getNextPicNameNumber((Integer) isAndType[1]), obj.getWidth(), obj.getHeight());

	} catch (Exception e) {
		LOGGER.error(e.getMessage(), e);
	}

}
 
Example #10
Source File: ParseWord07.java    From autopoi with Apache License 2.0 2 votes vote down vote up
/**
 * 解析07版的Word并且进行赋值
 * 
 * @Author JEECG
 * @date 2013-11-16
 * @return
 * @throws Exception
 */
public XWPFDocument parseWord(String url, Map<String, Object> map) throws Exception {
	MyXWPFDocument doc = WordCache.getXWPFDocumen(url);
	parseWordSetValue(doc, map);
	return doc;
}
 
Example #11
Source File: ParseWord07.java    From autopoi with Apache License 2.0 2 votes vote down vote up
/**
 * 解析07版的Word并且进行赋值
 * 
 * @Author JEECG
 * @date 2013-11-16
 * @return
 * @throws Exception
 */
public void parseWord(XWPFDocument document, Map<String, Object> map) throws Exception {
	parseWordSetValue((MyXWPFDocument) document, map);
}
 
Example #12
Source File: ParseWord07.java    From jeasypoi with Apache License 2.0 2 votes vote down vote up
/**
 * 解析07版的Word并且进行赋值
 * 
 * @Author JueYue
 * @date 2013-11-16
 * @return
 * @throws Exception
 */
public XWPFDocument parseWord(String url, Map<String, Object> map) throws Exception {
	MyXWPFDocument doc = WordCache.getXWPFDocumen(url);
	parseWordSetValue(doc, map);
	return doc;
}
 
Example #13
Source File: ParseWord07.java    From jeasypoi with Apache License 2.0 2 votes vote down vote up
/**
 * 解析07版的Word并且进行赋值
 * 
 * @Author JueYue
 * @date 2013-11-16
 * @return
 * @throws Exception
 */
public void parseWord(XWPFDocument document, Map<String, Object> map) throws Exception {
	parseWordSetValue((MyXWPFDocument) document, map);
}
 
Example #14
Source File: ParseWord07.java    From easypoi with Apache License 2.0 2 votes vote down vote up
/**
 * 解析07版的Word并且进行赋值
 * 
 * @Author JueYue
 * @date 2013-11-16
 * @return
 * @throws Exception
 */
public XWPFDocument parseWord(String url, Map<String, Object> map) throws Exception {
    MyXWPFDocument doc = WordCache.getXWPFDocumen(url);
    parseWordSetValue(doc, map);
    return doc;
}
 
Example #15
Source File: ParseWord07.java    From easypoi with Apache License 2.0 2 votes vote down vote up
/**
 * 解析07版的Word并且进行赋值
 * 
 * @Author JueYue
 * @date 2013-11-16
 * @return
 * @throws Exception
 */
public void parseWord(XWPFDocument document, Map<String, Object> map) throws Exception {
    parseWordSetValue((MyXWPFDocument) document, map);
}