简体   繁体   中英

Saving options of an excel file

I am generating an excel file on button click from webpage using Microsoft.Office.Interop.Excel; .Now the problem that i am getting is that the generating file is getting saved into the localdisk of the system .Means the path is hardcoded..here is my code.

        object objOpt = Missing.Value;
        objBook.SaveAs(@"D:\SampleChart.xls", objOpt, objOpt, objOpt, objOpt, objOpt, XlSaveAsAccessMode.xlNoChange, objOpt, objOpt, objOpt, objOpt, objOpt);
        objBook.Close(false, objOpt, objOpt);

So my question is how can i save this excel file from the browser.

Thanks in advance..

Please use objBook.SaveCopyAs("filename"); instead of objBook.SaveAs();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM