Free Support Forum - aspose.com

DeleteColumn

Hi,

im deleting columns and its not working...my code is:

for (int j = data.NumberOfColumns; j < sheet.Cells.MaxColumn; ++j)

sheet.Cells.DeleteColumn(j);

any sugestion?

Thank you,

Paulo

Hi,

Do you find some error deleting the columns in the grid. I tested and I can delete worksheet columns without any problem what so ever.

Which version of Aspose.Grid.Web you are using. Kindly try the latest version.

If you still find the problem, kindly create a sample asp.net project, zip it and post it here with all its source files to reproduce the issue. We will check it soon.

Thank you.

Hi,

After deleting a column, the Cells.MaxColumn will also be decreased by 1. So you may write your code like this:

int columnsToDelete = 5; // assume that you want to delete 5 columns;

int firstColumnToDelete = 3; // assume that you want to delete from the column 3;

for (int i=0; i < columnsToDelete; i++)

{

sheet.Cells.DeleteColumn(firstColumnToDelete);

}

hi,

Im using version 1.9.3.0.

I tried to delete columns like henry says and it didnt work...

tks,

Paulo

Hi,

Please make a simple project to illustrate this issue and post it here, and we will check it soon.