我尝试使用代码从 excel 中删除空白行
Dim wb As New Workbook("d:\test\book1.xls")
Dim sheets As WorksheetCollection = wb.Worksheets
Dim sheet As Worksheet = sheets(0)
sheet.Cells.DeleteBlankRows()
wb.Save("d:\test\mybook.xls")
但我收到语法错误。有人知道执行此操作所需的命名空间吗?
最佳答案
尝试
ApplicationClass excel = new ApplicationClass();
Microsoft.Office.Interop.Excel.Range cellToBeDeleted = (Range)excel.Cells[rowIndex, columnIndex];
cellToBeDeleted.Delete();
包括以下命名空间
using Excel = Microsoft.Office.Interop.Excel;
关于asp.net - 删除excel工作表中的空白行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22397599/