xelem.3.0

nl.fountain.xelem.excel
Interface Column

All Superinterfaces:
XLElement
All Known Implementing Classes:
SSColumn

public interface Column
extends XLElement

Represents the Column element. Only add columns if formatting of columns is necessary.

The XLElement Column is not aware of it's parent, nor of it's index-position in a table or worksheet. This makes it possible to use the same instances of columns on different worksheets, or different places in the worksheet. Only at the time of assembly the column-index and the attribute ss:Index are automatically set, if necessary. See also: Table.columnIterator(). (Also a Column that is read by the nl.fountain.xelem.lex-API has it's index set.)


Field Summary
 
Fields inherited from interface nl.fountain.xelem.excel.XLElement
PREFIX_HTML, PREFIX_O, PREFIX_SS, PREFIX_X, XMLNS, XMLNS_HTML, XMLNS_O, XMLNS_SS, XMLNS_X
 
Method Summary
 boolean getAutoFitWith()
          Specifies whether autofit was set on this column.
 int getIndex()
          Gets the value of the ss:Index-attribute of this Column-element.
 int getSpan()
          Gets the number of extra columns this column spans.
 String getStyleID()
          Gets the ss:StyleID which was set on this column.
 double getWidth()
          Gets the width of this column.
 boolean isHidden()
          Specifies whether this column is hidden.
 void setAutoFitWidth(boolean autoFit)
          Sets column-width to autofit for datatypes 'DateTime' and 'Number'.
 void setHidden(boolean hide)
          Sets whether this column will be hidden.
 void setIndex(int index)
          Sets the value of the ss:Index-attribute of this Column-element.
 void setSpan(int s)
          Sets the span of this column.
 void setStyleID(String id)
          Sets the ss:StyleID on this column.
 void setWidth(double w)
          Sets the width of this column.
 
Methods inherited from interface nl.fountain.xelem.excel.XLElement
addElementComment, assemble, getElementComments, getNameSpace, getPrefix, getTagName, setAttributes, setChildElement
 

Method Detail

setStyleID

void setStyleID(String id)
Sets the ss:StyleID on this column. If no styleID is set on a column, the ss:StyleID-attribute is not deployed in the resulting xml and Excel employes the Default-style on the column.

Parameters:
id - the id of the style to employ on this column.

getStyleID

String getStyleID()
Gets the ss:StyleID which was set on this column.

Returns:
The id of the style to employ on this column or null if no styleID was previously set.

setAutoFitWidth

void setAutoFitWidth(boolean autoFit)
Sets column-width to autofit for datatypes 'DateTime' and 'Number'. The default setting of Excel is 'true', so this method only has effect when false is passed as a parameter.

Parameters:
autoFit - false if no autofit of column-width is desired.

getAutoFitWith

boolean getAutoFitWith()
Specifies whether autofit was set on this column.

Returns:
true if column-width is set to autofit, false otherwise

setSpan

void setSpan(int s)
Sets the span of this column. The value of s must be greater than 0 in order to have effect on the resulting xml.

No other columns must be added within the span of this column:

         Column column = table.addColumn(5); // adds a column with index 5
         column.setWidth(25.2);              // do some formatting on the column
         column.setSpan(3);                  // span a total of 4 columns
         // illegal: first free index = 5 + 3 + 1 = 9
         // Column column2 = table.addColumn(8);
 

Parameters:
s - The number of additional columns to include in the span.

getSpan

int getSpan()
Gets the number of extra columns this column spans.

Returns:
the number of extra columns this column spans

setWidth

void setWidth(double w)
Sets the width of this column.

Parameters:
w - The width of the column (in points).

getWidth

double getWidth()
Gets the width of this column. A return value of 0.0 may indicate this column has a default width.

Returns:
the width of this column

setHidden

void setHidden(boolean hide)
Sets whether this column will be hidden.

Parameters:
hide - true if this column must not be displayed.

isHidden

boolean isHidden()
Specifies whether this column is hidden.


setIndex

void setIndex(int index)
Sets the value of the ss:Index-attribute of this Column-element. Any value set may be overruled by Table.columnIterator(), which sets the index of columns during assembly.

If you want to place a column in any particular place, use the addColumnAt-methods of Table or Worksheet.

Parameters:
index - the index of this column

getIndex

int getIndex()
Gets the value of the ss:Index-attribute of this Column-element. The returned value only makes sence if this column was read with the reader-API in the nl.fountain.xelem.lex-package and before any manipulation of this column or the workbook took place.

Returns:
the value of the ss:Index-attribute of this Column-element
Since:
xelem.2.0

xelem.3.0