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