本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}