/** * Adds a picture to the document. * * @param is The stream to read image from * @param format The format of the picture. * @return the index to this picture (0 based), the added picture can be obtained from {@link #getAllPictures()} . * @throws InvalidFormatException If the format of the picture is not known. * @throws IOException If reading the picture-data from the stream fails. */ public String addPictureData(InputStream is, int format) throws InvalidFormatException, IOException { byte[] data = IOUtils.toByteArray(is); return addPictureData(data, format); }
relationId = headerFooter.addPictureData(pictureData, pictureType); picData = (XWPFPictureData) headerFooter.getRelationById(relationId); } else {
/** * Adds a picture to the document. * * @param is The stream to read image from * @param format The format of the picture. * @return the index to this picture (0 based), the added picture can be obtained from {@link #getAllPictures()} . * @throws InvalidFormatException If the format of the picture is not known. * @throws IOException If reading the picture-data from the stream fails. */ public String addPictureData(InputStream is, int format) throws InvalidFormatException, IOException { byte[] data = IOUtils.toByteArray(is); return addPictureData(data, format); }
/** * Adds a picture to the document. * * @param is The stream to read image from * @param format The format of the picture. * * @return the index to this picture (0 based), the added picture can be obtained from {@link #getAllPictures()} . * @throws InvalidFormatException * @throws IOException */ public String addPictureData(InputStream is, int format) throws InvalidFormatException,IOException { byte[] data = IOUtils.toByteArray(is); return addPictureData(data,format); }
relationId = headerFooter.addPictureData(pictureData, pictureType); picData = (XWPFPictureData) headerFooter.getRelationById(relationId); } else {