I am doing a simple c# application which is to edit the existing excel 2003 template(xlt) and save to a new *.xls file. It is like:
Microsoft.Office.Interop.Excel._Application app = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel._Workbook workbook = app.Workbooks.Open("\\my_template.xlt");
Microsoft.Office.Interop.Excel._Worksheet worksheet = (Microsoft.Office.Interop.Excel.Worksheet)workbook.Sheets[0];
Then i modify some cells which are used in various formulas inside the file and save template to a new file:
workbook.SaveAs("newfile.xls", Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookNormal);
workbook.Close(true, misValue, misValue);
app.Quit();
worksheet = null;
workbook = null;
app = null;
So the problem is that when the new file is successfuly saved i open it and see that the results of formulas, which are using cells i have edited, are like "#NAME" and so on. When i reopen file - everything becomes ok. Why does it happen?
Maybe I am saving file by incorrect way and that is why I see errors during it's first opening? This problem is actual for 2003 office only... as I have admitted.