/** * Add the indexed picture to this drawing relations * * @param pictureIndex * the index of the picture in the workbook collection of * pictures, * {@link org.apache.poi.xssf.usermodel.XSSFWorkbook#getAllPictures()} * . */ @SuppressWarnings("resource") protected PackageRelationship addPictureReference(int pictureIndex) { XSSFWorkbook wb = (XSSFWorkbook) getParent().getParent(); XSSFPictureData data = wb.getAllPictures().get(pictureIndex); XSSFPictureData pic = new XSSFPictureData(data.getPackagePart()); RelationPart rp = addRelation(null, XSSFRelation.IMAGES, pic); return rp.getRelationship(); }
/** * Add the indexed picture to this drawing relations * * @param pictureIndex * the index of the picture in the workbook collection of * pictures, * {@link org.apache.poi.xssf.usermodel.XSSFWorkbook#getAllPictures()} * . */ @SuppressWarnings("resource") protected PackageRelationship addPictureReference(int pictureIndex) { XSSFWorkbook wb = (XSSFWorkbook) getParent().getParent(); XSSFPictureData data = wb.getAllPictures().get(pictureIndex); XSSFPictureData pic = new XSSFPictureData(data.getPackagePart()); RelationPart rp = addRelation(null, XSSFRelation.IMAGES, pic); return rp.getRelationship(); }
/** * Add the indexed picture to this drawing relations * * @param pictureIndex the index of the picture in the workbook collection of pictures, * {@link org.apache.poi.xssf.usermodel.XSSFWorkbook#getAllPictures()} . */ protected PackageRelationship addPictureReference(int pictureIndex){ XSSFWorkbook wb = (XSSFWorkbook)getParent().getParent(); XSSFPictureData data = wb.getAllPictures().get(pictureIndex); PackagePartName ppName = data.getPackagePart().getPartName(); PackageRelationship rel = getPackagePart().addRelationship(ppName, TargetMode.INTERNAL, XSSFRelation.IMAGES.getRelation()); addRelation(rel.getId(),new XSSFPictureData(data.getPackagePart(), rel)); return rel; }