|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jfree.workbook.Worksheet
Represents one worksheet within a workbook.
Field Summary | |
protected Cells |
cells
The cells in the worksheet. |
protected ColumnAttributesManager |
columnAttributesManager
Column attributes (width, margins, hidden etc). |
protected boolean |
columnHeaderVisible
A flag indicating whether or not the column header is visible. |
protected java.util.List |
comments
Comments for cells in the worksheet. |
static double |
DEFAULT_COLUMN_WIDTH
The default width for columns. |
static double |
DEFAULT_ROW_HEIGHT
The default height for rows. |
protected boolean |
displayFormulae
Display formulae rather than calculated values (true/false). |
protected boolean |
gridVisible
A flag indicating whether or not the grid is visible. |
protected boolean |
hideZeros
Hide zeros (true/false). |
static int |
MAX_COLUMNS
The maximum number of columns in a worksheet. |
static int |
MAX_ROWS
The maximum number of rows in a worksheet. |
protected int |
maxColumn
The index of the right-most column used in the worksheet. |
protected int |
maxRow
The index of the bottom-most row used in the worksheet. |
protected java.lang.String |
name
The name of the worksheet. |
protected NamesManager |
namesManager
Manager for names defined in the worksheet. |
protected PrintInformation |
printInfo
Print setup. |
protected RowAttributesManager |
rowAttributesManager
Row attributes (height, margins, hidden etc). |
protected boolean |
rowHeaderVisible
A flag indicating whether or not the row header is visible. |
protected Selections |
selections
Ranges that are selected. |
protected Solver |
solver
Settings for the solver utility. |
protected Styles |
styles
Styles that apply to ranges within the worksheet. |
protected double |
zoom
The current zoom factor (in the range 0.05 to 5.00, that is 5% to 500%). |
Constructor Summary | |
Worksheet(java.lang.String name)
Standard constructor: creates a named empty worksheet. |
Method Summary | |
void |
addCell(Cell cell)
Sets the value at the specified cell. |
void |
addName(java.lang.String name,
java.lang.String value)
Adds a name to the worksheet. |
void |
addStyleRegion(StyleRegion styleRegion)
Adds the specified style region. |
void |
applyBackgroundColor(Color color,
int row,
int column)
Applies the background color to the specified cell. |
void |
applyBackgroundColor(Color color,
int startRow,
int startColumn,
int endRow,
int endColumn)
Applies the background color to the specified region. |
void |
applyBorder(Border border,
int row,
int column)
Applies the foreground color to the specified cell. |
void |
applyBorder(Border border,
int startRow,
int startColumn,
int endRow,
int endColumn)
Applies the border to the specified region. |
void |
applyFont(FontStyle font,
int row,
int column)
Applies the font to the specified cell. |
void |
applyFont(FontStyle font,
int startRow,
int startColumn,
int endRow,
int endColumn)
Applies the font to the specified region. |
void |
applyForegroundColor(Color color,
int row,
int column)
Applies the foreground color to the specified cell. |
void |
applyForegroundColor(Color color,
int startRow,
int startColumn,
int endRow,
int endColumn)
Applies the foreground color to the specified region. |
void |
applyHorizontalAlignment(int align,
int row,
int column)
Applies a horizontal alignment setting to a cell. |
void |
applyHorizontalAlignment(int align,
int startRow,
int startColumn,
int endRow,
int endColumn)
Applies a horizontal alignment setting to a range of cells. |
void |
applyOutline(int row,
int column)
Applies a thin outline border to a cell. |
void |
applyOutline(int borderStyle,
int row,
int column)
Applies a border to a cell. |
void |
applyOutline(int startRow,
int startColumn,
int endRow,
int endColumn)
Applies a thin outline border to a range of cells. |
void |
applyOutline(int lineStyle,
int startRow,
int startColumn,
int endRow,
int endColumn)
Applies a border around a range of cells. |
void |
applyPatternColor(Color color,
int row,
int column)
Applies the pattern color to the specified cell. |
void |
applyPatternColor(Color color,
int startRow,
int startColumn,
int endRow,
int endColumn)
Applies the pattern color to the specified region. |
void |
applyVerticalAlignment(int align,
int row,
int column)
Applies a vertical alignment setting to a cell. |
void |
applyVerticalAlignment(int align,
int startRow,
int startColumn,
int endRow,
int endColumn)
Applies a vertical alignment setting to a range of cells. |
void |
applyWrapText(boolean wrapText,
int row,
int column)
Applies the "wrap-text" setting to the specified cell. |
void |
applyWrapText(boolean wrapText,
int startRow,
int startColumn,
int endRow,
int endColumn)
Applies the "wrap-text" setting to the specified region. |
static java.lang.String |
cellReference(int row,
int column)
Returns a cell reference using letters for the column (e.g. |
Cells |
getCells()
Returns the cells for the worksheet. |
ColumnAttributesManager |
getColumnAttributesManager()
Returns a reference to the object managing the column attributes. |
java.util.List |
getComments()
Returns the comments for the worksheet. |
boolean |
getDisplayFormulae()
Returns true if formulae rather than values are being displayed in the worksheet. |
boolean |
getHideZeros()
Returns a flag indicating whether or not zero values are displayed. |
int |
getMaxColumn()
Returns the index of the rightmost column in the sheet. |
int |
getMaxRow()
Returns the index of the bottommost row in the sheet. |
java.lang.String |
getName()
Returns the name of the worksheet. |
NamesManager |
getNamesManager()
Returns a reference to the names manager. |
PrintInformation |
getPrintInformation()
Returns the print information for the sheet. |
RowAttributesManager |
getRowAttributesManager()
Returns a reference to the object managing the row attributes. |
Selections |
getSelections()
Returns the selections for the sheet. |
Solver |
getSolver()
Returns the solver for the worksheet. |
Styles |
getStyles()
Returns the styles information for the sheet. |
double |
getZoom()
Returns the zoom factor. |
boolean |
isColumnHeaderVisible()
Returns a flag indicating whether or not the column header is visible. |
boolean |
isGridVisible()
Returns a flag indicating whether or not the grid is visible. |
boolean |
isRowHeaderVisible()
Returns a flag indicating whether or not the row header is visible. |
void |
putComment(int row,
int column,
java.lang.String comment)
Puts a comment in a cell, overwriting any existing cell comments. |
void |
putDate(int row,
int column,
SerialDate date)
Puts a date in a cell, overwriting any existing cell contents. |
void |
putFormula(int row,
int column,
java.lang.String formula)
Puts a formula in a cell, overwriting any existing cell contents. |
void |
putLabel(int row,
int column,
java.lang.String label)
Puts a label in a cell, overwriting any existing cell contents. |
void |
putValue(int row,
int column,
double value)
Puts a value in a cell, overwriting any existing cell contents. |
void |
setColumnWidth(int column,
double width)
Sets the width of one column. |
void |
setColumnWidth(int startColumn,
int endColumn,
double width)
Sets the width of a range of columns. |
void |
setName(java.lang.String name)
Sets the name of the worksheet. |
void |
setRowHeight(int row,
double height)
Sets the height of one row. |
void |
setRowHeight(int startRow,
int endRow,
double height)
Sets the height of a range of rows. |
void |
setStyle(Style style,
int startRow,
int startColumn,
int endRow,
int endColumn)
Set the style for the specified range of the worksheet. |
void |
setZoom(double percent)
Sets the zoom factor. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MAX_COLUMNS
public static final int MAX_ROWS
public static final double DEFAULT_COLUMN_WIDTH
public static final double DEFAULT_ROW_HEIGHT
protected java.lang.String name
protected boolean displayFormulae
protected boolean hideZeros
protected boolean gridVisible
protected boolean columnHeaderVisible
protected boolean rowHeaderVisible
protected int maxColumn
protected int maxRow
protected double zoom
protected NamesManager namesManager
protected PrintInformation printInfo
protected Styles styles
protected ColumnAttributesManager columnAttributesManager
protected RowAttributesManager rowAttributesManager
protected Selections selections
protected Cells cells
protected java.util.List comments
protected Solver solver
Constructor Detail |
public Worksheet(java.lang.String name)
name
- the name of the worksheet.Method Detail |
public java.lang.String getName()
public void setName(java.lang.String name)
name
- the name.public int getMaxColumn()
public int getMaxRow()
public double getZoom()
public void setZoom(double percent)
percent
- the new zoom factor (should be in the range 0.05 to 5.00).public boolean getDisplayFormulae()
public boolean getHideZeros()
public boolean isGridVisible()
public boolean isColumnHeaderVisible()
public boolean isRowHeaderVisible()
public NamesManager getNamesManager()
public PrintInformation getPrintInformation()
public Styles getStyles()
public Selections getSelections()
public Cells getCells()
public Solver getSolver()
public java.util.List getComments()
public ColumnAttributesManager getColumnAttributesManager()
public RowAttributesManager getRowAttributesManager()
public void setRowHeight(int row, double height)
row
- the row (0 <= startRow < Worksheets.MAX_ROWS).height
- the new height.public void setRowHeight(int startRow, int endRow, double height)
startRow
- the row (0 <= startRow < Worksheets.MAX_ROWS).endRow
- the row (startRow <= endRow < Worksheets.MAX_ROWS).height
- the new height (height >= 0.0).public void setColumnWidth(int column, double width)
column
- the column (0 to Worksheets.MAX_COLUMNS-1).width
- the new width.public void setColumnWidth(int startColumn, int endColumn, double width)
startColumn
- the start column (0 <= startColumn < Worksheets.MAX_COLUMNS).endColumn
- the end column (startColumn <= endColumn < Worksheets.MAX_COLUMNS).width
- the new width.public void addCell(Cell cell)
cell
- the new cell.public void addName(java.lang.String name, java.lang.String value)
name
- the new name.value
- the value that the name resolves to.public void addStyleRegion(StyleRegion styleRegion)
Note: this method will not adjust row sizes for the particular style that is being applied. Not sure what is the best way to achieve this...
styleRegion
- the style region being added.public void setStyle(Style style, int startRow, int startColumn, int endRow, int endColumn)
Note: this method will not adjust row sizes for the particular style that is being applied. Not sure what is the best way to achieve this...
style
- the style to be applied.startRow
- the start row for the style region.startColumn
- the start column for the style region.endRow
- the end row for the style region.endColumn
- the end column for the style region.public void putDate(int row, int column, SerialDate date)
row
- the row (0 <= row < Worksheet.MAX_ROWS).column
- the column (0 <= column < Worksheet.MAX_COLUMNS).date
- the date.public void putFormula(int row, int column, java.lang.String formula)
formula
- the formula (not validated).column
- the column (0 <= column < Worksheet.MAX_COLUMNS).row
- the row (0 <= row < Worksheet.MAX_ROWS).public void putLabel(int row, int column, java.lang.String label)
label
- the label.column
- the column (0 <= column < Worksheet.MAX_COLUMNS).row
- the row (0 <= row < Worksheet.MAX_ROWS).public void putValue(int row, int column, double value)
value
- the value.column
- the column (0 <= column < Worksheet.MAX_COLUMNS).row
- the row (0 <= row < Worksheet.MAX_ROWS).public void putComment(int row, int column, java.lang.String comment)
row
- the row (0 <= row < Worksheet.MAX_ROWS).column
- the column (0 <= column < Worksheet.MAX_COLUMNS).comment
- the comment.public void applyFont(FontStyle font, int row, int column)
This may involve restructuring the style regions.
font
- the font.row
- the row (0 <= row < Worksheet.MAX_ROWS).column
- the column (0 <= column < Worksheet.MAX_COLUMNS).public void applyFont(FontStyle font, int startRow, int startColumn, int endRow, int endColumn)
This may involve restructuring the style regions.
font
- the font.startRow
- the start row (0 <= startRow < Worksheet.MAX_ROWS).startColumn
- the start column (0 <= startColumn < Worksheet.MAX_COLUMNS).endRow
- the end row (0 <= endRow < Worksheet.MAX_ROWS).endColumn
- the end column (0 <= endColumn < Worksheet.MAX_COLUMNS).public void applyHorizontalAlignment(int align, int row, int column)
This may involve restructuring the style regions.
align
- the new alignment.row
- the row (0 <= row < Worksheet.MAX_ROWS).column
- the column (0 <= column < Worksheet.MAX_COLUMNS).public void applyHorizontalAlignment(int align, int startRow, int startColumn, int endRow, int endColumn)
This may involve restructuring the style regions.
align
- the new alignment.startRow
- the start row (0 <= startRow < Worksheet.MAX_ROWS).startColumn
- the start column (0 <= startColumn < Worksheet.MAX_COLUMNS).endRow
- the end row (0 <= endRow < Worksheet.MAX_ROWS).endColumn
- the end column (0 <= endColumn < Worksheet.MAX_COLUMNS).public void applyVerticalAlignment(int align, int row, int column)
This may involve restructuring the style regions.
align
- the new alignment.row
- the row (0 <= row < Worksheet.MAX_ROWS).column
- the column (0 <= column < Worksheet.MAX_COLUMNS).public void applyVerticalAlignment(int align, int startRow, int startColumn, int endRow, int endColumn)
This may involve restructuring the style regions.
align
- the new alignment.startColumn
- the start column (0 <= startColumn < Worksheet.MAX_COLUMNS).startRow
- the start row (0 <= startRow < Worksheet.MAX_ROWS).endColumn
- the end column (0 <= endColumn < Worksheet.MAX_COLUMNS).endRow
- the end row (0 <= endRow < Worksheet.MAX_ROWS).public void applyWrapText(boolean wrapText, int row, int column)
This may involve restructuring the style regions.
wrapText
- the new value of the wrap-text flag.row
- the row (0 <= row < Worksheet.MAX_ROWS).column
- the column (0 <= column < Worksheet.MAX_COLUMNS).public void applyWrapText(boolean wrapText, int startRow, int startColumn, int endRow, int endColumn)
This may involve restructuring the style regions.
wrapText
- the new value of the wrap-text flag.startColumn
- the start column (0 <= startColumn < Worksheet.MAX_COLUMNS).startRow
- the start row (0 <= startRow < Worksheet.MAX_ROWS).endColumn
- the end column (0 <= endColumn < Worksheet.MAX_COLUMNS).endRow
- the end row (0 <= endRow < Worksheet.MAX_ROWS).public void applyBorder(Border border, int row, int column)
This may involve restructuring the style regions.
border
- the border.row
- the row (0 <= row < Worksheet.MAX_ROWS).column
- the column (0 <= column < Worksheet.MAX_COLUMNS).public void applyBorder(Border border, int startRow, int startColumn, int endRow, int endColumn)
This may involve restructuring the style regions.
border
- the border.startRow
- the start row (0 <= startRow < Worksheet.MAX_ROWS).startColumn
- the start column (0 <= startColumn < Worksheet.MAX_COLUMNS).endRow
- the end row (0 <= endRow < Worksheet.MAX_ROWS).endColumn
- the end column (0 <= endColumn < Worksheet.MAX_COLUMNS).public void applyOutline(int row, int column)
row
- the row (0 <= row < Worksheet.MAX_ROWS).column
- the column (0 <= column < Worksheet.MAX_COLUMNS).public void applyOutline(int startRow, int startColumn, int endRow, int endColumn)
startRow
- the start row (0 <= startRow < Worksheet.MAX_ROWS).startColumn
- the start column (0 <= startColumn < Worksheet.MAX_COLUMNS).endRow
- the end row (0 <= endRow < Worksheet.MAX_ROWS).endColumn
- the end column (0 <= endColumn < Worksheet.MAX_COLUMNS).public void applyOutline(int borderStyle, int row, int column)
borderStyle
- the border style.row
- the row.column
- the column.public void applyOutline(int lineStyle, int startRow, int startColumn, int endRow, int endColumn)
lineStyle
- the style of line for the border.startRow
- the start row (0 <= startRow < Worksheet.MAX_ROWS).startColumn
- the start column (0 <= startColumn < Worksheet.MAX_COLUMNS).endRow
- the end row (0 <= endRow < Worksheet.MAX_ROWS).endColumn
- the end column (0 <= endColumn < Worksheet.MAX_COLUMNS).public void applyForegroundColor(Color color, int row, int column)
This may involve restructuring the style regions.
color
- the color.row
- the row (0 <= row < Worksheet.MAX_ROWS).column
- the column (0 <= column < Worksheet.MAX_COLUMNS).public void applyForegroundColor(Color color, int startRow, int startColumn, int endRow, int endColumn)
This may involve restructuring the style regions.
color
- the color.startRow
- the start row (0 <= startRow < Worksheet.MAX_ROWS).startColumn
- the start column (0 <= startColumn < Worksheet.MAX_COLUMNS).endRow
- the end row (0 <= endRow < Worksheet.MAX_ROWS).endColumn
- the end column (0 <= endColumn < Worksheet.MAX_COLUMNS).public void applyBackgroundColor(Color color, int row, int column)
This may involve restructuring the style regions.
color
- the color.row
- the row (0 <= row < Worksheet.MAX_ROWS).column
- the column (0 <= column < Worksheet.MAX_COLUMNS).public void applyBackgroundColor(Color color, int startRow, int startColumn, int endRow, int endColumn)
This may involve restructuring the style regions.
color
- the color.startRow
- the start row (0 <= startRow < Worksheet.MAX_ROWS).startColumn
- the start column (0 <= startColumn < Worksheet.MAX_COLUMNS).endRow
- the end row (0 <= endRow < Worksheet.MAX_ROWS).endColumn
- the end column (0 <= endColumn < Worksheet.MAX_COLUMNS).public void applyPatternColor(Color color, int row, int column)
This may involve restructuring the style regions.
color
- the color.column
- the column (0 <= column < Worksheet.MAX_COLUMNS).row
- the row (0 <= row < Worksheet.MAX_ROWS).public void applyPatternColor(Color color, int startRow, int startColumn, int endRow, int endColumn)
This may involve restructuring the style regions.
color
- the color.startRow
- the start row (0 <= startRow < Worksheet.MAX_ROWS).startColumn
- the start column (0 <= startColumn < Worksheet.MAX_COLUMNS).endRow
- the end row (0 <= endRow < Worksheet.MAX_ROWS).endColumn
- the end column (0 <= endColumn < Worksheet.MAX_COLUMNS).public static java.lang.String cellReference(int row, int column)
Note that internally we use zero based indices for the column and row numbers. But externally the user expects the first row to be number 1 (not 0).
row
- the cell's row (0 <= row < Worksheet.MAX_ROWS).column
- the cell's column (0 <= column < Worksheet.MAX_COLUMNS).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |