本文整理汇总了Java中org.apache.poi.xssf.usermodel.XSSFShape类的典型用法代码示例。如果您正苦于以下问题:Java XSSFShape类的具体用法?Java XSSFShape怎么用?Java XSSFShape使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XSSFShape类属于org.apache.poi.xssf.usermodel包,在下文中一共展示了XSSFShape类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getSheetPictrues07
import org.apache.poi.xssf.usermodel.XSSFShape; //导入依赖的package包/类
/**
* 获取Excel2007图片
*
* @param sheet
* 当前sheet对象
* @param workbook
* 工作簿对象
* @return Map key:图片单元格索引(1_1)String,value:图片流PictureData
*/
public static Map<String, PictureData> getSheetPictrues07(XSSFSheet sheet,
XSSFWorkbook workbook) {
Map<String, PictureData> sheetIndexPicMap = new HashMap<String, PictureData>();
for (POIXMLDocumentPart dr : sheet.getRelations()) {
if (dr instanceof XSSFDrawing) {
XSSFDrawing drawing = (XSSFDrawing) dr;
List<XSSFShape> shapes = drawing.getShapes();
for (XSSFShape shape : shapes) {
XSSFPicture pic = (XSSFPicture) shape;
XSSFClientAnchor anchor = pic.getPreferredSize();
CTMarker ctMarker = anchor.getFrom();
String picIndex = ctMarker.getRow() + "_" + ctMarker.getCol();
sheetIndexPicMap.put(picIndex, pic.getPictureData());
}
}
}
return sheetIndexPicMap;
}
开发者ID:rushingpig,项目名称:poix,代码行数:28,代码来源:PoiPublicUtil.java
示例2: setImage
import org.apache.poi.xssf.usermodel.XSSFShape; //导入依赖的package包/类
/**
* セルに対し画像を設定します。
* @param c セル。
* @param value 値。
* @param p セル位置情報。
*/
private void setImage(final Cell c, final Object value, final CellPosition p) {
ImageData img = (ImageData) value;
int cidx = c.getColumnIndex();
int ridx = c.getRowIndex();
ClientAnchor anchor = new XSSFClientAnchor();
anchor.setCol1(cidx);
anchor.setCol2(cidx + p.getColumns());
anchor.setRow1(ridx);
anchor.setRow2(ridx + p.getRows());
anchor.setDx1(XSSFShape.EMU_PER_PIXEL * p.getDx1());
anchor.setDy1(XSSFShape.EMU_PER_PIXEL * p.getDy1());
anchor.setDx2(XSSFShape.EMU_PER_PIXEL * p.getDx2());
anchor.setDy2(XSSFShape.EMU_PER_PIXEL * p.getDy2());
anchor.setAnchorType(ClientAnchor.MOVE_AND_RESIZE);
int imgtype = XSSFWorkbook.PICTURE_TYPE_PNG;
if (ImageData.CONTENT_TYPE_JPEG.equals(img.getContentType())) {
imgtype = XSSFWorkbook.PICTURE_TYPE_JPEG;
} else if (ImageData.CONTENT_TYPE_GIF.equals(img.getContentType())) {
imgtype = XSSFWorkbook.PICTURE_TYPE_GIF;
}
int pidx = this.workbook.addPicture(img.getContents(), imgtype);
Picture pic = this.drawing.createPicture(anchor, pidx);
this.resizeImage(c, pic, p);
}
开发者ID:takayanagi2087,项目名称:dataforms,代码行数:31,代码来源:ExcelReport.java
示例3: getSheetPictrues07
import org.apache.poi.xssf.usermodel.XSSFShape; //导入依赖的package包/类
/**
* 获取Excel2007图片
*
* @param sheet
* 当前sheet对象
* @param workbook
* 工作簿对象
* @return Map key:图片单元格索引(1_1)String,value:图片流PictureData
*/
public static Map<String, PictureData> getSheetPictrues07(XSSFSheet sheet, XSSFWorkbook workbook) {
Map<String, PictureData> sheetIndexPicMap = new HashMap<String, PictureData>();
for (POIXMLDocumentPart dr : sheet.getRelations()) {
if (dr instanceof XSSFDrawing) {
XSSFDrawing drawing = (XSSFDrawing) dr;
List<XSSFShape> shapes = drawing.getShapes();
for (XSSFShape shape : shapes) {
XSSFPicture pic = (XSSFPicture) shape;
XSSFClientAnchor anchor = pic.getPreferredSize();
CTMarker ctMarker = anchor.getFrom();
String picIndex = ctMarker.getRow() + "_" + ctMarker.getCol();
sheetIndexPicMap.put(picIndex, pic.getPictureData());
}
}
}
return sheetIndexPicMap;
}
开发者ID:xiaolanglang,项目名称:easypoi,代码行数:27,代码来源:PoiPublicUtil.java
示例4: anchorToPoints
import org.apache.poi.xssf.usermodel.XSSFShape; //导入依赖的package包/类
private int[] anchorToPoints(CTTwoCellAnchor anchor) {
int sCol = anchor.getFrom().getCol();
int eCol = anchor.getTo().getCol();
int sRow = anchor.getFrom().getRow();
int eRow = anchor.getTo().getRow();
if (this.readRange != null) {
if (!(sCol >= this.readRange.x && eCol <= this.readRange.width) ||
!(sRow >= this.readRange.y && eRow <= this.readRange.height)) {
return null;
}
}
updateWriteCell(eRow, eCol);
int[] p = new int[4];
p[0] = (int) (getColLeft(sCol) + (anchor.getFrom().getColOff() / XSSFShape.EMU_PER_PIXEL));
p[1] = (int) (getRowTop(sRow) + (anchor.getFrom().getRowOff() / XSSFShape.EMU_PER_PIXEL));
p[2] = (int) (getColLeft(eCol) + (anchor.getTo().getColOff() / XSSFShape.EMU_PER_PIXEL) - p[0]);
p[3] = (int) (getRowTop(eRow) + (anchor.getTo().getRowOff() / XSSFShape.EMU_PER_PIXEL) - p[1]);
return p;
}
开发者ID:shunjikonishi,项目名称:excel2canvas,代码行数:21,代码来源:ExcelToCanvasBuilder.java
示例5: processShapes
import org.apache.poi.xssf.usermodel.XSSFShape; //导入依赖的package包/类
private void processShapes(List<XSSFShape> shapes, XHTMLContentHandler xhtml)
throws SAXException {
if (shapes == null) {
return;
}
for (XSSFShape shape : shapes) {
if (shape instanceof XSSFSimpleShape) {
String sText = ((XSSFSimpleShape) shape).getText();
if (sText != null && sText.length() > 0) {
xhtml.element("p", sText);
}
}
}
}
开发者ID:kolbasa,项目名称:OCRaptor,代码行数:15,代码来源:XSSFExcelExtractorDecorator.java
示例6: anchorDyFromPoints
import org.apache.poi.xssf.usermodel.XSSFShape; //导入依赖的package包/类
@Override
public int anchorDyFromPoints( float height, float rowHeight ) {
return (int)( height * XSSFShape.EMU_PER_POINT );
}
开发者ID:eclipse,项目名称:birt,代码行数:5,代码来源:StyleManagerXUtils.java
注:本文中的org.apache.poi.xssf.usermodel.XSSFShape类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论