POIを使用してExcelファイルとregを解析しています。で通貨を検出する式NumericCellValue
。Excel ファイルに 2 つの異なる通貨 (100$ と 100€) の 2 つのフィールドがあり、それらの通貨コード ("USD"、"EUR") を取得する必要があります。
case Cell.CELL_TYPE_NUMERIC: {
Pattern p = Pattern.compile(currencyFilter);
Matcher m = p.matcher(dataFormat);
if (m.find()) {
BigDecimal aCurrency = currentCell.getNumericCellValue();
//I need to pass my currency code from cell field to money instance
Money money = new Money(aCurrency, "USD");
}
}
String currencyCode = "";
if (dataFormat.contains("$$")) {
currencyCode = "USD";
}
else if (dataFormat.contains("$€")) {
currencyCode = "EUR";
}
moneyCurrency = new Money(bd, currencyCode);
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加