diff --git a/ReoGrid/IO/ExcelReader.cs b/ReoGrid/IO/ExcelReader.cs index 25696097..3ecca600 100644 --- a/ReoGrid/IO/ExcelReader.cs +++ b/ReoGrid/IO/ExcelReader.cs @@ -1534,6 +1534,17 @@ private static NumberDataFormatter.INumberFormatArgs ReadNumberFormatArgs(string arg.DecimalPlaces = 0; } + // End with _* + // reference: https://github.com/unvell/ReoGrid/pull/336 + if (pattern.Length >= 2 && pattern[pattern.Length - 2] == '_') + { + if (decimalSeparatorIndex >= 0) + { + // Adjust DecimalPlaces minus 2 + arg.DecimalPlaces -= 2; + } + } + arg.UseSeparator = (pattern.IndexOf(culture.NumberFormat.NumberGroupSeparator) > 0); return arg; diff --git a/TestCase/Tests/ExcelInTest.cs b/TestCase/Tests/ExcelInTest.cs index 8b27b3a4..bec2adaa 100644 --- a/TestCase/Tests/ExcelInTest.cs +++ b/TestCase/Tests/ExcelInTest.cs @@ -192,6 +192,7 @@ void A03_Styles() AssertCellText("G15", "7.00 €"); AssertCellText("H15", "₱8.00"); AssertCellText("I15", "USD 9.00"); + AssertCellText("J15", "CNY 9.00"); // currency line 2 AssertCellText("A16", "$1,234"); @@ -203,6 +204,7 @@ void A03_Styles() AssertCellText("G16", "1,234.00 €"); AssertCellText("H16", "₱1,234.00"); AssertCellText("I16", "USD 1,234.00"); + AssertCellText("J16", "CNY 1,234.00"); // currency line 3 AssertCellText("A17", "-$1"); @@ -214,6 +216,7 @@ void A03_Styles() AssertCellText("G17", "-1.23 €"); AssertCellText("H17", "-₱1.23"); AssertCellText("I17", "-USD 1.23"); + AssertCellText("J17", "-CNY 1.23"); // currency line 4 AssertCellText("A18", "-$1.2340"); @@ -225,6 +228,7 @@ void A03_Styles() AssertCellText("G18", "-1.2340 €"); AssertCellText("H18", "-₱1.2340"); AssertCellText("I18", "-USD 1.2340"); + AssertCellText("J18", "-CNY 1.2340"); // negative number formats Cell cell; diff --git a/TestCase/xlsx/A03.xlsx b/TestCase/xlsx/A03.xlsx index 21967d66..2f18153a 100644 Binary files a/TestCase/xlsx/A03.xlsx and b/TestCase/xlsx/A03.xlsx differ