Syncfusion.XlsIO.Base
Example 


Syncfusion.XlsIO Namespace > IRange Interface : CalculatedValue Property

CalculatedValue Property

Gets the calculated value of a formula in the Range. Read-only.
Syntax
'Declaration
 
ReadOnly Property CalculatedValue As String
'Usage
 
Dim instance As IRange
Dim value As String
 
value = instance.CalculatedValue
string CalculatedValue {get;}
Remarks
To compute a formula, it is mandatory to enable calculate engine by invoking EnableSheetCalculations method of worksheet object. It is also recommend to disable calculate engine once all formula are computed by invoking DisableSheetCalculations method of worksheet object
Example
Following code illustrates how to access a calculated value.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic);
IWorksheet sheet = workbook.Worksheets[0];
            
//Initializes Calculate Engine to perform calculation
sheet.EnableSheetCalculations();
            
//Returns the calculated value of a formula using the most current inputs
string calculatedValue = sheet["C1"].CalculatedValue;
//Formula calculation is disabled for the sheet.
sheet.DisableSheetCalculations();  
            
workbook.SaveAs("Formula.xlsx");
workbook.Close();
excelEngine.Dispose();
AssemblyVersion

Syncfusion.XlsIO.Base: 16.4460.0.40

See Also