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


Java XSSFWorkbook.createCellStyle方法代碼示例

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


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

示例1: createBackgroundColorXSSFCellStyle

import org.apache.poi.xssf.usermodel.XSSFWorkbook; //導入方法依賴的package包/類
/**
 * @param wb
 * @param color
 * @param foreGround
 * @return
 */
public static XSSFCellStyle createBackgroundColorXSSFCellStyle(XSSFWorkbook wb,XSSFColor color,short foreGround){
	String message="XSSFWorkbook must not be null!";
	Objects.requireNonNull(wb, () -> message);
	XSSFCellStyle cellStyle=wb.createCellStyle();
	cellStyle.setWrapText(true);
	cellStyle.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);
	cellStyle.setAlignment(XSSFCellStyle.ALIGN_CENTER);
	cellStyle.setBorderBottom(BorderStyle.THIN);
	cellStyle.setBorderLeft(BorderStyle.THIN);
	cellStyle.setBorderTop(BorderStyle.THIN);
	cellStyle.setBorderRight(BorderStyle.THIN);
	cellStyle.setFillForegroundColor(color);
	cellStyle.setFillPattern(foreGround);
	return cellStyle;
}
 
開發者ID:gp15237125756,項目名稱:PoiExcelExport,代碼行數:22,代碼來源:XSSFCellUtil.java

示例2: create

import org.apache.poi.xssf.usermodel.XSSFWorkbook; //導入方法依賴的package包/類
public static XSSFWorkbook create(List<RaceResult> raceResults) {
    XSSFWorkbook workbook = new XSSFWorkbook();

    helper = workbook.getCreationHelper();

    dateFormat = workbook.createCellStyle();
    dateFormat.setDataFormat(helper.createDataFormat().getFormat("m/d/yy"));

    twoDigitFormat = workbook.createCellStyle();
    twoDigitFormat.setDataFormat(helper.createDataFormat().getFormat("0.00"));

    threeDigitFormat = workbook.createCellStyle();
    threeDigitFormat.setDataFormat(helper.createDataFormat().getFormat("0.000"));

    commaNumberFormat = workbook.createCellStyle();
    commaNumberFormat.setDataFormat(helper.createDataFormat().getFormat("#,##0"));

    twoDigitCommaFormat = workbook.createCellStyle();
    twoDigitCommaFormat.setDataFormat(helper.createDataFormat().getFormat("#,##0.00"));

    createResultsSheets(raceResults, workbook);
    createBreedingSheet(raceResults, workbook);
    createWageringSheet(raceResults, workbook);

    return workbook;
}
 
開發者ID:robinhowlett,項目名稱:handycapper,代碼行數:27,代碼來源:ThreeTypeSummary.java

示例3: createXSSFCellStyle

import org.apache.poi.xssf.usermodel.XSSFWorkbook; //導入方法依賴的package包/類
public static XSSFCellStyle createXSSFCellStyle(XSSFWorkbook wb){
	String message="XSSFWorkbook must not be null!";
	Objects.requireNonNull(wb, () -> message);
	XSSFCellStyle cellStyle=wb.createCellStyle();
	cellStyle.setWrapText(true);
	cellStyle.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);
	cellStyle.setAlignment(XSSFCellStyle.ALIGN_CENTER);
	return cellStyle;
}
 
開發者ID:gp15237125756,項目名稱:PoiExcelExport,代碼行數:10,代碼來源:XSSFCellUtil.java

示例4: createCenterXSSFCellStyle

import org.apache.poi.xssf.usermodel.XSSFWorkbook; //導入方法依賴的package包/類
public static XSSFCellStyle createCenterXSSFCellStyle(XSSFWorkbook wb){
	String message="XSSFWorkbook must not be null!";
	Objects.requireNonNull(wb, () -> message);
	XSSFCellStyle cellStyle=wb.createCellStyle();
	cellStyle.setWrapText(true);
	cellStyle.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);
	cellStyle.setAlignment(XSSFCellStyle.ALIGN_CENTER);
	cellStyle.setBorderBottom(BorderStyle.THIN);
	cellStyle.setBorderLeft(BorderStyle.THIN);
	cellStyle.setBorderTop(BorderStyle.THIN);
	cellStyle.setBorderRight(BorderStyle.THIN);
	return cellStyle;
}
 
開發者ID:gp15237125756,項目名稱:PoiExcelExport,代碼行數:14,代碼來源:XSSFCellUtil.java

示例5: createTitleXSSFCellStyle

import org.apache.poi.xssf.usermodel.XSSFWorkbook; //導入方法依賴的package包/類
public static XSSFCellStyle createTitleXSSFCellStyle(XSSFWorkbook wb){
	String message="XSSFWorkbook must not be null!";
	Objects.requireNonNull(wb, () -> message);
	XSSFCellStyle cellStyle=wb.createCellStyle();
	cellStyle.setWrapText(true);
	cellStyle.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);
	cellStyle.setAlignment(XSSFCellStyle.ALIGN_CENTER);
	cellStyle.setBorderBottom(BorderStyle.THIN);
	cellStyle.setBorderLeft(BorderStyle.THIN);
	cellStyle.setBorderTop(BorderStyle.THIN);
	cellStyle.setBorderRight(BorderStyle.THIN);
	cellStyle.setFillForegroundColor(new XSSFColor( new Color(75, 172, 198)));
	cellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
	return cellStyle;
}
 
開發者ID:gp15237125756,項目名稱:PoiExcelExport2.0,代碼行數:16,代碼來源:XSSFCellUtil.java


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