jjuback / gc-excelviewer

Visual Studio Code extension for viewing Excel spreadsheets and CSV files.
Other
216 stars 39 forks source link

Number Format setting does not seem to work without precision specifier #193

Open alkatar21 opened 2 years ago

alkatar21 commented 2 years ago

The setting does not behave as described in the documentation for g for example, if no precision specifier is specified, 2 seems to be assumed and 0 seems to work differently as well. But the documentation states: If the precision specifier is omitted or zero, the type of the number determines the default precision, as indicated in the following table.

jjuback commented 2 years ago

The extension links to the .NET documentation for the sake of simplicity, but the behavior of the underlying control is more accurately described here. That page does not address the case where the precision value is omitted, so I had to check the code. For common format specifiers such as g and n, 0 means 0, but if no precision is given, 2 is assumed for values with a fractional part, and integers are displayed as integers.

alkatar21 commented 2 years ago

Oh okay, so I have to specify g29 myself to get .NET like behavior for decimal?

jjuback commented 2 years ago

@alkatar21 For now, yes. Or you can set formatValues to never. I'm looking into ways to improve this, since different columns might have different formatting requirements.