Question about the formula caluation.

Tagged: ,

  • zugock 2 years, 11 months ago

    Hi,

    I found that when i assign a formula in a cell, say :

    cell[1, 1].Formula = "1+1″;

    the value of the cell (cell[1,1].value) is null.
    even i save the file and then reload the file, the value is null.

    I can only get the right value (in this case "2″) if i open the saved file by Micrsoft EXCEL
    and then save it again with Micrsoft EXCEL.

    After the above step, when i open the file again by the C1Excel, it can get the value "2″.

    Is there any method that help me to get the calculated value without using Micrsoft EXCEL?

    Thank a lot,

    William

  • 33p
    Reeva33p 2 years, 11 months ago

    Hello,

    I am not sure which build you are using but this was a known issue wherein cell having formulas are not retained if the cell has no prior value. Hence, in case you are using the older build then as a workaround I would request you to set Value property of the same cell to zero before setting up the formula.

    private void Form1_Load(object sender, EventArgs e)
    {
    xls = new C1XLBook();
    XLSheet sheet = xls.Sheets[0];
    XLCell acell = sheet[0, 0];
    acell.Value = 0;
    acell.Formula = "1+1″;
    } and then save

    However, the issue stated by you works perfectly fine in our latest build without even using Value property anyhow. Hence I would request you to upgrade the same to the latest build.
    Latest build can be found at the below mentioned locations:-

    http://prerelease.componentone.com/dotnet40/C1Excel/2011-T3/C1Excel.4_4.1.20113.215.zip

    http://prerelease.componentone.com/dotnet20/C1Excel/2011-T3/C1Excel.2_2.1.20113.215.zip

    Hope that helps.

    Thanks,
    Reeva Dhingra

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.