當前位置: 首頁>>代碼示例>>Java>>正文


Java WritableSheet.addImage方法代碼示例

本文整理匯總了Java中jxl.write.WritableSheet.addImage方法的典型用法代碼示例。如果您正苦於以下問題:Java WritableSheet.addImage方法的具體用法?Java WritableSheet.addImage怎麽用?Java WritableSheet.addImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在jxl.write.WritableSheet的用法示例。


在下文中一共展示了WritableSheet.addImage方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createExcelSheet

import jxl.write.WritableSheet; //導入方法依賴的package包/類
public void createExcelSheet(WritableSheet excelSheet) {
	int row, col;
	
	// Create cells
	for (row=0; row<nrows; row++)
		for (col=0; col<ncolumns[row]; col++) {
			if (sheet[row][col]==null)
				continue;
					
			try {
				if (sheet[row][col].getMerge_to_col()>=0 && sheet[row][col].getMerge_to_row()>=0)
					excelSheet.mergeCells(col, row, sheet[row][col].getMerge_to_col(), sheet[row][col].getMerge_to_row());
				
				switch (sheet[row][col].getType()) {
					case LABEL:
						excelSheet.addCell(new Label(col,row,sheet[row][col].getString(),getExcelFormat(row, col)));
						break;
					case FLOAT:
					case INTEGER:
						excelSheet.addCell(new Number(col,row,sheet[row][col].getNumber(),getExcelFormat(row, col)));
						break;
					case IMAGE:
						File f = new File(sheet[row][col].getString());
						WritableImage imgobj=new WritableImage(col, row, sheet[row][col].getWidth(), sheet[row][col].getHeight(), f);
						excelSheet.addImage(imgobj);
						break;
					case VOID:
						break;
					case FORMULA:
						excelSheet.addCell( new Formula(col, row, sheet[row][col].getString(),getExcelFormat(row, col)) );
						break;
					default:
						break;
				}
			} catch (WriteException we) {};
		}
	
	// Resize columns
	for (col=0; colSize!=null && col<colSize.length; col++)
		if (colSize[col]>0)
			excelSheet.setColumnView(col, colSize[col]);
}
 
開發者ID:vagfed,項目名稱:hmcScanner,代碼行數:43,代碼來源:DataSheet.java

示例2: createHeader

import jxl.write.WritableSheet; //導入方法依賴的package包/類
private void createHeader(WritableSheet sheet) throws RowsExceededException, WriteException {
	int row;
		
	row = 0;
	
	addLabel(sheet,0,row,"Manager Name",formatLabel(BOLD|B_ALL_MED));
	addLabel(sheet,1,row,scannerParams.getVarValues("HMC")[0],formatLabel(B_ALL_LOW));
	row++;
	
	addLabel(sheet,0,row,"Manager Type",formatLabel(BOLD|B_ALL_MED));
	switch (managerType) {
		case M_FSM: 	addLabel(sheet,1,row,"FSM",formatLabel(B_ALL_LOW)); break;
		case M_HMC: 	addLabel(sheet,1,row,"HMC",formatLabel(B_ALL_LOW)); break;
		case M_SDMC: 	addLabel(sheet,1,row,"SDMC",formatLabel(B_ALL_LOW)); break;
		case M_IVM: 	addLabel(sheet,1,row,"IVM",formatLabel(B_ALL_LOW)); break;
		default:		break;
	}
	row++;
	
	addLabel(sheet,0,row,"User",formatLabel(BOLD|B_ALL_MED));
	addLabel(sheet,1,row,scannerParams.getVarValues("user")[0],formatLabel(B_ALL_LOW));
	row++;
	
	addLabel(sheet,0,row,"Generation Date",formatLabel(BOLD|B_ALL_MED));
	addLabel(sheet,1,row,scannerParams.getVarValues("date")[0],formatLabel(B_ALL_LOW));
	row++;
	
	addLabel(sheet,0,row,"Generation Time",formatLabel(BOLD|B_ALL_MED));
	addLabel(sheet,1,row,scannerParams.getVarValues("time")[0],formatLabel(B_ALL_LOW));
	row++;
	
	addLabel(sheet,0,row,"Manager Date",formatLabel(BOLD|B_ALL_MED));
	addLabel(sheet,1,row,scannerParams.getVarValues("HMCdate")[0],formatLabel(B_ALL_LOW));
	row++;
	
	addLabel(sheet,0,row,"Manager Time",formatLabel(BOLD|B_ALL_MED));
	addLabel(sheet,1,row,scannerParams.getVarValues("HMCtime")[0],formatLabel(B_ALL_LOW));
	row++;
	
	addLabel(sheet,0,row,"HMC Scanner Version",formatLabel(BOLD|B_ALL_MED));
	addLabel(sheet,1,row,version,formatLabel(B_ALL_LOW));
	row++;
	
	
	row++;
	addLabel(sheet,0,row,"Latest HMC Scanner is available at http://tinyurl.com/HMCscanner",formatLabel(NONE));
	row++;
	addLabel(sheet,0,row,"For issues send a mail to [email protected]",formatLabel(NONE));
	row++;
	
	
	File f = new File(System.getProperty("user.dir")+File.separatorChar+hmcScannerPic);
	if (f.exists()) {
		WritableImage imgobj=new WritableImage(3, 2, 5, 15, f);
		sheet.addImage(imgobj);
	}
	
	
	
	sheet.setColumnView(0, 21);
	sheet.setColumnView(1, 36);
	
}
 
開發者ID:vagfed,項目名稱:hmcScanner,代碼行數:64,代碼來源:Loader.java

示例3: writeImage

import jxl.write.WritableSheet; //導入方法依賴的package包/類
public static void writeImage(WritableSheet sheet, int iRow, int iCol, byte[] pngImage) throws WriteException, RowsExceededException
{
  WritableImage writableImage = new WritableImage(iCol, iRow, 1, 1, pngImage);
  sheet.addImage(writableImage);
}
 
開發者ID:hmsiccbl,項目名稱:screensaver,代碼行數:6,代碼來源:Workbook2Utils.java


注:本文中的jxl.write.WritableSheet.addImage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。