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. Image for the cookie policy date
close icon

XlsIo- open existing XLSM and SaveAs new file

I am trying to open an existing XLSM (macro) file, make a small change, then SaveAs a different file. The new file is created and saved but the changes are not reflected, it is like I saved a new copy of the file I opened. What am I doing wrong? I am using full paths, getting no exceptions. It is simply not saving the changes.

FileStream baseInstruction = new FileStream(path, FileMode.Open);
IWorkbook workbook = application.Workbooks.Open(baseInstruction);
IWorksheet worksheet = workbook.Worksheets[0];

worksheet.Range[1, 1].Text = "hello";

FileStream filestream = new FileStream(newPath, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite);
workbook.SaveAs(filestream);
workbook.Close();
excelEngine.Dispose();


1 Reply

SS Sridhar Sukumar Syncfusion Team December 8, 2016 12:38 PM UTC

Hi Eric, 

 

Thank you for contacting Syncfusion support. 

 

We are unable to reproduce the issue from our side. We have shared a simple sample for your reference which can be downloaded from the following location.  

 

Sample link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/SampleCore-5589288.zip 

 

Kindly modify the sample to reproduce the issue and share us the modified sample along with the issue reproducing input files which will be helpful for us to give you a prompt solution at the earliest. 

 

Please let us know if you have any concerns. 

 

Regards, 

Sridhar S. 


SIGN IN To post a reply.
Loader.
Live Chat Icon For mobile
Up arrow icon