Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions ReoGrid/IO/ExcelReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions TestCase/Tests/ExcelInTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand All @@ -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");
Expand All @@ -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;
Expand Down
Binary file modified TestCase/xlsx/A03.xlsx
Binary file not shown.