c# - How do I store Excel File without getting the warning -



c# - How do I store Excel File without getting the warning -

i trying replace file gives me warning:

the file exists. want replace file

in code, not want warning

code:

string fromfile = @"\\test.net\excel\123.xls"; string tofile = @"\\test.net\excel\123.xls"; microsoft.office.interop.excel.application app = new microsoft.office.interop.excel.application(); microsoft.office.interop.excel.workbook wb = app.workbooks.open(fromfile, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing); file.delete(tofile); wb.saveas(tofile, microsoft.office.interop.excel.xlfileformat.xlworkbookdefault, type.missing, type.missing, false, false, microsoft.office.interop.excel.xlsaveasaccessmode.xlexclusive, microsoft.office.interop.excel.xlsaveconflictresolution.xllocalsessionchanges, false, type.missing, type.missing, type.missing); wb.close(false, type.missing, type.missing); app.quit();

add

app.displayalerts = false;

before saveas phone call , add

app.displayalerts = true;

after close event.

c# asp.net

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -