本文整理了Java中org.apache.poi.hssf.usermodel.HSSFPicture.getAnchor()
方法的一些代码示例,展示了HSSFPicture.getAnchor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HSSFPicture.getAnchor()
方法的具体详情如下:
包路径:org.apache.poi.hssf.usermodel.HSSFPicture
类名称:HSSFPicture
方法名:getAnchor
暂无
代码示例来源:origin: org.apache.poi/poi
/**
* @return the anchor that is used by this picture.
*/
@Override
public HSSFClientAnchor getClientAnchor() {
HSSFAnchor a = getAnchor();
return (a instanceof HSSFClientAnchor) ? (HSSFClientAnchor)a : null;
}
代码示例来源:origin: org.apache.poi/poi
/**
* Creates a picture.
*
* @param anchor the client anchor describes how this group is attached
* to the sheet.
* @return the newly created shape.
*/
public HSSFPicture createPicture(HSSFChildAnchor anchor, int pictureIndex) {
HSSFPicture shape = new HSSFPicture(this, anchor);
shape.setParent(this);
shape.setAnchor(anchor);
shape.setPictureIndex(pictureIndex);
shapes.add(shape);
onCreate(shape);
EscherSpRecord sp = shape.getEscherContainer().getChildById(EscherSpRecord.RECORD_ID);
if (shape.getAnchor().isHorizontallyFlipped()){
sp.setFlags(sp.getFlags() | EscherSpRecord.FLAG_FLIPHORIZ);
}
if (shape.getAnchor().isVerticallyFlipped()){
sp.setFlags(sp.getFlags() | EscherSpRecord.FLAG_FLIPVERT);
}
return shape;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* @return the anchor that is used by this picture.
*/
@Override
public HSSFClientAnchor getClientAnchor() {
HSSFAnchor a = getAnchor();
return (a instanceof HSSFClientAnchor) ? (HSSFClientAnchor)a : null;
}
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
HSSFClientAnchor anchor = (HSSFClientAnchor)getAnchor();
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* Creates a picture.
*
* @param anchor the client anchor describes how this group is attached
* to the sheet.
* @return the newly created shape.
*/
public HSSFPicture createPicture(HSSFChildAnchor anchor, int pictureIndex) {
HSSFPicture shape = new HSSFPicture(this, anchor);
shape.setParent(this);
shape.setAnchor(anchor);
shape.setPictureIndex(pictureIndex);
shapes.add(shape);
onCreate(shape);
EscherSpRecord sp = shape.getEscherContainer().getChildById(EscherSpRecord.RECORD_ID);
if (shape.getAnchor().isHorizontallyFlipped()){
sp.setFlags(sp.getFlags() | EscherSpRecord.FLAG_FLIPHORIZ);
}
if (shape.getAnchor().isVerticallyFlipped()){
sp.setFlags(sp.getFlags() | EscherSpRecord.FLAG_FLIPVERT);
}
return shape;
}
代码示例来源:origin: com.haulmont.thirdparty/poi
/**
* Creates a picture.
*
* @param anchor the client anchor describes how this group is attached
* to the sheet.
* @return the newly created shape.
*/
public HSSFPicture createPicture(HSSFChildAnchor anchor, int pictureIndex) {
HSSFPicture shape = new HSSFPicture(this, anchor);
shape.setParent(this);
shape.setAnchor(anchor);
shape.setPictureIndex(pictureIndex);
shapes.add(shape);
onCreate(shape);
EscherSpRecord sp = shape.getEscherContainer().getChildById(EscherSpRecord.RECORD_ID);
if (shape.getAnchor().isHorizontallyFlipped()){
sp.setFlags(sp.getFlags() | EscherSpRecord.FLAG_FLIPHORIZ);
}
if (shape.getAnchor().isVerticallyFlipped()){
sp.setFlags(sp.getFlags() | EscherSpRecord.FLAG_FLIPVERT);
}
return shape;
}
代码示例来源:origin: stackoverflow.com
int idColumn = ...;
int pictureColumn = ...;
HSSFSheet sheet = ...;
for (HSSFShape shape : sheet.getDrawingPatriarch().getChildren()) {
if (shape instanceof HSSFPicture) {
HSSFPicture picture = (HSSFPicture) shape;
HSSFClientAnchor anchor = (HSSFClientAnchor) picture.getAnchor();
// Ensure to use only relevant pictures
if (anchor.getCol1() == pictureColumn) {
// Use the row from the anchor
HSSFRow pictureRow = sheet.getRow(anchor.getRow1());
if (pictureRow != null) {
HSSFCell idCell = pictureRow.getCell(idColumn);
if (idCell != null) {
long employeeId = (long) idCell.getNumericCellValue();
myUserService.updatePortrait(employeeId, picture.getData());
}
}
}
}
}
代码示例来源:origin: com.haulmont.thirdparty/poi
HSSFClientAnchor anchor = (HSSFClientAnchor)getAnchor();
代码示例来源:origin: com.haulmont.thirdparty/poi
/**
* Resize the image
* <p>
* Please note, that this method works correctly only for workbooks
* with default font size (Arial 10pt for .xls).
* If the default font is changed the resized image can be streched vertically or horizontally.
* </p>
*
* @param scale the amount by which image dimensions are multiplied relative to the original size.
* <code>resize(1.0)</code> sets the original size, <code>resize(0.5)</code> resize to 50% of the original,
* <code>resize(2.0)</code> resizes to 200% of the original.
*/
public void resize(double scale){
HSSFClientAnchor anchor = (HSSFClientAnchor)getAnchor();
anchor.setAnchorType(2);
HSSFClientAnchor pref = getPreferredSize(scale);
int row2 = anchor.getRow1() + (pref.getRow2() - pref.getRow1());
int col2 = anchor.getCol1() + (pref.getCol2() - pref.getCol1());
anchor.setCol2((short)col2);
anchor.setDx1(0);
anchor.setDx2(pref.getDx2());
anchor.setRow2(row2);
anchor.setDy1(0);
anchor.setDy2(pref.getDy2());
}
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
/**
* Resize the image
* <p>
* Please note, that this method works correctly only for workbooks
* with default font size (Arial 10pt for .xls).
* If the default font is changed the resized image can be streched vertically or horizontally.
* </p>
*
* @param scale the amount by which image dimensions are multiplied relative to the original size.
* <code>resize(1.0)</code> sets the original size, <code>resize(0.5)</code> resize to 50% of the original,
* <code>resize(2.0)</code> resizes to 200% of the original.
*/
public void resize(double scale){
HSSFClientAnchor anchor = (HSSFClientAnchor)getAnchor();
anchor.setAnchorType(2);
HSSFClientAnchor pref = getPreferredSize(scale);
int row2 = anchor.getRow1() + (pref.getRow2() - pref.getRow1());
int col2 = anchor.getCol1() + (pref.getCol2() - pref.getCol1());
anchor.setCol2((short)col2);
anchor.setDx1(0);
anchor.setDx2(pref.getDx2());
anchor.setRow2(row2);
anchor.setDy1(0);
anchor.setDy2(pref.getDy2());
}
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
HSSFAnchor userAnchor = shape.getAnchor();
if (userAnchor.isHorizontallyFlipped())
sp.setFlags(sp.getFlags() | EscherSpRecord.FLAG_FLIPHORIZ);
代码示例来源:origin: com.haulmont.thirdparty/poi
HSSFAnchor userAnchor = shape.getAnchor();
if (userAnchor.isHorizontallyFlipped())
sp.setFlags(sp.getFlags() | EscherSpRecord.FLAG_FLIPHORIZ);
内容来源于网络,如有侵权,请联系作者删除!