We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Exception when deleting table column: class com.aspose.slides.PptxEditException: Some of column's cells lay outside column

I’m trying to use the Aspose.Slides Java API to delete a few columns from a table. Some column deletes work, but a particular column delete fails with an exception:

class com.aspose.slides.PptxEditException: Some of column’s cells lay outside column

I don’t understand how cells can lay outside a column. What would cause this?

@jsaunders2011,

I have observed the issue shared by you and request you to please share the source presentation and working sample code reproducing the issue on your end. Please provide the requested information so that we may proceed to help you out.

test_column_delete.zip (32.0 KB)

@mudassir.fayyaz Zip file contains presentation and java class with main method.

@jsaunders2011,

I have observed the presentation and sample code shared by you. In your presentation the table has many merged columns. You can adopt the approach to remove the columns either using following sample code.

table.getColumns().removeAt(i - columnsDeleted, true);

The true means that you will also be deleting the associated rows and columns with this. Since you are deleting the columns in a loop, so you need to take care of the fact that sequential index may not work in this regard. The other option is to split all rows to actual columns first and then remove the particular columns from it using

table.getColumns().removeAt(i - columnsDeleted, false);

I suggest you to please visit this thread link for your convenience as well where by I have shared an approach to remove the merged row from table.

If you still find issue then please share the desired output table that you want to achieve after removing columns and I will help you further.