Sample: Remove columns from existing Excel (.XLS) document using Bytescout Spreadsheet SDK

  • Home
  • /
  • Articles
  • /
  • Sample: Remove columns from existing Excel (.XLS) document using Bytescout Spreadsheet SDK

How to remove columns from existing Excel (.XLS) document using Bytescout Spreadsheet SDK

This source code sample removes columns from existing XLS document and saves modified document into new document file using Bytescout Spreadsheet lib

Download example source code: bytescoutxls_removing_columns_from_existing_xls.zip (5 KB)

Source document

Column was removed and document saved as new

using System;
using System.Collections.Generic;
using System.Text;
using Bytescout.Spreadsheet;

namespace Removing_columns_from_existing_XLS
{
class Program
{
static void Main(string[] args)
{
// Open Spreadsheet
Spreadsheet document = new Spreadsheet(“AdvancedReport.xls”);
// Get Worksheet
Worksheet worksheet = document.Workbook.Worksheets[0];
// Remove Column
worksheet.Columns.Delete(1, 1);
// Save document
document.SaveAs(“AdvancedReport1.xls”);
// Close Spreadsheet
document.Close();
}
}
}

Download example source code: bytescoutxls_removing_columns_from_existing_xls.zip (5 KB)


prev
next