java cellstyle_Java CellStyle.setAlignment方法代碼示例

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值