- Demo
- C# source
- VB.Net source
The sample demonstrates how to delete row in Excel workbook via Spire.XLS.
using Spire.Xls; namespace RowDelete { class Program { static void Main(string[] args) { Workbook workbook = new Workbook(); workbook.LoadFromFile(@"..\..\..\..\Data\parts.xls"); Worksheet sheet = workbook.Worksheets[0]; //delete the second row from sheet sheet.DeleteRow(2); //delete the seventh and eighth rows from sheet sheet.DeleteRow(7,2); workbook.SaveToFile("sample.xls", ExcelVersion.Version97to2003); System.Diagnostics.Process.Start(workbook.FileName); } } }
Imports Spire.Xls Namespace RowDelete Friend Class Program Shared Sub Main(ByVal args() As String) Dim workbook As New Workbook() workbook.LoadFromFile("..\..\..\..\Data\parts.xls") Dim sheet As Worksheet = workbook.Worksheets(0) 'delete the second row from sheet sheet.DeleteRow(2) 'delete the seventh and eighth rows from sheet sheet.DeleteRow(7,2) workbook.SaveToFile("sample.xls", ExcelVersion.Version97to2003) System.Diagnostics.Process.Start(workbook.FileName) End Sub End Class End Namespace