Spreadsheet NumberFormat bug
1 Answer 22 Views
serge
Top achievements
Rank 2
Bronze
Iron
Iron
serge asked on 01 May 2021, 01:22 PM | edited on 12 May 2021, 02:32 PM

I try to use the number format #.### that should display

7 as 7

7.123678 as 7.124

7.4 as 7.4

, however is not the case...

cells.Add()
.VerticalAlign(SpreadsheetVerticalAlign.Center)
.Format("#.###");
displays 7. for 7, is there a way to fix the Excel bug and remove the dot, when there are any decimal ?

 

public static void Main()
{
	string format = "#.###";
	Console.WriteLine("123.456789m as {0} is {1}", format, (123.456789m).ToString(format));
	Console.WriteLine("     123.4m as {0} is {1}", format, (123.4m).ToString(format));
	Console.WriteLine("        123 as {0} is {1}", format, (123m).ToString(format));
}

output:

123.456789m as #.### is 123.457
     123.4m as #.### is 123.4
        123 as #.### is 123

added here https://superuser.com/questions/1645944/number-format
- by
serge
Top achievements
Rank 2
Bronze
Iron
Iron
on 01 May 2021, 01:30 PM

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 05 May 2021, 03:33 PM

Hello Serge,

The Spreadsheet displays the numbers formatted with the "#.###" format the same way Excel displays them.

You can check out this stackoverflow thread where this behavior is discussed: https://stackoverflow.com/questions/15178668/excel-custom-decimal-number-format-trailing-dot

One of the suggested approaches is to use a different format: "#0.0##", however, with this format applied, single digit numbers will be displayed with one 0 digit after the dot: 7 -> 7.0

Regards,
Ivan Danchev
Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.

thank your for the feedback, however, that is not exactly an answer to my question. I know Excel does that, this is why I asked if there is a way by Telerik to fix this bug in Kendo (asp.net core) Spreadsheet. The format 7.0 is good, but "7" is much better for us...
- by
serge
Top achievements
Rank 2
Bronze
Iron
Iron
on 06 May 2021, 01:53 PM | edited
As far as we know the Excel behavior in question hasn't been confirmed to be a bug. At least we haven't found any information about it being officially confirmed and included in the backlog. Thus, until Microsoft recognizes it as a bug, we don't plan on making changes in the Spreadsheet, because we want to be consistent with Excel in functionalities that both Excel and the Spreadsheet have in common.
- by
Ivan Danchev
Telerik team
on 11 May 2021, 07:33 AM
I understand, but for me, as user of the kendo spreadsheet, who wants to display integers without the dot, what to do? is there a workaround? please see the .NET output here https://dotnetfiddle.net/5lXZ65
- by
serge
Top achievements
Rank 2
Bronze
Iron
Iron
on 12 May 2021, 02:27 PM | edited
Consider using our Professional Services. They offer guidance and assistance with source code modifications that are aimed at achieving requirements that are not possible to achieve through configuration and using the available API of the components. If you are interested, I can put you in touch with my colleagues, to discuss the available options.
- by
Ivan Danchev
Telerik team
on 17 May 2021, 10:03 AM
Asked by
serge
Top achievements
Rank 2
Bronze
Iron
Iron
Answers by
Ivan Danchev
Telerik team
Share this question
or