We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Having Issue with saving the excel

The save method is not working for me , excel file is not committing the changes for calculated values unless i open the excel file and click on 'Save' in the excel file.

Please let me know why its not committing the changes through code.When i open up the excel file i could see the calculated values but not commited the changes until i press the 'Save' Button on the excel file.

here is the sample code:

private void LoadExcel()

{

string fileName = "CA-Liability-ExperienceRating-CCIC.xls";

string targetPath = @"C:\";

string destFile = System.IO.Path.Combine(targetPath, fileName);

Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook();

wb.Open(destFile);

wb.Worksheets[0].Cells[4, 3].Value = "sri bodapati";
wb.Worksheets[0].Cells[5, 3].Value = "pol00001";
wb.Worksheets[0].Cells[13, 3].Value = "California";
wb.Worksheets[0].Cells[14, 3].Value = "1,800,000";
wb.Worksheets[0].Cells[16, 3].Value = "Light Truck";
wb.Worksheets[0].Cells[22, 3].Value = "1";
wb.Worksheets[0].Cells[23, 3].Value = "2";
wb.Worksheets[0].Cells[24, 3].Value = "2";
wb.Worksheets[0].Cells[25, 3].Value = "2";
wb.Worksheets[0].Cells[26, 3].Value = "01/01/2010";
wb.Worksheets[0].Cells[27, 3].Value = "10/05/2009";
wb.Worksheets[0].Cells[28, 3].Value = "10/05/2008";
wb.Worksheets[0].Cells[29, 3].Value ="10/05/2007";
wb.Worksheets[0].Cells[33, 3].Value = "Garage";

wb.Worksheets[0].Cells[15, 3].Value = 150000;

wb.Save(destFile,SaveFormat.Excel97To2003);

}

I have second method to load the calculates values, i getting the latest calculated values only when i open the physical excel file and click 'Save' then reload.

private void getValues()

{

try

{

String rootPath = Server.MapPath("~");

string sourcePath = @"" + rootPath + "/Excel";

string fileName = "CA-Liability-ExperienceRating-CCIC.xls";

string targetPath = @"C:\";

string sourceFile = System.IO.Path.Combine(sourcePath, fileName);

string destFile = System.IO.Path.Combine(targetPath, fileName);

Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook();

wb.Open(destFile);

string _Experience = wb.Worksheets[0].Cells[35, 3].Value.ToString();

string _ilf = wb.Worksheets[0].Cells[17, 3].Value.ToString();

string _limit = wb.Worksheets[0].Cells[18, 3].Value.ToString();

string _lossratio = wb.Worksheets[0].Cells[19, 3].Value.ToString();

string _losscost = wb.Worksheets[0].Cells[20, 3].Value.ToString();

string _stategrp = wb.Worksheets[0].Cells[21, 3].Value.ToString();

string _fpy = wb.Worksheets[0].Cells[30, 3].Value.ToString();

string _spy = wb.Worksheets[0].Cells[31, 3].Value.ToString();

string _tpy = wb.Worksheets[0].Cells[32, 3].Value.ToString();

string _TotSum = wb.Worksheets[0].Cells[39, 13].Value.ToString();

string _Emf = wb.Worksheets[0].Cells[39, 9].Value.ToString();

string _MSL = wb.Worksheets[0].Cells[37, 11].Value.ToString();

this.txtExperienceRating.Text = _Experience;

this.txtILF1.Text = _ilf;

this.txtBasPremium.Text = _limit;

this.txtExpLossRatio.Text = _lossratio;

this.txtLossCost.Text = _losscost;

this.txtStateGroup.Text = _stategrp;

this.txtFPY.Text = _fpy;

this.txtSPY.Text = _spy;

this.txtTPY.Text = _tpy;

this.txtSum.Text = _TotSum;

this.txtEMF.Text = _Emf;

this.txtMSL.Text = _MSL;

}

catch (Exception ex)

{

throw ex;

}

}

attached the excel file

Hi,

Please add the following line of code before saving the workbook:

wb.CalculateFormula(true);

If the issue persist, please feel free to reach us.

Thanks,

Thank you , it works great.