You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by "jsaunders2011@gmail.com" <js...@gmail.com> on 2017/12/25 04:13:37 UTC

Delete Column from a XSLFTable

I need to delete a column from a table in a PPT slide. I don't see an method on XSLFTable that will allow me to do this.  I've experimented extensively with this, but it doesn't work properly:

                         CTTableGrid tableGrid = table.getCTTable().getTblGrid();
    			CTTableCol[] columns = tableGrid.getGridColArray();
    			columns = ArrayUtils.remove(columns, columnIndexToDelete);
    			tableGrid.setGridColArray(columns);

It always seems to delete the last column of the table, regardless of the index passed in.
I've also tried this:

    			table.getCTTable().getTblGrid().removeGridCol(columnIndexToDelete);

It results in the same behavior. Any suggestions?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Delete Column from a XSLFTable

Posted by Andreas Beeker <ki...@apache.org>.
I've prepared an example on how to delete a column - does it work for you?:
https://pastebin.com/AVNTX9yJ

... and yes, I guess this should be inside the API and a few package access methods made public.
I think I haven't yet made the setGridSpan & Co. methods public, as I wanted to have an implementation for HSLF too.

Andi.