I'm trying to get some datas from an excel worksheet. I'm using this code:
string excelFinalPath = @"C:\Users\fra31\source\repos\Key Visor\Key Visor\Foglio1.xls";
Microsoft.Office.Interop.Excel.Application application = new Microsoft.Office.Interop.Excel.Application();
Workbook workBook = application.Workbooks.Open(excelFinalPath);
Worksheet worksheet = workBook.Worksheets[1];
object tag = ((Microsoft.Office.Interop.Excel.Range)worksheet.Cells[1, 1]).Value;
MessageBox.Show(tag.ToString());
workBook.Close(true, excelFinalPath, null);
Marshal.ReleaseComObject(workBook);
but when I open the excel workbook it's not editable. I've read it happens because I'm using multiple dots, but i don't understand where. Can someone help me to understand what I should change?
application.Quit();
does the job.
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.