|
xelem.3.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nl.fountain.xelem.excel.AbstractXLElement nl.fountain.xelem.excel.ss.SSWorksheet
public class SSWorksheet
An implementation of the XLElement Worksheet.
This class can be used to add rows, columns and cells to the worksheet.
The addCell-methods add a cell at the current position of the
worksheet's cellPointer (see getCellPointer()
) and move the
cellPointer. If you whish to obtain the address of the newly added cell,
it should be obtained from the cellPointer prior to the add:
Address adr = sheet.getCellPointer().getAddress(); Cell cell = sheet.addCell();The addCellAt-methods, which take an address, a string or a row/column pair of ints as parameter, move the cellPointer to the specified position, add a cell and leave the cellPointer pointing to the next position.
Field Summary |
---|
Fields inherited from interface nl.fountain.xelem.excel.Worksheet |
---|
firstColumn, firstRow, lastColumn, lastRow |
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 | |
---|---|
SSWorksheet(String name)
Constructs a new SSWorksheet with the given name. |
Method Summary | |
---|---|
Cell |
addCell()
Adds a new cell at the current position of the worksheets CellPointer and moves the cellpointer. |
Cell |
addCell(Cell cell)
Adds the given cell at the current position of the worksheets CellPointer and moves the cellpointer. |
Cell |
addCell(double data)
Adds a new cell at the current position of the worksheets CellPointer and moves the cellpointer. |
Cell |
addCell(double data,
String styleID)
Adds a new cell at the current position of the worksheets CellPointer and moves the cellpointer. |
Cell |
addCell(int data)
Adds a new cell at the current position of the worksheets CellPointer and moves the cellpointer. |
Cell |
addCell(int data,
String styleID)
Adds a new cell at the current position of the worksheets CellPointer and moves the cellpointer. |
Cell |
addCell(Object data)
Adds a new cell at the current position of the worksheets CellPointer and moves the cellpointer. |
Cell |
addCell(Object data,
String styleID)
Adds a new cell at the current position of the worksheets CellPointer and moves the cellpointer. |
Cell |
addCellAt(Address address)
Adds a new cell at the given address. |
Cell |
addCellAt(Address address,
Cell cell)
Adds the given cell at the given address. |
Cell |
addCellAt(int rowIndex,
int columnIndex)
Adds a new cell at the given row and column index. |
Cell |
addCellAt(int rowIndex,
int columnIndex,
Cell cell)
Adds the given cell at the given row and column index. |
Cell |
addCellAt(String a1_ref)
Adds a new cell at the address specified by the A1-reference string. |
Cell |
addCellAt(String a1_ref,
Cell cell)
Adds the given cell at the address specified by the A1-reference string. |
Column |
addColumn()
Adds a new Column to this worksheet. |
Column |
addColumn(Column column)
Adds the given column to this worksheet. |
Column |
addColumnAt(int index)
Adds a new Column at the given index to this worksheet. |
Column |
addColumnAt(int index,
Column column)
Adds the given Column at the given index to this worksheet. |
Column |
addColumnAt(String label)
Adds a new Column at the index specified by the given label. |
Column |
addColumnAt(String label,
Column column)
Adds the given Column at the given index specified by the given label. |
NamedRange |
addNamedRange(NamedRange nr)
Adds a new NamedRange to this worksheet. |
NamedRange |
addNamedRange(String name,
String refersTo)
Adds a new NamedRange to this worksheet. |
Row |
addRow()
Adds a new Row to this worksheet. |
Row |
addRow(Row row)
Adds the given row to this worksheet. |
Row |
addRowAt(int rowIndex)
Adds a new Row at the given index to this worksheet. |
Row |
addRowAt(int index,
Row row)
Adds the given Row at the given index to this worksheet. |
Element |
assemble(Element parent,
GIO gio)
Assembles the state of this XLElement and all of it's children into an Element . |
Cell |
getCellAt(Address address)
Gets the cell at the given address. |
Cell |
getCellAt(int rowIndex,
int columnIndex)
Gets the cell at the given coordinates. |
Cell |
getCellAt(String a1_ref)
Gets the cell at address specified by the given string in A1-reference style. |
CellPointer |
getCellPointer()
Gets the cellpointer of this worksheet. |
Column |
getColumnAt(int columnIndex)
Gets the column at the given index. |
Column |
getColumnAt(String label)
Gets the column at the index specified by the given label. |
Collection<Column> |
getColumns()
Gets all the columns of this worksheet in the order of their index. |
String |
getName()
Returns the name of this worksheet. |
Map<String,NamedRange> |
getNamedRanges()
Gets all the NamedRanges that were added to this worksheet. |
String |
getNameSpace()
Gets the namespace of this XLElement. |
String |
getPrefix()
Gets the prefix of this XLElement. |
String |
getReferenceName()
Returns the name of this worksheet for purposes of reference. |
Row |
getRowAt(int rowIndex)
Gets the row at the given index. |
Collection<Row> |
getRows()
Gets all the rows of this worksheet in the order of their index. |
Table |
getTable()
Gets the table of this worksheet. |
String |
getTagName()
Gets the tagname (localName) of this XLElement. |
WorksheetOptions |
getWorksheetOptions()
Gets the WorksheetOptions of this worksheet. |
boolean |
hasAutoFilter()
Specifies whether the setAutoFilter -method
was applied on this worksheet. |
boolean |
hasCellAt(Address address)
Specifies whether there is a cell at the given address. |
boolean |
hasCellAt(int rowIndex,
int columnIndex)
Specifies whether there is a cell at the intersection of the given row and column index. |
boolean |
hasCellAt(String a1_ref)
Specifies whether there is a cell at the address specified by the given string in A1-reference style. |
boolean |
hasColumnAt(int columnIndex)
Specifies whether there is a column at the given column index. |
boolean |
hasColumnAt(String label)
Specifies whether there is a column at the index specified by the given label. |
boolean |
hasRowAt(int rowIndex)
Specifies whether there is a row at the given row index. |
boolean |
hasTable()
Indicates whether this worksheet has a table. |
boolean |
hasWorksheetOptions()
Indicates whether WorksheetOptions was added to this worksheet. |
boolean |
isProtected()
Specifies whether protection is applied to this worksheet. |
boolean |
isRightToLeft()
Specifies whether this worksheet is displayed from right to left. |
void |
removeAutoFilter()
Removes the Autofilter on this worksheet. |
Cell |
removeCellAt(Address address)
Removes the cell at the given address. |
Cell |
removeCellAt(int rowIndex,
int columnIndex)
Removes the cell at the given coordinates. |
Cell |
removeCellAt(String a1_ref)
Removes the cell at the address specified by the A1-reference string. |
Column |
removeColumnAt(int columnIndex)
Removes the column at the given index. |
Column |
removeColumnAt(String label)
Removes the column at the index specified by the given label. |
Row |
removeRowAt(int rowIndex)
Removes the row at the given index. |
void |
setAttributes(Attributes attrs)
Does effectively nothing. |
void |
setAutoFilter(AutoFilter af)
Sets the AutoFilter on this worksheet. |
void |
setAutoFilter(String rcString)
Sets the AutoFilter-option on the specified range. |
void |
setProtected(boolean p)
Sets whether protection will be applied to this worksheet. |
void |
setRightToLeft(boolean r)
Sets whether this worksheet will be displayed from right to left. |
void |
setTable(Table table)
Sets the given table as the table of this worksheet. |
void |
setWorksheetOptions(WorksheetOptions wso)
Sets the given worksheetOptions as the worksheetOptions of this worksheet. |
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 |
---|
public SSWorksheet(String name)
Workbook.addSheet()
Method Detail |
---|
public String getName()
Worksheet
getName
in interface Worksheet
public String getReferenceName()
Worksheet
getReferenceName
in interface Worksheet
public void setProtected(boolean p)
Worksheet
setProtected
in interface Worksheet
public boolean isProtected()
Worksheet
isProtected
in interface Worksheet
true
if this worksheet is protectedpublic void setRightToLeft(boolean r)
Worksheet
setRightToLeft
in interface Worksheet
public boolean isRightToLeft()
Worksheet
isRightToLeft
in interface Worksheet
true
if this worksheet is displayed from right to leftpublic NamedRange addNamedRange(NamedRange nr)
Worksheet
If the workbook has a named range with the same name, the named range on the worksheet level has precedence over the one defined on the workbook level.
addNamedRange
in interface Worksheet
nr
- the NamedRange to be added to this worksheet
public NamedRange addNamedRange(String name, String refersTo)
Worksheet
If the workbook has a named range with the same name, the named range on the worksheet level has precedence over the one defined on the workbook level.
The string refersTo
should be in R1C1-reference style i.e.
in the format [worksheet name]!R1C1:R1C1
. You may skip
the worksheet indicator: R1C1:R1C1
will do as well.
addNamedRange
in interface Worksheet
name
- The name to apply to the range.refersTo
- A String of R1C1-reference style.
public Map<String,NamedRange> getNamedRanges()
Worksheet
getNamedRanges
in interface Worksheet
public void setWorksheetOptions(WorksheetOptions wso)
Worksheet
setWorksheetOptions
in interface Worksheet
wso
- the worksheetOptions to be set on this worksheetpublic boolean hasWorksheetOptions()
Worksheet
hasWorksheetOptions
in interface Worksheet
true
if this worksheet has WorksheetOptions.public WorksheetOptions getWorksheetOptions()
Worksheet
getWorksheetOptions
in interface Worksheet
null
.public void setTable(Table table)
Worksheet
setTable
in interface Worksheet
table
- the table to be set on this worksheetpublic Table getTable()
Worksheet
getTable
in interface Worksheet
null
.public boolean hasTable()
Worksheet
hasTable
in interface Worksheet
public CellPointer getCellPointer()
Worksheet
getCellPointer
in interface Worksheet
public Cell addCell()
Worksheet
CellPointer
and moves the cellpointer.
addCell
in interface Worksheet
CellPointer.move()
public Cell addCell(Cell cell)
Worksheet
CellPointer
and moves the cellpointer.
addCell
in interface Worksheet
CellPointer.move()
public Cell addCell(Object data)
Worksheet
CellPointer
and moves the cellpointer.
Datatype and value of the new cell depend on the passed object.
addCell
in interface Worksheet
data
- The data to be displayed in this cell.
Cell.setData(Object)
,
CellPointer.move()
public Cell addCell(Object data, String styleID)
Worksheet
CellPointer
and moves the cellpointer.
Datatype and value of the new cell depend on the passed object. The new cell will have it's styleID set to the given id.
addCell
in interface Worksheet
data
- The data to be displayed in this cell.styleID
- The id of the style to employ on this cell.
Cell.setData(Object)
,
Cell.setStyleID(String)
,
CellPointer.move()
public Cell addCell(double data)
Worksheet
CellPointer
and moves the cellpointer.
addCell
in interface Worksheet
data
- The data to be displayed in this cell.
Cell.setData(double)
,
CellPointer.move()
public Cell addCell(double data, String styleID)
Worksheet
CellPointer
and moves the cellpointer.
addCell
in interface Worksheet
data
- The data to be displayed in this cell.styleID
- The id of the style to employ on this cell.
Cell.setData(double)
,
Cell.setStyleID(String)
,
CellPointer.move()
public Cell addCell(int data)
Worksheet
CellPointer
and moves the cellpointer.
addCell
in interface Worksheet
data
- The data to be displayed in this cell.
CellPointer.move()
public Cell addCell(int data, String styleID)
Worksheet
CellPointer
and moves the cellpointer.
addCell
in interface Worksheet
data
- The data to be displayed in this cell.styleID
- The id of the style to employ on this cell.
Cell.setStyleID(String)
,
CellPointer.move()
public Cell addCellAt(Address address)
Worksheet
address
.
addCellAt
in interface Worksheet
address
- The address where the new cell should be added.
CellPointer.move()
public Cell addCellAt(int rowIndex, int columnIndex)
Worksheet
rowIndex
and columnIndex
.
addCellAt
in interface Worksheet
rowIndex
- The row index (row number).columnIndex
- The column index (column number).
CellPointer.move()
public Cell addCellAt(String a1_ref)
Worksheet
addCellAt
in interface Worksheet
a1_ref
- a string in A1-reference style
CellPointer.move()
public Cell addCellAt(Address address, Cell cell)
Worksheet
address
.
addCellAt
in interface Worksheet
address
- The address where the cell should be added.cell
- The cell to be added.
CellPointer.move()
public Cell addCellAt(int rowIndex, int columnIndex, Cell cell)
Worksheet
rowIndex
and columnIndex
.
addCellAt
in interface Worksheet
rowIndex
- The row index (row number).columnIndex
- The column index (column number).cell
- The cell to be added.
CellPointer.move()
public Cell addCellAt(String a1_ref, Cell cell)
Worksheet
addCellAt
in interface Worksheet
a1_ref
- a string of A1-reference stylecell
- the cell to be added.
CellPointer.move()
public Cell getCellAt(Address address)
Worksheet
getCellAt
in interface Worksheet
address
- The position of the cell.
null
public Cell getCellAt(int rowIndex, int columnIndex)
Worksheet
getCellAt
in interface Worksheet
rowIndex
- The row index (row number).columnIndex
- The column index (column number).
null
public Cell getCellAt(String a1_ref)
Worksheet
getCellAt
in interface Worksheet
a1_ref
- a string of A1-reference style
null
public Cell removeCellAt(Address address)
Worksheet
removeCellAt
in interface Worksheet
address
- The position of the cell to remove.
null
.public Cell removeCellAt(int rowIndex, int columnIndex)
Worksheet
removeCellAt
in interface Worksheet
rowIndex
- The row index (row number).columnIndex
- The column index (column number).
null
.public Cell removeCellAt(String a1_ref)
Worksheet
removeCellAt
in interface Worksheet
a1_ref
- a string of A1-reference style
null
.public boolean hasCellAt(Address address)
Worksheet
hasCellAt
in interface Worksheet
public boolean hasCellAt(int rowIndex, int columnIndex)
Worksheet
hasCellAt
in interface Worksheet
public boolean hasCellAt(String a1_ref)
Worksheet
hasCellAt
in interface Worksheet
public Row addRow()
Worksheet
maxRowIndex
of the underlying Table + 1.
addRow
in interface Worksheet
public Row addRowAt(int rowIndex)
Worksheet
addRowAt
in interface Worksheet
rowIndex
- The index (row number) of the row.
public Row addRow(Row row)
Worksheet
maxRowIndex
of the underlying Table + 1.
addRow
in interface Worksheet
row
- The row to be added.
public Row addRowAt(int index, Row row)
Worksheet
addRowAt
in interface Worksheet
index
- The index (row number) of the row.row
- The row to be added.
public Row removeRowAt(int rowIndex)
Worksheet
removeRowAt
in interface Worksheet
rowIndex
- The index (row number) of the row.
null
if the index was not occupied
by a row.public Collection<Row> getRows()
Worksheet
getRows
in interface Worksheet
public Row getRowAt(int rowIndex)
Worksheet
getRowAt
in interface Worksheet
rowIndex
- The index (row number) of the row.
null
.public boolean hasRowAt(int rowIndex)
Worksheet
hasRowAt
in interface Worksheet
public Column addColumn()
Worksheet
maxColumnIndex
of the underlying Table + 1.
addColumn
in interface Worksheet
public Column addColumnAt(int index)
Worksheet
addColumnAt
in interface Worksheet
index
- The index (column number) of the column.
public Column addColumnAt(String label)
Worksheet
addColumnAt
in interface Worksheet
label
- a string ("A" through "IV" inclusive)
corresponding to the column index
public Column addColumn(Column column)
Worksheet
maxColumnIndex
of the underlying Table + 1.
addColumn
in interface Worksheet
column
- The column to be added.
public Column addColumnAt(int index, Column column)
Worksheet
addColumnAt
in interface Worksheet
index
- The index (column number) of the column.column
- The column to be added.
public Column addColumnAt(String label, Column column)
Worksheet
addColumnAt
in interface Worksheet
label
- a string ("A" through "IV" inclusive)
corresponding to the column indexcolumn
- The column to be added.
public Column removeColumnAt(int columnIndex)
Worksheet
removeColumnAt
in interface Worksheet
columnIndex
- The index (column number) of the column.
null
if the index was not occupied
by a column.public Column removeColumnAt(String label)
Worksheet
removeColumnAt
in interface Worksheet
label
- a string ("A" through "IV" inclusive)
corresponding to the column index
null
if the index was not occupied
by a column.public Collection<Column> getColumns()
Worksheet
getColumns
in interface Worksheet
public Column getColumnAt(int columnIndex)
Worksheet
getColumnAt
in interface Worksheet
columnIndex
- The index (column number) of the column.
null
.public Column getColumnAt(String label)
Worksheet
getColumnAt
in interface Worksheet
label
- a string ("A" through "IV" inclusive)
corresponding to the column index
null
.public boolean hasColumnAt(int columnIndex)
Worksheet
hasColumnAt
in interface Worksheet
public boolean hasColumnAt(String label)
Worksheet
hasColumnAt
in interface Worksheet
label
- a string ("A" through "IV" inclusive)
corresponding to the column indexpublic String getTagName()
XLElement
getTagName
in interface XLElement
public String getNameSpace()
XLElement
getNameSpace
in interface XLElement
public String getPrefix()
XLElement
getPrefix
in interface XLElement
public void setAutoFilter(AutoFilter af)
Worksheet
setAutoFilter
in interface Worksheet
af
- the AutoFilter to be set on this worksheet.public void setAutoFilter(String rcString)
Worksheet
The String rcString
should include all of the
columns that are to be equiped with a drop-down button at their column-
headings, and should either include just the row of the column-headings
or the entire range on which the AutoFilter must be set.
Here are some examples:
Given a table of 3 columns and 11 rows. The column-headings are at row 10.
The table-data expands to row 21.
R10C1:R10C3
- the AutoFilter includes the entire range
(R10C1:R21C3) and will dynamically expand if more rows of data are
added below.
R10C1:R21C3
- the AutoFilter includes the entire range
(R10C1:R21C3) and will dynamically expand if more rows of data are
added below.
R10C1:R10C2
- the AutoFilter includes the entire range
(R10C1:R21C3) and will dynamically expand if more rows of data are
added below, however, only the first two column-headings have drop
-down buttons.
R12C1:R12C3
- drop-down buttons manifest at row 12;
this is probably not what you wanted.
setAutoFilter
in interface Worksheet
rcString
- A String of R1C1 reference style.public boolean hasAutoFilter()
Worksheet
setAutoFilter
-method
was applied on this worksheet.
hasAutoFilter
in interface Worksheet
setAutoFilter
-method
was applied on this worksheet, false otherwise.public void removeAutoFilter()
Worksheet
removeAutoFilter
in interface Worksheet
public Element assemble(Element parent, GIO gio)
XLElement
Element
. Attaches the new element to it's
parent-element if needed.
assemble
in interface XLElement
parent
- the parent-element to which the new formed element
will be appendedgio
- a global information object
public void setAttributes(Attributes attrs)
AbstractXLElement
setAttributes
in interface XLElement
setAttributes
in class AbstractXLElement
attrs
- the attributes found on the element
|
xelem.3.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |