We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Using excel file for calculation.

Thread ID:

Created:

Updated:

Platform:

Replies:

97021 Oct 20,2010 11:55 AM Nov 28,2014 06:29 AM Windows Forms 3
loading
Tags: XlsIO
Attila Kenyhercz
Asked On October 20, 2010 11:55 AM

Hi,
I want to implement a code, which writes some values into an excel file, than reads a cell which is a formula calculates values from previously entered data.

I create an excel file like this:
A1 = "1"
A2 = "2"
A3 = A1 + A2 // = "3"

then I open it from my application, and I set the new values:

A1 = 4
A2 = 6

after this I read the value of A3 and it is still "3".
It appears that the value of the A3 cell is not recalculated.

My question would be, how to force Syncfusion.XlsIO to recalculate the formulas.

The code I have is:
#using Syncfusion.XlsIO;

ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;

application.DefaultVersion = ExcelVersion.Excel2007;

IWorkbook workbook = excelEngine.Excel.Workbooks.Open("test.xls", ExcelOpenType.Automatic);

IWorksheet sheet = workbook.Worksheets[0];

sheet.Range["A1"].Value = "4";
sheet.Range["A2"].Value = "6";
MessageBox.Show(sheet.Range["A3"].FormulaNumberValue.ToString());

I have referenced the
Core, Compression.Base, XlsIO.Windows, XsIO.Base

Thank you for your help...
Attila



Sathish Babu R [Syncfusion]
Replied On October 20, 2010 11:54 PM

Hi Attila,

Thank you for your interest in Syncfusion products.

In our XlsIO, We can calculate the formula at runtime using Essential Calculate which is already integrated with the Essential XlsIO. We have created the sample with custom class (XlsIOCalcWorkbook) to calculate the formula at runtime. Could you please try the sample and let us know if this helps you.

Sample:
http://help.syncfusion.com/samples/xlsio.windows/supports/F97021.zip

Please, let us know if this helps you.

Regards,
Sathish



Riccardo De Agostini
Replied On November 27, 2014 02:57 AM

I'm having a very similar problem. Unfortunately, the link to the sample is dead. Can you make the sample available again?

Thanks and best regards
Riccardo De Agostini

Sudha Ramachandran [Syncfusion]
Replied On November 28, 2014 06:29 AM

Hi Riccardo,

 

The scenario is similar to the query reported by you in the forum 117677, for which we have provided a sample. Please have a follow-up in the mentioned forum and get back to us in that if you need any clarification.

 

Regards,

Sudha Ramachandran


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;