/** * Note this list is static - once read, it does not notice later changes to the underlying column structures * To clear the cache, call {@link #updateHeaders} * @return List of XSSFTableColumn * @since 4.0.0 */ public List<XSSFTableColumn> getColumns() { if (tableColumns == null) { List<XSSFTableColumn> columns = new ArrayList<>(); CTTableColumns ctTableColumns = ctTable.getTableColumns(); if (ctTableColumns != null) { for (CTTableColumn column : ctTableColumns.getTableColumnList()) { XSSFTableColumn tableColumn = new XSSFTableColumn(this, column); columns.add(tableColumn); } } tableColumns = Collections.unmodifiableList(columns); } return tableColumns; }
/** * 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(); }
CTTableColumns ctTableColumns = getCTTable().getTableColumns(); if(ctTableColumns != null) { for (CTTableColumn col : ctTableColumns.getTableColumnList()) { XSSFCell cell = row.getCell(cellnum); if (cell != null) {
/** * Note this list is static - once read, it does not notice later changes to the underlying column structures * To clear the cache, call {@link #updateHeaders} * @return List of XSSFTableColumn * @since 4.0.0 */ public List<XSSFTableColumn> getColumns() { if (tableColumns == null) { List<XSSFTableColumn> columns = new ArrayList<>(); CTTableColumns ctTableColumns = ctTable.getTableColumns(); if (ctTableColumns != null) { for (CTTableColumn column : ctTableColumns.getTableColumnList()) { XSSFTableColumn tableColumn = new XSSFTableColumn(this, column); columns.add(tableColumn); } } tableColumns = Collections.unmodifiableList(columns); } return tableColumns; }
public List<XSSFXmlColumnPr> getXmlColumnPrs() { if(xmlColumnPr==null){ xmlColumnPr = new Vector<XSSFXmlColumnPr>(); for(CTTableColumn column:ctTable.getTableColumns().getTableColumnList()){ if(column.getXmlColumnPr()!=null){ XSSFXmlColumnPr columnPr = new XSSFXmlColumnPr(this,column,column.getXmlColumnPr()); xmlColumnPr.add(columnPr); } } } return xmlColumnPr; }
for(CTTableColumn column :ctTable.getTableColumns().getTableColumnList()){ if(column.getXmlColumnPr()!=null){ String xpath = column.getXmlColumnPr().getXpath();
/** * 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(); }
CTTableColumns ctTableColumns = getCTTable().getTableColumns(); if(ctTableColumns != null) { for (CTTableColumn col : ctTableColumns.getTableColumnList()) { XSSFCell cell = row.getCell(cellnum); if (cell != null) {