本文整理汇总了Java中org.apache.poi.xssf.usermodel.XSSFPicture类的典型用法代码示例。如果您正苦于以下问题:Java XSSFPicture类的具体用法?Java XSSFPicture怎么用?Java XSSFPicture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XSSFPicture类属于org.apache.poi.xssf.usermodel包,在下文中一共展示了XSSFPicture类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getSheetPictrues07
import org.apache.poi.xssf.usermodel.XSSFPicture; //导入依赖的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: getSheetPictrues07
import org.apache.poi.xssf.usermodel.XSSFPicture; //导入依赖的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
示例3: readAllCellImages
import org.apache.poi.xssf.usermodel.XSSFPicture; //导入依赖的package包/类
private static Table<Integer, Integer, ImageData> readAllCellImages(XSSFDrawing drawing, Sheet sheet) {
val images = HashBasedTable.<Integer, Integer, ImageData>create();
for (val shape : drawing.getShapes()) {
if (!(shape instanceof XSSFPicture)) continue;
val picture = (XSSFPicture) shape;
val imageData = createImageData(picture.getPictureData());
val axisRow = computeAxisRowIndex(sheet, picture);
val axisCol = computeAxisColIndex(sheet, picture);
images.put(axisRow, axisCol, imageData);
}
return images;
}
开发者ID:bingoohuang,项目名称:excel2javabeans,代码行数:17,代码来源:ExcelImages.java
示例4: setCellPicture
import org.apache.poi.xssf.usermodel.XSSFPicture; //导入依赖的package包/类
public static void setCellPicture(XSSFWorkbook wb, XSSFSheet sh, byte[] iconBytes, int row, int col) throws Exception {
int myPictureId = wb.addPicture(iconBytes, XSSFWorkbook.PICTURE_TYPE_PNG);
XSSFDrawing drawing = sh.createDrawingPatriarch();
XSSFClientAnchor myAnchor = new XSSFClientAnchor();
myAnchor.setCol1(col);
myAnchor.setRow1(row);
XSSFPicture myPicture = drawing.createPicture(myAnchor, myPictureId);
myPicture.resize();
}
开发者ID:billchen198318,项目名称:bamboobsc,代码行数:13,代码来源:SimpleUtils.java
注:本文中的org.apache.poi.xssf.usermodel.XSSFPicture类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论