New to Telerik Reporting? Download free 30-day trial

Inconsistent Formatting and Rounding in .NET/.NET Core and .NET Framework

Environment

Product Progress® Telerik® Reporting
.Net Framework .NET 6

Description

When rendering report in .NET environment, including the Standalone Report Designer for .NET 6, the formatting and rounding of float values is not consistent with the ones in the .NET Framework, including the Standalone Designer for .NET Framework. In the latter, the rounding and the formatting work as expected.

Here are some screenshots showing the difference when previewing the same report in the two designers:

Formatting in the Standalone Designer for .NET Framework 4.0

Formatting of float values with the last significant decimal digit 5 in the Standalone Designer for .NET Framework 4.0

Formatting in the Standalone Designer for .NET 6

Formatting of float values with the last significant decimal digit 5 in the Standalone Designer for .NET 6

Our code utilizes the System methods for formatting that come from the corresponding framework. The reason for the problem is a breaking change introduced in .NET/.NET Core as explained in the following threads:

Suggested Workarounds

You may create a custom user function that takes as an argument the float value and returns the formatted string as desired. For example, you may use the workaround suggested in the following comment from the above resource.

See Also

In this article