本文整理汇总了Java中org.apache.poi.xssf.usermodel.XSSFDrawing类的典型用法代码示例。如果您正苦于以下问题:Java XSSFDrawing类的具体用法?Java XSSFDrawing怎么用?Java XSSFDrawing使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XSSFDrawing类属于org.apache.poi.xssf.usermodel包,在下文中一共展示了XSSFDrawing类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getSheetPictrues07
import org.apache.poi.xssf.usermodel.XSSFDrawing; //导入依赖的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.XSSFDrawing; //导入依赖的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.XSSFDrawing; //导入依赖的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.XSSFDrawing; //导入依赖的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
示例5: addComment
import org.apache.poi.xssf.usermodel.XSSFDrawing; //导入依赖的package包/类
/**
* 특정셀에 코멘트를 추가한다.
*
* @param sheet
* @param cell
* @param commentText
* @return
*/
public static void addComment(Sheet sheet, Cell cell, String commentText) {
XSSFDrawing patr = (XSSFDrawing) sheet.createDrawingPatriarch();
Comment comment = patr.createCellComment(new XSSFClientAnchor(0, 0, 0, 0, (short) 4, 2, (short) 6, 5));
comment.setString(new XSSFRichTextString(commentText));
cell.setCellComment(comment);
}
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:15,代码来源:ExcelUtil.java
注:本文中的org.apache.poi.xssf.usermodel.XSSFDrawing类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论