本文整理了Java中org.apache.poi.xslf.usermodel.XSLFSheet.addRelation()
方法的一些代码示例,展示了XSLFSheet.addRelation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSLFSheet.addRelation()
方法的具体详情如下:
包路径:org.apache.poi.xslf.usermodel.XSLFSheet
类名称:XSLFSheet
方法名:addRelation
暂无
代码示例来源:origin: org.apache.poi/poi-ooxml
@Override
public XSLFPictureShape createPicture(PictureData pictureData){
if (!(pictureData instanceof XSLFPictureData)) {
throw new IllegalArgumentException("pictureData needs to be of type XSLFPictureData");
}
RelationPart rp = addRelation(null, XSLFRelation.IMAGES, (XSLFPictureData)pictureData);
XSLFPictureShape sh = getDrawing().createPicture(rp.getRelationship().getId());
new DrawPictureShape(sh).resize();
getShapes().add(sh);
sh.setParent(this);
return sh;
}
代码示例来源:origin: org.apache.poi/poi-ooxml
@Override
public XSLFPictureShape createPicture(PictureData pictureData){
if (!(pictureData instanceof XSLFPictureData)) {
throw new IllegalArgumentException("pictureData needs to be of type XSLFPictureData");
}
RelationPart rp = getSheet().addRelation(null, XSLFRelation.IMAGES, (XSLFPictureData)pictureData);
XSLFPictureShape sh = getDrawing().createPicture(rp.getRelationship().getId());
new DrawPictureShape(sh).resize();
_shapes.add(sh);
sh.setParent(this);
return sh;
}
代码示例来源:origin: org.apache.poi/poi-ooxml
@Override
public XSLFObjectShape createOleShape(PictureData pictureData) {
if (!(pictureData instanceof XSLFPictureData)) {
throw new IllegalArgumentException("pictureData needs to be of type XSLFPictureData");
}
RelationPart rp = addRelation(null, XSLFRelation.IMAGES, (XSLFPictureData)pictureData);
XSLFObjectShape sh = getDrawing().createOleShape(rp.getRelationship().getId());
CTOleObject oleObj = sh.getCTOleObject();
Dimension dim = pictureData.getImageDimension();
oleObj.setImgW(Units.toEMU(dim.getWidth()));
oleObj.setImgH(Units.toEMU(dim.getHeight()));
getShapes().add(sh);
sh.setParent(this);
return sh;
}
代码示例来源:origin: org.apache.poi/poi-ooxml
@Override
public XSLFObjectShape createOleShape(PictureData pictureData) {
if (!(pictureData instanceof XSLFPictureData)) {
throw new IllegalArgumentException("pictureData needs to be of type XSLFPictureData");
}
RelationPart rp = getSheet().addRelation(null, XSLFRelation.IMAGES, (XSLFPictureData)pictureData);
XSLFObjectShape sh = getDrawing().createOleShape(rp.getRelationship().getId());
CTOleObject oleObj = sh.getCTOleObject();
Dimension dim = pictureData.getImageDimension();
oleObj.setImgW(Units.toEMU(dim.getWidth()));
oleObj.setImgH(Units.toEMU(dim.getHeight()));
getShapes().add(sh);
sh.setParent(this);
return sh;
}
代码示例来源:origin: org.apache.poi/poi-ooxml
@Override
public void linkToSlide(Slide<XSLFShape,XSLFTextParagraph> slide) {
if (_link.isSetId() && !_link.getId().isEmpty()) {
_sheet.getPackagePart().removeRelationship(_link.getId());
}
RelationPart rp = _sheet.addRelation(null, XSLFRelation.SLIDE, (XSLFSheet) slide);
_link.setId(rp.getRelationship().getId());
_link.setAction("ppaction://hlinksldjump");
}
代码示例来源:origin: org.apache.poi/poi-ooxml
RelationPart rp = _sheet.addRelation(null, XSLFRelation.SLIDE, pp);
_link.setId(rp.getRelationship().getId());
_link.setAction(src._link.getAction());
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* Import a picture data from another document.
*
* @param blipId ID of the package relationship to retrieve.
* @param parent parent document containing the data to import
* @return ID of the created relationship
*/
String importBlip(String blipId, POIXMLDocumentPart parent) {
final XSLFPictureData parData = parent.getRelationPartById(blipId).getDocumentPart();
final XSLFPictureData pictureData;
if (getPackagePart().getPackage() == parent.getPackagePart().getPackage()) {
// handle ref counter correct, if the parent document is the same as this
pictureData = parData;
} else {
XMLSlideShow ppt = getSlideShow();
pictureData = ppt.addPicture(parData.getData(), parData.getType());
}
RelationPart rp = addRelation(blipId, XSLFRelation.IMAGES, pictureData);
return rp.getRelationship().getId();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
@Override
public XSLFPictureShape createPicture(PictureData pictureData){
if (!(pictureData instanceof XSLFPictureData)) {
throw new IllegalArgumentException("pictureData needs to be of type XSLFPictureData");
}
RelationPart rp = addRelation(null, XSLFRelation.IMAGES, (XSLFPictureData)pictureData);
XSLFPictureShape sh = getDrawing().createPicture(rp.getRelationship().getId());
new DrawPictureShape(sh).resize();
getShapes().add(sh);
sh.setParent(this);
return sh;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
@Override
public XSLFPictureShape createPicture(PictureData pictureData){
if (!(pictureData instanceof XSLFPictureData)) {
throw new IllegalArgumentException("pictureData needs to be of type XSLFPictureData");
}
RelationPart rp = getSheet().addRelation(null, XSLFRelation.IMAGES, (XSLFPictureData)pictureData);
XSLFPictureShape sh = getDrawing().createPicture(rp.getRelationship().getId());
new DrawPictureShape(sh).resize();
_shapes.add(sh);
sh.setParent(this);
return sh;
}
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
public XSLFPictureShape createPicture(int pictureIndex){
List<PackagePart> pics = getPackagePart().getPackage()
.getPartsByName(Pattern.compile("/ppt/media/image" + (pictureIndex + 1) + ".*?"));
if(pics.size() == 0) {
throw new IllegalArgumentException("Picture with index=" + pictureIndex + " was not found");
}
PackagePart pic = pics.get(0);
PackageRelationship rel = getPackagePart().addRelationship(
pic.getPartName(), TargetMode.INTERNAL, XSLFRelation.IMAGES.getRelation());
addRelation(rel.getId(), new XSLFPictureData(pic, rel));
XSLFPictureShape sh = getDrawing().createPicture(rel.getId());
sh.resize();
getShapeList().add(sh);
return sh;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
@Override
public XSLFObjectShape createOleShape(PictureData pictureData) {
if (!(pictureData instanceof XSLFPictureData)) {
throw new IllegalArgumentException("pictureData needs to be of type XSLFPictureData");
}
RelationPart rp = addRelation(null, XSLFRelation.IMAGES, (XSLFPictureData)pictureData);
XSLFObjectShape sh = getDrawing().createOleShape(rp.getRelationship().getId());
CTOleObject oleObj = sh.getCTOleObject();
Dimension dim = pictureData.getImageDimension();
oleObj.setImgW(Units.toEMU(dim.getWidth()));
oleObj.setImgH(Units.toEMU(dim.getHeight()));
getShapes().add(sh);
sh.setParent(this);
return sh;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
@Override
public XSLFObjectShape createOleShape(PictureData pictureData) {
if (!(pictureData instanceof XSLFPictureData)) {
throw new IllegalArgumentException("pictureData needs to be of type XSLFPictureData");
}
RelationPart rp = getSheet().addRelation(null, XSLFRelation.IMAGES, (XSLFPictureData)pictureData);
XSLFObjectShape sh = getDrawing().createOleShape(rp.getRelationship().getId());
CTOleObject oleObj = sh.getCTOleObject();
Dimension dim = pictureData.getImageDimension();
oleObj.setImgW(Units.toEMU(dim.getWidth()));
oleObj.setImgH(Units.toEMU(dim.getHeight()));
getShapes().add(sh);
sh.setParent(this);
return sh;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
@Override
public void linkToSlide(Slide<XSLFShape,XSLFTextParagraph> slide) {
if (_link.isSetId() && !_link.getId().isEmpty()) {
_sheet.getPackagePart().removeRelationship(_link.getId());
}
RelationPart rp = _sheet.addRelation(null, XSLFRelation.SLIDE, (XSLFSheet) slide);
_link.setId(rp.getRelationship().getId());
_link.setAction("ppaction://hlinksldjump");
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
RelationPart rp = _sheet.addRelation(null, XSLFRelation.SLIDE, pp);
_link.setId(rp.getRelationship().getId());
_link.setAction(src._link.getAction());
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* Import a picture data from another document.
*
* @param blipId ID of the package relationship to retrieve.
* @param parent parent document containing the data to import
* @return ID of the created relationship
*/
String importBlip(String blipId, POIXMLDocumentPart parent) {
final XSLFPictureData parData = parent.getRelationPartById(blipId).getDocumentPart();
final XSLFPictureData pictureData;
if (getPackagePart().getPackage() == parent.getPackagePart().getPackage()) {
// handle ref counter correct, if the parent document is the same as this
pictureData = parData;
} else {
XMLSlideShow ppt = getSlideShow();
pictureData = ppt.addPicture(parData.getData(), parData.getType());
}
RelationPart rp = addRelation(blipId, XSLFRelation.IMAGES, pictureData);
return rp.getRelationship().getId();
}
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
/**
* Import a picture data from another document.
*
* @param blipId ID of the package relationship to retrieve.
* @param packagePart package part containing the data to import
* @return ID of the created relationship
*/
String importBlip(String blipId, PackagePart packagePart) {
PackageRelationship blipRel = packagePart.getRelationship(blipId);
PackagePart blipPart;
try {
blipPart = packagePart.getRelatedPart(blipRel);
} catch (InvalidFormatException e){
throw new POIXMLException(e);
}
XSLFPictureData data = new XSLFPictureData(blipPart, null);
XMLSlideShow ppt = getSlideShow();
int pictureIdx = ppt.addPicture(data.getData(), data.getPictureType());
PackagePart pic = ppt.getAllPictures().get(pictureIdx).getPackagePart();
PackageRelationship rel = getPackagePart().addRelationship(
pic.getPartName(), TargetMode.INTERNAL, blipRel.getRelationshipType());
addRelation(rel.getId(), new XSLFPictureData(pic, rel));
return rel.getId();
}
}
内容来源于网络,如有侵权,请联系作者删除!