Hey Team,
I am using XlsIO for calculating excel formula but unable to find exact solution
Update Cell B1 Value with 21000 but after updating new values are not calculated
function one(){
ExcelEngine excelEngine = new ExcelEngine();
IApplication app = excelEngine.Excel;
workbook = app.Workbooks.Open(filePath, ExcelOpenType.Automatic);
//first worksheet object of worksheets collection
worksheet = workbook.Worksheets[excelSheetName];
if (worksheet.IsNull())
{
Utils.ShowDevError("Sheet Name : [ " + excelSheetName + " ] not found excel file");
}
var maxSize = 10000000;
var thread = new Thread(GetCalculatedValue, maxSize);
thread.Start();
thread.Join();
}
function GetCalculatedValue(){
workbook.CalculationOptions.IsIterationEnabled = true;
//Number of times to recalculate
workbook.CalculationOptions.MaximumIteration = 10000;
//Number of acceptable changes
workbook.CalculationOptions.MaximumChange = 10000;
worksheet.EnableSheetCalculations();
worksheet.CalcEngine.UseFormulaValues = true;
worksheet.CalcEngine.AllowShortCircuitIFs = true;
worksheet.CalcEngine.MaximumRecursiveCalls = 10000;
worksheet.CalcEngine.IterationMaxCount = 10000;
worksheet.CalcEngine.ThrowCircularException = true;
CalcEngine.MaxStackDepth = 10000;
worksheet[1, 2].Value = "21000";
//worksheet.Calculate();
workbook.CalculationOptions.RecalcOnSave = false;
workbook.Save();
foreach (IRange cell in worksheet.UsedRange.Cells.Where(r => r.HasFormula))
{
try
{
// Trigger formula to update
string dummy = worksheet.CalcEngine.PullUpdatedValue(cell.AddressLocal);
}
catch (Exception e)
{
}
}
excelTable = worksheet.ExportDataTable(worksheet.UsedRange, ExcelExportDataTableOptions.ComputedFormulaValues); //excel.ConvertExcelToDataTableWithoutHeader(filePath,excelSheetName);
workbook.Close();
}
Hi Ramya,
Thanks for the update, hope we get the solution on given timeline
Regards,
Nagendra