/** * Remove a column from the table. * * @param column * the column to remove * @since 4.0.0 */ public void removeColumn(XSSFTableColumn column) { int columnIndex = getColumns().indexOf(column); if (columnIndex >= 0) { ctTable.getTableColumns().removeTableColumn(columnIndex); updateReferences(); updateHeaders(); } }
/** * Remove a column from the table. * * @param columnIndex * the 0-based position of the column in the table * @throws IllegalArgumentException * if no column at the index exists or if the table has only a * single column * @since 4.0.0 */ public void removeColumn(int columnIndex) { if (columnIndex < 0 || columnIndex > getColumnCount() - 1) { throw new IllegalArgumentException("Column index out of bounds"); } if(getColumnCount() == 1) { throw new IllegalArgumentException("Table must have at least one column"); } CTTableColumns tableColumns = ctTable.getTableColumns(); tableColumns.removeTableColumn(columnIndex); tableColumns.setCount(tableColumns.getTableColumnList().size()); updateReferences(); updateHeaders(); }
/** * Remove a column from the table. * * @param column * the column to remove * @since 4.0.0 */ public void removeColumn(XSSFTableColumn column) { int columnIndex = getColumns().indexOf(column); if (columnIndex >= 0) { ctTable.getTableColumns().removeTableColumn(columnIndex); updateReferences(); updateHeaders(); } }
/** * Remove a column from the table. * * @param columnIndex * the 0-based position of the column in the table * @throws IllegalArgumentException * if no column at the index exists or if the table has only a * single column * @since 4.0.0 */ public void removeColumn(int columnIndex) { if (columnIndex < 0 || columnIndex > getColumnCount() - 1) { throw new IllegalArgumentException("Column index out of bounds"); } if(getColumnCount() == 1) { throw new IllegalArgumentException("Table must have at least one column"); } CTTableColumns tableColumns = ctTable.getTableColumns(); tableColumns.removeTableColumn(columnIndex); tableColumns.setCount(tableColumns.getTableColumnList().size()); updateReferences(); updateHeaders(); }
ctColumns.removeTableColumn(0);