Nasosoft Excel for .NET

   Minimize
Insert and Delete a Row
Insert a Row
Code Sample
[C#]
 
//Create a Workbook object
XlsWorkbook workbook = new XlsWorkbook();
 
Worksheet worksheet = workbook.Worksheets[0];
 
//Insert a row into the worksheet
worksheet.InsertRow(2);
 
//Save the Excel file
workbook.Save("output.xls");
 
[VB.NET]
 
'Create a Workbook object
Dim workbook As XlsWorkbook = New XlsWorkbook ()
 
'Get the first worksheet
Dim worksheet As XlsWorksheet= workbook.Worksheets(0)
 
'Insert a row into the worksheet
worksheet.InsertRow(2);
 
'Save the Excel file
workbook.Save("output.xls");
 
Delete a Row
Code Sample
[C#]
 
//Create a Workbook object
XlsWorkbook workbook = new XlsWorkbook();
 
Worksheet worksheet = workbook.Worksheets[0];
 
//Delete a row into the worksheet
worksheet.DeleteRow(2);
 
//Save the Excel file
workbook.Save("book1.xls");
 
[VB.NET]
 
'Create a Workbook object
Dim workbook As XlsWorkbook = New XlsWorkbook ()
 
'Get the first worksheet
Dim worksheet As XlsWorksheet= workbook.Worksheets(0)
 
'Delete a row into the worksheet
worksheet.DeleteRow(2);
 
'Save the Excel file
workbook.Save("book1.xls");