當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。