Free Support Forum - aspose.com

DeleteColumn() bug

Hi,

I’m using 1.9.1.4. I’m doing the following:

byte col = 20;
worksheet.Cells.DeleteColumn(col);

This compiles fine but when I run it I get the following exception:

‘object must be of type Byte’

Any ideas?

Haydn

Hi Haydn,

Sorry for the bug. Please download the latest hotfix. It’s fixed.

@Haydn,
Aspose.Cells has replaced Aspose.Excel which is no more available now. You can perform all the tasks which were supported by Aspose.Excel as well as work with the latest features available in different versions of MS Excel. Inserting and deleting the rows and columns is supported in this new product also along with the option to insert data with formatting. Following is a code snippet which demonstrates the deletion of column using Aspose.Cells.

// Instantiating a Workbook object
// Opening the Excel file
Workbook workbook = new Workbook("book1.xlsx");

// Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets[0];

// Deleting a column from the worksheet at 5th position
worksheet.Cells.DeleteColumn(4);

// Saving the modified Excel file
workbook.Save(dataDir + "output.xlsx");

Following document contains further details about inserting and deleting rows/columns in Excel files:
Inserting and Deleting Rows and Columns

Download the latest version of the product from the following link:
Aspose.Cells for .NET (Latest Version)

Give a try to the exciting features using a ready to run solution here.