本文整理汇总了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]);
}
示例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);
}
示例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);
}