public CTCol cloneCol(CTCols cols, CTCol col) { CTCol newCol = cols.addNewCol(); newCol.setMin(col.getMin()); newCol.setMax(col.getMax()); setColumnAttributes(col, newCol); return newCol; }
private CTCol insertCol( CTCols cols, long min, long max, CTCol[] colsWithAttributes, boolean ignoreExistsCheck, CTCol overrideColumn) { if (ignoreExistsCheck || !columnExists(cols, min, max)) { CTCol newCol = cols.insertNewCol(0); newCol.setMin(min); newCol.setMax(max); for (CTCol col : colsWithAttributes) { setColumnAttributes(col, newCol); } if (overrideColumn != null) setColumnAttributes(overrideColumn, newCol); return newCol; } return null; }
public void testSetColumnAttributes() { CTCol col = CTCol.Factory.newInstance(); col.setWidth(12); col.setHidden(true); CTCol newCol = CTCol.Factory.newInstance(); assertEquals(0.0, newCol.getWidth(), 0.0); assertFalse(newCol.getHidden()); ColumnHelper helper = new ColumnHelper(CTWorksheet.Factory.newInstance()); helper.setColumnAttributes(col, newCol); assertEquals(12.0, newCol.getWidth(), 0.0); assertTrue(newCol.getHidden()); }