java xssfdataformat_Java XSSFCellStyle.getDataFormatString方法代碼示例

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

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

示例1: handleNumber

​點讚 3

import org.apache.poi.xssf.usermodel.XSSFCellStyle; //導入方法依賴的package包/類

@Override

public void handleNumber(XSSFCellStyle style, String number) {

rawValues.add(number);

if (style != null) {

short formatIndex = style.getDataFormat();

String formatString = style.getDataFormatString();

if (formatString == null) {

formatString = BuiltinFormats.getBuiltinFormat(formatIndex);

}

if (formatString != null) {

formattedValues.add(formatter.formatRawCellContents(Double.parseDouble(number), formatIndex, formatString));

if (formatString.contentEquals("D/M/YYYY")) {

rawValues.add(formatter.formatRawCellContents(Double.parseDouble(number), formatIndex, formatString));

}

}

}else{

formattedValues.add(number);

}

}

開發者ID:iMDT,項目名稱:xlsx-io,代碼行數:20,

示例2: setFormatString

​點讚 3

import org.apache.poi.xssf.usermodel.XSSFCellStyle; //導入方法依賴的package包/類

/**

* Read the numeric format string out of the styles table for this cell. Stores the result in the Cell.

*

* @param startElement

* @param cell

*/

void setFormatString(StartElement startElement, StreamingCell cell) {

Attribute cellStyle = startElement.getAttributeByName(new QName("s"));

String cellStyleString = (cellStyle != null) ? cellStyle.getValue() : null;

XSSFCellStyle style = null;

if (cellStyleString != null) {

style = stylesTable.getStyleAt(Integer.parseInt(cellStyleString));

} else if (stylesTable.getNumCellStyles() > 0) {

style = stylesTable.getStyleAt(0);

}

if (style != null) {

cell.setNumericFormatIndex(style.getDataFormat());

String formatString = style.getDataFormatString();

if (formatString != null) {

cell.setNumericFormat(formatString);

} else {

cell.setNumericFormat(BuiltinFormats.getBuiltinFormat(cell.getNumericFormatIndex()));

}

} else {

cell.setNumericFormatIndex(null);

cell.setNumericFormat(null);

}

}

開發者ID:Talend,項目名稱:data-prep,代碼行數:32,

示例3: setFormatString

​點讚 3

import org.apache.poi.xssf.usermodel.XSSFCellStyle; //導入方法依賴的package包/類

/**

* Read the numeric format string out of the styles table for this cell. Stores

* the result in the Cell.

*

* @param startElement

* @param cell

*/

void setFormatString(StartElement startElement, StreamingCell cell) {

Attribute cellStyle = startElement.getAttributeByName(new QName("s"));

String cellStyleString = (cellStyle != null) ? cellStyle.getValue() : null;

XSSFCellStyle style = null;

if(cellStyleString != null) {

style = stylesTable.getStyleAt(Integer.parseInt(cellStyleString));

} else if(stylesTable.getNumCellStyles() > 0) {

style = stylesTable.getStyleAt(0);

}

if(style != null) {

cell.setNumericFormatIndex

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值