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.
Syncfusion Feedback

Evaluating formula

Thread ID:

Created:

Updated:

Platform:

Replies:

76315 Sep 1,2008 01:13 PM UTC Sep 8,2008 01:40 PM UTC Windows Forms 3
loading
Tags: XlsIO
Simon Olesen
Asked On September 1, 2008 01:13 PM UTC

Hello,
i have a problem evaluating a formula from a cell, with a value:

='1055'!N16

i read a few other posts on the forum:
http://www.syncfusion.com/support/forums/message.aspx?MessageID=43170

suggesting that the solution was sheet.Range[cellId].FormulaNumberValue.ToString() - but this returns "0" for me, and from what i can gather from another post on the forum (which i unfortunetly lost the link to), this is because that there is no value, because the sheet was created using XlsIO and have not yet been opened and saved by Excel - i tried opening and saving the sheet, and then it worked. but what do i do when i want to have the values calculated by formulas created in XlsIO ??

Regards,
Simon.


Geetha M [Syncfusion]
Replied On September 2, 2008 11:22 AM UTC

Hi Simon,

Thank you for your interest in Syncfusion products.

Essential XlsIO does not have a calculate engine to evaluate formulas. Alternatively, you can make use of Essential Calculate to evaluate formulas. I have created a sample doing simple addition using Essential Calculate and you can download it from your in the following link:

http://websamples.syncfusion.com/samples/XlsIO.Windows/F76315/main.htm

Further, I strongly recommend you to go through the ComputeSpecificFormula and ComputeAllFormulas samples that ships with our Essential XlsIO package.

MyDocuments\Syncfusion\EssentialStudio\{version number}\Windows\XlsIO.Windows\Samples\2.0\DataManagement\ComputeAllFormulas\

MyDocuments\Syncfusion\EssentialStudio\{version number}\Windows\XlsIO.Windows\Samples\2.0\DataManagement\ComputeSpecificFormula\

Please let me know if you have any questions.

Regards,
Geetha


Simon Olesen
Replied On September 3, 2008 12:29 PM UTC

Hello,
The ComputeAllFormulas example seemed to be exactly what i needed, but i get an error when calculating "=VLOOKUP(X3,Ark1!A2:C103,2,False)".

I have attached my example, i hope you can help clearify what i am doing wrong here.

Thanks in advance,
Simon.



SDAResumeToCSVSimple_5331299e.zip

Geetha M [Syncfusion]
Replied On September 8, 2008 01:40 PM UTC

Hi Simon,

I was not able to reproduce the problem with "=VLOOKUP(X3,Ark1!A2:C103,2,False)" rather I got the below exception when ='1055'!A16 was refreshed.

System.FormatException was caught
Message="Input string was not in a correct format."
Source="mscorlib"
StackTrace:
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt)
at System.Double.Parse(String s, NumberStyles style, NumberFormatInfo info)
at System.Double.Parse(String s)
at SDAResumeToCSV.XlsIOCalcSheet.SetValueRowCol(Object value, Int32 row, Int32 col) in

I modified the code snippet in the SetValueRowCol method in the XlsIOCalcWorkbook.cs which previously was trying to convert the text to double.

Modified code:
Double temp = 0; string temp1 = string.Empty;
try
{
temp = Double.Parse(value.ToString());
}
catch (System.FormatException)
{
excelSheet[row, col].FormulaStringValue = value.ToString();
return;
}
excelSheet[row, col].FormulaNumberValue = temp;

And now the sample works fine. Could you please let me know what kind of issue you encounter with the VLOOKUP formula?

Regards,
Geetha


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.

Warning Icon 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.Close Icon

;