public String addPictureData(InputStream is, int format) throws InvalidFormatException { try { byte[] data = IOUtils.toByteArray(is); return addPictureData(data, format); } catch (IOException e) { throw new POIXMLException(e); } }
@SuppressWarnings("resource") XWPFDocument doc = parent.getDocument(); relationId = doc.addPictureData(pictureData, pictureType); picData = (XWPFPictureData) doc.getRelationById(relationId);
public String addPictureData(InputStream is, int format) throws InvalidFormatException { try { byte[] data = IOUtils.toByteArray(is); return addPictureData(data, format); } catch (IOException e) { throw new POIXMLException(e); } }
public String addPictureData(InputStream is,int format) throws InvalidFormatException { try { byte[] data = IOUtils.toByteArray(is); return addPictureData(data, format); } catch (IOException e) { throw new POIXMLException(e); } }
/** * 添加图片 * * @author JueYue * 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.getDocument().addPictureData((byte[]) isAndType[0], (Integer) isAndType[1]); ((MyXWPFDocument) currentRun.getDocument()).createPicture(currentRun, picId, currentRun.getDocument() .getNextPicNameNumber((Integer) isAndType[1]), obj.getWidth(), obj.getHeight()); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } }
/** * 添加图片 * * @author JueYue * 2013-11-20 * @param obj * @param currentRun * @throws Exception */ private void addAnImage(ImageEntity obj, XWPFRun currentRun) throws Exception { Object[] isAndType = PoiPublicUtil.getIsAndType(obj); String picId; try { picId = currentRun.getDocument().addPictureData((byte[]) isAndType[0], (Integer) isAndType[1]); ((MyXWPFDocument) currentRun.getDocument()).createPicture(currentRun, picId, currentRun.getDocument() .getNextPicNameNumber((Integer) isAndType[1]), obj.getWidth(), obj.getHeight()); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } }
/** * 添加图片 * * @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); } }
/** * 添加图片 * * @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); } }
@SuppressWarnings("resource") XWPFDocument doc = parent.getDocument(); relationId = doc.addPictureData(pictureData, pictureType); picData = (XWPFPictureData) doc.getRelationById(relationId);
String relationId = doc.addPictureData(pictureData, pictureType); XWPFPictureData picData = (XWPFPictureData) doc.getRelationById(relationId);