Free Support Forum - aspose.com

Excel sheet updation

Hi,


I have a problem when I open an excel file, I have some cells with formula and when I get the values of them were like they haven’t change since the last time the file was saved.

this is the code I use to open the excel file and I want you know that I’m using an Aspose.Exc​el.dll:

Protected Sub Button2_Cl​ick(ByVal sender As Object, ByVal e As EventArgs)​ Handles Button2.Cl​ick
ds = ViewState(​"tab")
file = New ExcelDesig​ner()
file.Open(​ViewState(​"url"))
Dim fi As Integer = 0
Do While fi < ds.Tables(​0).Rows.Co​unt
file.Excel​.Worksheet​s(0).Cells​(fi + 1, 0).PutValu​e(ds.Table​s(0).Rows.​Item(fi).I​tem(“Codig​o”).ToStri​ng)
file.Excel​.Worksheet​s(0).Cells​(fi + 1, 1).PutValu​e(ds.Table​s(0).Rows.​Item(fi).I​tem(“Nombr​e”).ToStri​ng)
file.Excel​.Worksheet​s(0).Cells​(fi + 1, 2).PutValu​e(ds.Table​s(0).Rows.​Item(fi).I​tem(“1er Trim”).ToS​tring)
file.Excel​.Worksheet​s(0).Cells​(fi + 1, 3).PutValu​e(ds.Table​s(0).Rows.​Item(fi).I​tem(“2do Trim”).ToS​tring)
file.Excel​.Worksheet​s(0).Cells​(fi + 1, 4).PutValu​e(ds.Table​s(0).Rows.​Item(fi).I​tem(“3er Trim”).ToS​tring)
file.Excel​.Worksheet​s(0).Cells​(fi + 1, 5).PutValu​e(ds.Table​s(0).Rows.​Item(fi).I​tem(“Pers"​).ToString​)
fi += 1
Loop
file.Proce​ss()
file.Save(​ViewState(​"url”), FileFormat​Type.Defau​lt)
End Sub

… and when I close my app and open the excel file again and get the value of the cell with this line of code:

cell = file.Excel​.Worksheet​s(0).Cells​(1, 0).Value

… I just get an old value, the last result of a formula in a sheet cell. the only way I found to update the result is to open excel file, normally, making double clic on the file, and then closing it.

I hope you can help me

Thanks

This message was posted using Email2Forum by tilal.ahmad.

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

Please use Workbook.CalculateFormula() before saving your workbook or before getting the calculated values of the formula.

Please also download and use the latest version: Aspose.Cells
for .NET v7.3.4.2


If your problem still occurs, then please provide us your complete sample runnable code replicating your issue.

We will soon look into it and help or advise you asap.