0
我用來讀取excel文件第一行的代碼是這樣的。如何在保存之前將該行保存在字符串變量中?以及如何保存excel文件?如何將行保存在變量中並保存excel文檔?
string ExcelFile = Application.StartupPath + @"\SurveyLinks.xlsx";
Excel.Application ExcelApp = new Excel.Application();
Excel.Workbook ExcelWorkBook = ExcelApp.Workbooks.Open(ExcelFile);
Excel._Worksheet ExcelWorkSheet = ExcelWorkBook.Sheets[1];
Excel.Range ExcelRange = (Excel.Range)ExcelWorkSheet.Application.Rows[1, Type.Missing];
ExcelRange.Select();
//string SurveyLink = ExcelRange.Cells[1,1].Value2.ToString();
ExcelRange.Delete(Excel.XlDirection.xlUp);
ExcelWorkBook.Close(true);
ExcelApp.Quit();
MessageBox.Show(SurveyLink);
MessageBox.Show("Done!");
任何人.............. ?? – aroshlakshan