xelem.3.0

nl.fountain.xelem.excel.ss
Class SSColumn

java.lang.Object
  extended by nl.fountain.xelem.excel.AbstractXLElement
      extended by nl.fountain.xelem.excel.ss.SSColumn
All Implemented Interfaces:
Column, XLElement

public class SSColumn
extends AbstractXLElement
implements Column

An implementation of the XLElement Column.


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
 
Constructor Summary
SSColumn()
          Creates a new SSColumn.
 
Method Summary
 Element assemble(Element parent, GIO gio)
          Assembles the state of this XLElement and all of it's children into an Element.
 boolean getAutoFitWith()
          Specifies whether autofit was set on this column.
 int getIndex()
          Gets the value of the ss:Index-attribute of this Column-element.
 String getNameSpace()
          Gets the namespace of this XLElement.
 String getPrefix()
          Gets the prefix of this XLElement.
 int getSpan()
          Gets the number of extra columns this column spans.
 String getStyleID()
          Gets the ss:StyleID which was set on this column.
 String getTagName()
          Gets the tagname (localName) of this XLElement.
 double getWidth()
          Gets the width of this column.
 boolean isHidden()
          Specifies whether this column is hidden.
 void setAttributes(Attributes attrs)
          Does effectively nothing.
 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 class nl.fountain.xelem.excel.AbstractXLElement
addElementComment, assemble, createAttributeNS, createAttributeNS, createElementNS, createElementNS, createElementNS, createElementNS, getElementComments, setChildElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nl.fountain.xelem.excel.XLElement
addElementComment, getElementComments, setChildElement
 

Constructor Detail

SSColumn

public SSColumn()
Creates a new SSColumn.

See Also:
Worksheet.addColumn()
Method Detail

setStyleID

public void setStyleID(String id)
Description copied from interface: Column
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.

Specified by:
setStyleID in interface Column
Parameters:
id - the id of the style to employ on this column.

getStyleID

public String getStyleID()
Description copied from interface: Column
Gets the ss:StyleID which was set on this column.

Specified by:
getStyleID in interface Column
Returns:
The id of the style to employ on this column or null if no styleID was previously set.

setAutoFitWidth

public void setAutoFitWidth(boolean autoFit)
Description copied from interface: Column
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.

Specified by:
setAutoFitWidth in interface Column
Parameters:
autoFit - false if no autofit of column-width is desired.

getAutoFitWith

public boolean getAutoFitWith()
Description copied from interface: Column
Specifies whether autofit was set on this column.

Specified by:
getAutoFitWith in interface Column
Returns:
true if column-width is set to autofit, false otherwise

setSpan

public void setSpan(int s)
Description copied from interface: Column
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);
 

Specified by:
setSpan in interface Column
Parameters:
s - The number of additional columns to include in the span.

getSpan

public int getSpan()
Description copied from interface: Column
Gets the number of extra columns this column spans.

Specified by:
getSpan in interface Column
Returns:
the number of extra columns this column spans

setWidth

public void setWidth(double w)
Description copied from interface: Column
Sets the width of this column.

Specified by:
setWidth in interface Column
Parameters:
w - The width of the column (in points).

getWidth

public double getWidth()
Description copied from interface: Column
Gets the width of this column. A return value of 0.0 may indicate this column has a default width.

Specified by:
getWidth in interface Column
Returns:
the width of this column

setHidden

public void setHidden(boolean hide)
Description copied from interface: Column
Sets whether this column will be hidden.

Specified by:
setHidden in interface Column
Parameters:
hide - true if this column must not be displayed.

isHidden

public boolean isHidden()
Description copied from interface: Column
Specifies whether this column is hidden.

Specified by:
isHidden in interface Column

getTagName

public String getTagName()
Description copied from interface: XLElement
Gets the tagname (localName) of this XLElement.

Specified by:
getTagName in interface XLElement
Returns:
qualified name

getNameSpace

public String getNameSpace()
Description copied from interface: XLElement
Gets the namespace of this XLElement.

Specified by:
getNameSpace in interface XLElement
Returns:
namespace

getPrefix

public String getPrefix()
Description copied from interface: XLElement
Gets the prefix of this XLElement.

Specified by:
getPrefix in interface XLElement
Returns:
prefix

assemble

public Element assemble(Element parent,
                        GIO gio)
Description copied from interface: XLElement
Assembles the state of this XLElement and all of it's children into an Element. Attaches the new element to it's parent-element if needed.

Specified by:
assemble in interface XLElement
Parameters:
parent - the parent-element to which the new formed element will be appended
gio - a global information object
Returns:
the newly assembled element. may be null.

setAttributes

public void setAttributes(Attributes attrs)
Description copied from class: AbstractXLElement
Does effectively nothing.

Specified by:
setAttributes in interface XLElement
Overrides:
setAttributes in class AbstractXLElement
Parameters:
attrs - the attributes found on the element

setIndex

public void setIndex(int index)
Sets the value of the ss:Index-attribute of this Column-element. This method is called by Table.columnIterator() to set the index of this column during assembly.

Specified by:
setIndex in interface Column
Parameters:
index - the index of this column

getIndex

public int getIndex()
Description copied from interface: Column
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.

Specified by:
getIndex in interface Column
Returns:
the value of the ss:Index-attribute of this Column-element

xelem.3.0