/** * Add a new column to the right end of the table. * * @param columnName * the unique name of the column, must not be {@code null} * @return the created table column * @since 4.0.0 */ public XSSFTableColumn createColumn(String columnName) { return createColumn(columnName, getColumnCount()); }
if (columnMap == null) { final int count = getColumnCount(); columnMap = new HashMap<>(count * 3 / 2);
/** * 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(); }
int columnCount = getColumnCount(); int newColumnCount = (tableArea.getLastCell().getCol() - tableArea.getFirstCell().getCol()) + 1; if (newColumnCount > columnCount) {
int columnCount = getColumnCount(); if(columnIndex < 0 || columnIndex > columnCount) { throw new IllegalArgumentException("Column index out of bounds");
/** * Add a new column to the right end of the table. * * @param columnName * the unique name of the column, must not be {@code null} * @return the created table column * @since 4.0.0 */ public XSSFTableColumn createColumn(String columnName) { return createColumn(columnName, getColumnCount()); }
/** * 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(); }
if (columnMap == null) { final int count = getColumnCount(); columnMap = new HashMap<>(count * 3 / 2);
int columnCount = getColumnCount(); int newColumnCount = (tableArea.getLastCell().getCol() - tableArea.getFirstCell().getCol()) + 1; if (newColumnCount > columnCount) {
int columnCount = getColumnCount(); if(columnIndex < 0 || columnIndex > columnCount) { throw new IllegalArgumentException("Column index out of bounds");