当前位置: 首页>>代码示例>>Java>>正文


Java XSSFSheet.createDrawingPatriarch方法代码示例

本文整理汇总了Java中org.apache.poi.xssf.usermodel.XSSFSheet.createDrawingPatriarch方法的典型用法代码示例。如果您正苦于以下问题:Java XSSFSheet.createDrawingPatriarch方法的具体用法?Java XSSFSheet.createDrawingPatriarch怎么用?Java XSSFSheet.createDrawingPatriarch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.poi.xssf.usermodel.XSSFSheet的用法示例。


在下文中一共展示了XSSFSheet.createDrawingPatriarch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: extractPicturePortion

import org.apache.poi.xssf.usermodel.XSSFSheet; //导入方法依赖的package包/类
/**
 * 抽象出图片生成业务代码
 * 
 * @throws IOException
 */
private void extractPicturePortion(String svgString, XSSFWorkbook wb,
		XSSFSheet sheet, int startCol, int endCol, int startRow, int endRow)
		throws IOException {
	// 图片
	if (org.apache.commons.lang3.StringUtils.isNotBlank(svgString)) {
		byte[] safeDataBytes = new BASE64Decoder().decodeBuffer(svgString);
		int pictureIdx = wb.addPicture(safeDataBytes,
				Workbook.PICTURE_TYPE_JPEG);
		CreationHelper helper = wb.getCreationHelper();
		// Create the drawing patriarch. This is the top level container for
		// all shapes.
		Drawing drawing = sheet.createDrawingPatriarch();
		// add a picture shape
		ClientAnchor anchor = helper.createClientAnchor();
		// set top-left corner of the picture,
		// subsequent call of Picture#resize() will operate relative to it
		anchor.setCol1(startCol);
		anchor.setCol2(endCol);
		anchor.setRow1(startRow);
		anchor.setRow2(endRow);
		anchor.setDx1(0);
		anchor.setDy1(0);
		anchor.setDx2(0);
		anchor.setDy2(0);
		anchor.setAnchorType(ClientAnchor.MOVE_DONT_RESIZE);
		Picture pict = drawing.createPicture(anchor, pictureIdx);
		pict.resize(1);
	}
}
 
开发者ID:gp15237125756,项目名称:PoiExcelExport,代码行数:35,代码来源:ExcelExportService.java

示例2: setCellPicture

import org.apache.poi.xssf.usermodel.XSSFSheet; //导入方法依赖的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.XSSFSheet.createDrawingPatriarch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。