Articles in this section
Category / Section

CalculatedValue vs DisplayText.

1 min read

The below table illustrates the differences between CalculatedValue and DisplayText properties.

 

 

Calculated Value

DisplayText

1

With EnableSheetCalculation

  1. Returns only evaluated value (if cell has a formula)
  2. Returns only cell value (if cell has no formula)

 

  1. Returns evaluated value with number format (if cell has a formula)
  2. Returns cell value with number format (if cell has no formula)

 

 

Performance is good as it evaluates the formula alone.

Performance is low as it has many checks like HasFormula, HasNumber, Format, Etc.

2

Without EnableSheetCalculation

Always returns "NULL".

Always returns cell value with its number format.





 

Here is the sample code to enabling sheet calculation and accessing display text of a range in XlsIO.

C#

sheet.Range["A1"].Number = 1;
sheet.Range["A2"].Number = 2;
IRange range = sheet.Range["A3"];
sheet.Range["A3"].Formula = "=SUM(A1,A2)";
sheet.EnableSheetCalculations();
string calculatedValue = range.CalculatedValue;
string displayText = range.DisplayText;

VB

sheet.Range("A1").Number = 1
sheet.Range("A2").Number = 2
Dim range As IRange = sheet.Range("A3")
sheet.Range("A3").Formula = "=SUM(A1,A2)"
sheet.EnableSheetCalculations()
Dim calculatedValue As string = range.CalculatedValue
Dim displayText As string = range.DisplayText

 

 

 

Conclusion

I hope you enjoyed learning on the differences between CalculatedValue and DisplayText

You can refer to our WinForms XlsIO feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms XlsIO to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!





Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied