use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol in project poi by apache.
the class ColumnHelper method setColWidth.
public void setColWidth(long index, double width) {
CTCol col = getOrCreateColumn1Based(index + 1, true);
col.setWidth(width);
}
use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol in project poi by apache.
the class ColumnHelper method setColHidden.
public void setColHidden(long index, boolean hidden) {
CTCol col = getOrCreateColumn1Based(index + 1, true);
col.setHidden(hidden);
}
use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol in project poi by apache.
the class ColumnHelper method getColumn1Based.
/**
* Returns the Column at the given 1 based index.
* POI default is 0 based, but the file stores
* as 1 based.
*/
public CTCol getColumn1Based(long index1, boolean splitColumns) {
CTCols cols = worksheet.getColsArray(0);
// Fetching the array is quicker than working on the new style
// list, assuming we need to read many of them (which we often do),
// and assuming we're not making many changes (which we're not)
CTCol[] colArray = cols.getColArray();
for (CTCol col : colArray) {
long colMin = col.getMin();
long colMax = col.getMax();
if (colMin <= index1 && colMax >= index1) {
if (splitColumns) {
if (colMin < index1) {
insertCol(cols, colMin, (index1 - 1), new CTCol[] { col });
}
if (colMax > index1) {
insertCol(cols, (index1 + 1), colMax, new CTCol[] { col });
}
col.setMin(index1);
col.setMax(index1);
}
return col;
}
}
return null;
}
use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol in project poi by apache.
the class ColumnHelper method cloneCol.
private CTCol cloneCol(final CTCols cols, final CTCol col, final long[] newRange) {
CTCol cloneCol = cloneCol(cols, col);
cloneCol.setMin(newRange[0]);
cloneCol.setMax(newRange[1]);
return cloneCol;
}
use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol in project poi by apache.
the class ColumnHelper method setColBestFit.
public void setColBestFit(long index, boolean bestFit) {
CTCol col = getOrCreateColumn1Based(index + 1, false);
col.setBestFit(bestFit);
}
Aggregations