本文整理匯總了Java中org.apache.poi.ss.usermodel.CellStyle.setAlignment方法的典型用法代碼示例。如果您正苦於以下問題:Java CellStyle.setAlignment方法的具體用法?Java CellStyle.setAlignment怎麽用?Java CellStyle.setAlignment使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.poi.ss.usermodel.CellStyle的用法示例。
在下文中一共展示了CellStyle.setAlignment方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。
示例1: defaultDataCellStyle
點讚 7
import org.apache.poi.ss.usermodel.CellStyle; //導入方法依賴的package包/類
/**
* Returns the default data cell style. Obtained from:
* http://svn.apache.org/repos/asf/poi
* /trunk/src/examples/src/org/apache/poi/ss/examples/TimesheetDemo.java
*
* @param wb the wb
* @return the cell style
*/
protected CellStyle defaultDataCellStyle(final Workbook wb) {
CellStyle style;
style = wb.createCellStyle();
style.setAlignment(HorizontalAlignment.CENTER);
style.setWrapText(true);
style.setBorderRight(BorderStyle.THIN);
style.setRightBorderColor(IndexedColors.BLACK.getIndex());
style.setBorderLeft(BorderStyle.THIN);
style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
style.setBorderTop(BorderStyle.THIN);
style.setTopBorderColor(IndexedColors.BLACK.getIndex());
style.setBorderBottom(BorderStyle.THIN);
style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
style.setDataFormat(doubleDataFormat);
return style;
}
開發者ID:TFyre,項目名稱:vaadin-gridexport,代碼行數:25,
示例2: createIndentationCellStyle
點讚 6
import org.apache.poi.ss.usermodel.CellStyle; //導入方法依賴的package包/類
public CellStyle createIndentationCellStyle(Workbook workbook, int s) {
CellStyle dataStyle1 = this.createBorderCellStyle(workbook, true);
Font dataFont = workbook.createFont();
dataFont.setColor((short) 12);
dataFont.setFontHeightInPoints((short) 10);
dataStyle1.setFillPattern(FillPatternType.SOLID_FOREGROUND);
dataStyle1.setFillForegroundColor((short) 11);
dataStyle1.setFont(dataFont);
dataStyle1.setVerticalAlignment(VerticalAlignment.CENTER);
dataStyle1.setAlignment(HorizontalAlignment.LEFT);
dataStyle1.setIndention(Short.valueOf(String.valueOf((s))));
return dataStyle1;
}
開發者ID:bsteker,項目名稱:bdf2,代碼行數:14,
示例3: defaultHeaderCellStyle
點讚 4
import org.apache.poi.ss.usermodel.CellStyle; //導入方法依賴的package包/類
/**
* Returns the default header style. Obtained from:
* http://svn.apache.org/repos/asf/poi
* /trunk/src/examples/src/org/apache/poi/ss/examples/TimesheetDemo.java
*
* @param wb the wb
* @return the cell style
*/
protected CellStyle defaultHeaderCellStyle(final Workbook wb) {
CellStyle style;
final Font monthFont = wb.createFont();
monthFont.setFontHeightInPoints((short) 11);
monthFont.setColor(IndexedColors.WHITE.getIndex());
style = wb.createCellStyle();
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
style.setFont(monthFont);
style.setWrapText(true);
return style;
}
開發者ID:TFyre,項目名稱:vaadin-gridexport,代碼行數:23,
示例4: defaultTitleCellStyle
點讚 4
import org.apache.poi.ss.usermodel.CellStyle; //導入方法依賴的package包/類
/**
* Returns the default title style. Obtained from:
* http://svn.apache.org/repos/asf/poi
* /trunk/src/examples/src/org/apache/poi/ss/examples/TimesheetDemo.java
*
* @param wb the wb
* @return the cell style
*/
protected CellStyle defaultTitleCellStyle(final Workbook wb) {
CellStyle style;
final Font titleFont = wb.createFont();
titleFont.setFontHeightInPoints((short) 18);
titleFont.setBold(true);
style = wb.createCellStyle();
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setFont(titleFont);
return style;
}
開發者ID:TFyre,項目名稱:vaadin-gridexport,代碼行數:20,
示例5: createStyles
點讚 3
import org.apache.poi.ss.usermodel.CellStyle; //導入方法依賴的package包/類
/**
* 創建表格樣式
* @param wb 工作薄對象
* @return 樣式列表
*/
private Map createStyles(Workbook wb) {
Map styles = new HashMap();
CellStyle style = wb.createCellStyle();
style.setAlignment(CellStyle.ALIGN_CENTER);
style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
Font titleFont = wb.createFont();
titleFont.setFontName("Arial");
titleFont.setFontHeightInPoints((short) 16);
titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);