diff options
author | Nick Burch <nick@apache.org> | 2015-10-25 16:13:16 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2015-10-25 16:13:16 +0000 |
commit | 1a96a88ef2cea9d36d5cd9d7065e412068148c45 (patch) | |
tree | 3592c4d21a18289822539be662ddd86bd37fc4ce /src/testcases/org/apache | |
parent | 7d7cbf7db30273ab30644318b59330ddea552f5d (diff) | |
download | poi-1a96a88ef2cea9d36d5cd9d7065e412068148c45.tar.gz poi-1a96a88ef2cea9d36d5cd9d7065e412068148c45.zip |
Mention about Locale definitions in Excel cell data format strings
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1710459 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache')
-rw-r--r-- | src/testcases/org/apache/poi/ss/format/TestCellFormat.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/ss/format/TestCellFormat.java b/src/testcases/org/apache/poi/ss/format/TestCellFormat.java index b7983a3c80..13a1f4b2e3 100644 --- a/src/testcases/org/apache/poi/ss/format/TestCellFormat.java +++ b/src/testcases/org/apache/poi/ss/format/TestCellFormat.java @@ -36,6 +36,7 @@ import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.util.LocaleUtil; import org.junit.AfterClass; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Test; public class TestCellFormat { @@ -923,4 +924,40 @@ public class TestCellFormat { wb.close(); } } + + @Test + @Ignore("TODO") // TODO + public void testAccountingFormats() throws IOException { + char pound = '\u00A3'; + char euro = '\u20AC'; + + // Accounting -> 0 decimal places, default currency symbol + String formatDft = "_-\"$\"* #,##0_-;\\-\"$\"* #,##0_-;_-\"$\"* \"-\"_-;_-@_-"; + // Accounting -> 0 decimal places, US currency symbol + String formatUS = "_-[$$-409]* #,##0_ ;_-[$$-409]* -#,##0 ;_-[$$-409]* \"-\"_ ;_-@_ "; + // Accounting -> 0 decimal places, UK currency symbol + String formatUK = "_-[$"+pound+"-809]* #,##0_-;\\-[$"+pound+"-809]* #,##0_-;_-[$"+pound+"-809]* \"-\"??_-;_-@_-"; + // Accounting -> 0 decimal places, French currency symbol + String formatFR = "_-[$"+euro+"-40C]* #,##0_-;\\-[$"+euro+"-40C]* #,##0_-;_-[$"+euro+"-40C]* \"-\"??_-;_-@_-"; + + // Has +ve, -ve and zero rules + CellFormat cfDft = CellFormat.getInstance(formatDft); + CellFormat cfUS = CellFormat.getInstance(formatUS); + CellFormat cfUK = CellFormat.getInstance(formatUK); + CellFormat cfFR = CellFormat.getInstance(formatFR); + + // For +ve numbers, should be Space + currency symbol + spaces + whole number with commas + space + assertEquals(" $ 12 ",cfDft.apply(Double.valueOf(12.33)).text); + assertEquals(" $ 12 ", cfUS.apply(Double.valueOf(12.33)).text); + assertEquals(" "+pound+" 12 ", cfUK.apply(Double.valueOf(12.33)).text); + assertEquals(" "+pound+" 12 ", cfFR.apply(Double.valueOf(12.33)).text); + assertEquals(" "+pound+" 16,789 ", cfUK.apply(Double.valueOf(16789.2)).text); + // TODO More + + // For -ve numbers, should be Minus + currency symbol + spaces + whole number with commas + // TODO + + // For zero, should be Space + currency symbol + spaces + Minus + spaces + // TODO + } }
\ No newline at end of file |