org.apache.poi.xssf.usermodel.helpers
Class ColumnHelper

java.lang.Object
  extended by org.apache.poi.xssf.usermodel.helpers.ColumnHelper

public class ColumnHelper
extends java.lang.Object

Helper class for dealing with the Column settings on a CTWorksheet (the data part of a sheet). Note - within POI, we use 0 based column indexes, but the column definitions in the XML are 1 based!


Constructor Summary
ColumnHelper(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet worksheet)
           
 
Method Summary
 org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCols addCleanColIntoCols(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCols cols, org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol col)
           
 void cleanColumns()
           
 org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol cloneCol(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCols cols, org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol col)
           
 boolean columnExists(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCols cols, long index)
          Does the column at the given 0 based index exist in the supplied list of column definitions?
 int getColDefaultStyle(long index)
           
 org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol getColumn(long index, boolean splitColumns)
          Returns the Column at the given 0 based index
 org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol getColumn1Based(long index1, boolean splitColumns)
          Returns the Column at the given 1 based index.
 int getIndexOfColumn(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCols cols, org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol col)
           
protected  org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol getOrCreateColumn1Based(long index1, boolean splitColumns)
          Return the CTCol at the given (0 based) column index, creating it if required.
 void setColBestFit(long index, boolean bestFit)
           
 void setColDefaultStyle(long index, CellStyle style)
           
 void setColDefaultStyle(long index, int styleId)
           
 void setColHidden(long index, boolean hidden)
           
 void setColumnAttributes(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol fromCol, org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol toCol)
           
 void setColWidth(long index, double width)
           
 void setCustomWidth(long index, boolean bestFit)
           
static void sortColumns(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCols newCols)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColumnHelper

public ColumnHelper(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet worksheet)
Method Detail

cleanColumns

public void cleanColumns()

sortColumns

public static void sortColumns(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCols newCols)

cloneCol

public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol cloneCol(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCols cols,
                                                                          org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol col)

getColumn

public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol getColumn(long index,
                                                                           boolean splitColumns)
Returns the Column at the given 0 based index


getColumn1Based

public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol getColumn1Based(long index1,
                                                                                 boolean splitColumns)
Returns the Column at the given 1 based index. POI default is 0 based, but the file stores as 1 based.


addCleanColIntoCols

public org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCols addCleanColIntoCols(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCols cols,
                                                                                      org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol col)

columnExists

public boolean columnExists(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCols cols,
                            long index)
Does the column at the given 0 based index exist in the supplied list of column definitions?


setColumnAttributes

public void setColumnAttributes(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol fromCol,
                                org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol toCol)

setColBestFit

public void setColBestFit(long index,
                          boolean bestFit)

setCustomWidth

public void setCustomWidth(long index,
                           boolean bestFit)

setColWidth

public void setColWidth(long index,
                        double width)

setColHidden

public void setColHidden(long index,
                         boolean hidden)

getOrCreateColumn1Based

protected org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol getOrCreateColumn1Based(long index1,
                                                                                            boolean splitColumns)
Return the CTCol at the given (0 based) column index, creating it if required.


setColDefaultStyle

public void setColDefaultStyle(long index,
                               CellStyle style)

setColDefaultStyle

public void setColDefaultStyle(long index,
                               int styleId)

getColDefaultStyle

public int getColDefaultStyle(long index)

getIndexOfColumn

public int getIndexOfColumn(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCols cols,
                            org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol col)


Copyright 2012 The Apache Software Foundation or its licensors, as applicable.