Spreadsheet NumberFormat bug

1 Answer 79 Views
Spreadsheet
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

serge
Top achievements
Rank 2
Bronze
Iron
Iron
commented on 01 May 2021, 01:30 PM

added here https://superuser.com/questions/1645944/number-format

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.

serge
Top achievements
Rank 2
Bronze
Iron
Iron
commented on 06 May 2021, 01:53 PM | edited

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...
Ivan Danchev
Telerik team
commented on 11 May 2021, 07:33 AM

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.
serge
Top achievements
Rank 2
Bronze
Iron
Iron
commented on 12 May 2021, 02:27 PM | edited

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
Ivan Danchev
Telerik team
commented on 17 May 2021, 10:03 AM

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.
Tags
Spreadsheet
Asked by
serge
Top achievements
Rank 2
Bronze
Iron
Iron
Answers by
Ivan Danchev
Telerik team
Share this question
or