|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--com.jrefinery.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 java.util.ArrayList |
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 |
hideColHeader
Hide the column header (true/false). |
protected boolean |
hideGrid
Hide the grid (true/false). |
protected boolean |
hideRowHeader
Hide the row header (true/false). |
protected boolean |
hideZero
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 |
maxCol
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 |
print_info
Print setup. |
protected RowAttributesManager |
rowAttributesManager
Row attributes (height, margins, hidden etc). |
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(StyleColor color,
int column,
int row)
Applies the background color to the specified cell. |
void |
applyBackgroundColor(StyleColor color,
int startColumn,
int startRow,
int endColumn,
int endRow)
Applies the background color to the specified region. |
void |
applyBorder(StyleBorder border,
int column,
int row)
Applies the foreground color to the specified cell. |
void |
applyBorder(StyleBorder border,
int startColumn,
int startRow,
int endColumn,
int endRow)
Applies the border to the specified region. |
void |
applyFont(StyleFont font,
int column,
int row)
Applies the font to the specified cell. |
void |
applyFont(StyleFont font,
int startColumn,
int startRow,
int endColumn,
int endRow)
Applies the font to the specified region. |
void |
applyForegroundColor(StyleColor color,
int column,
int row)
Applies the foreground color to the specified cell. |
void |
applyForegroundColor(StyleColor color,
int startColumn,
int startRow,
int endColumn,
int endRow)
Applies the foreground color to the specified region. |
void |
applyHorizontalAlignment(int align,
int column,
int row)
Applies a horizontal alignment setting to a cell. |
void |
applyHorizontalAlignment(int align,
int startColumn,
int startRow,
int endColumn,
int endRow)
Applies a horizontal alignment setting to a range of cells. |
void |
applyOutline(int column,
int row)
Applies a thin outline border to a cell. |
void |
applyOutline(int borderStyle,
int column,
int row)
Applies a border to a cell. |
void |
applyOutline(int startColumn,
int startRow,
int endColumn,
int endRow)
Applies a thin outline border to a range of cells. |
void |
applyOutline(int lineStyle,
int startColumn,
int startRow,
int endColumn,
int endRow)
Applies a border around a range of cells. |
void |
applyPatternColor(StyleColor color,
int column,
int row)
Applies the pattern color to the specified cell. |
void |
applyPatternColor(StyleColor color,
int startColumn,
int startRow,
int endColumn,
int endRow)
Applies the pattern color to the specified region. |
void |
applyVerticalAlignment(int align,
int column,
int row)
Applies a vertical alignment setting to a cell. |
void |
applyVerticalAlignment(int align,
int startColumn,
int startRow,
int endColumn,
int endRow)
Applies a vertical alignment setting to a range of cells. |
void |
applyWrapText(boolean wrapText,
int column,
int row)
Applies the "wrap-text" setting to the specified cell. |
void |
applyWrapText(boolean wrapText,
int startColumn,
int startRow,
int endColumn,
int endRow)
Applies the "wrap-text" setting to the specified region. |
static java.lang.String |
cellReference(int column,
int row)
Returns a cell reference using letters for the column (e.g. |
ColumnAttributesManager |
getColumnAttributesManager()
Returns a reference to the object managing the column attributes. |
java.lang.String |
getName()
Returns the name of the worksheet. |
NamesManager |
getNamesManager()
Returns a reference to the names manager. |
RowAttributesManager |
getRowAttributesManager()
Returns a reference to the object managing the row attributes. |
double |
getZoom()
Returns the zoom factor. |
void |
putComment(java.lang.String comment,
int column,
int row)
Puts a comment in a cell, overwriting any existing cell comments. |
void |
putDate(com.jrefinery.workbook.SerialDate date,
int column,
int row)
Puts a date in a cell, overwriting any existing cell contents. |
void |
putFormula(java.lang.String formula,
int column,
int row)
Puts a formula in a cell, overwriting any existing cell contents. |
void |
putLabel(java.lang.String label,
int column,
int row)
Puts a label in a cell, overwriting any existing cell contents. |
void |
putValue(double value,
int column,
int row)
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 startColumn,
int startRow,
int endColumn,
int endRow)
Set the style for the specified range of the worksheet. |
void |
setZoom(double percent)
Sets the zoom factor. |
void |
writeWorksheet(java.io.PrintStream out,
java.lang.String indent)
Writes a worksheet element in the Gnumeric format to a stream. |
| 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 hideZero
protected boolean hideGrid
protected boolean hideColHeader
protected boolean hideRowHeader
protected int maxCol
protected int maxRow
protected double zoom
protected NamesManager namesManager
protected PrintInformation print_info
protected Styles styles
protected ColumnAttributesManager columnAttributesManager
protected RowAttributesManager rowAttributesManager
protected Selections selections
protected Cells cells
protected java.util.ArrayList 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 new name for the worksheet.public double getZoom()
public void setZoom(double percent)
percent - The new zoom factor (should be in the range 0.05 to 5.00).public NamesManager getNamesManager()
public ColumnAttributesManager getColumnAttributesManager()
public RowAttributesManager getRowAttributesManager()
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 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 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 startColumn,
int startRow,
int endColumn,
int endRow)
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.startColumn - The start column for the style region.startRow - The start row for the style region.endColumn - The end column for the style region.endRow - The end row for the style region.
public void putDate(com.jrefinery.workbook.SerialDate date,
int column,
int row)
date - The date.column - The column (0 <= column < Worksheet.MAX_COLUMNS).row - The row (0 <= row < Worksheet.MAX_ROWS).
public void putFormula(java.lang.String formula,
int column,
int row)
formula - The formula (not validated).column - The column (0 <= column < Worksheet.MAX_COLUMNS).row - The row (0 <= row < Worksheet.MAX_ROWS).
public void putLabel(java.lang.String label,
int column,
int row)
label - The label.column - The column (0 <= column < Worksheet.MAX_COLUMNS).row - The row (0 <= row < Worksheet.MAX_ROWS).
public void putValue(double value,
int column,
int row)
value - The value.column - The column (0 <= column < Worksheet.MAX_COLUMNS).row - The row (0 <= row < Worksheet.MAX_ROWS).
public void putComment(java.lang.String comment,
int column,
int row)
comment - The comment.column - The column (0 <= column < Worksheet.MAX_COLUMNS).row - The row (0 <= row < Worksheet.MAX_ROWS).
public void applyFont(StyleFont font,
int column,
int row)
This may involve restructuring the style regions.
font - The font.column - The column (0 <= column < Worksheet.MAX_COLUMNS).row - The row (0 <= row < Worksheet.MAX_ROWS).
public void applyFont(StyleFont font,
int startColumn,
int startRow,
int endColumn,
int endRow)
This may involve restructuring the style regions.
font - The font.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 applyHorizontalAlignment(int align,
int column,
int row)
This may involve restructuring the style regions.
align - The new alignment.column - The column (0 <= column < Worksheet.MAX_COLUMNS).row - The row (0 <= row < Worksheet.MAX_ROWS).
public void applyHorizontalAlignment(int align,
int startColumn,
int startRow,
int endColumn,
int endRow)
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 applyVerticalAlignment(int align,
int column,
int row)
This may involve restructuring the style regions.
align - The new alignment.column - The column (0 <= column < Worksheet.MAX_COLUMNS).row - The row (0 <= row < Worksheet.MAX_ROWS).
public void applyVerticalAlignment(int align,
int startColumn,
int startRow,
int endColumn,
int endRow)
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 column,
int row)
This may involve restructuring the style regions.
wrapText - The new value of the wrap-text flag.column - The column (0 <= column < Worksheet.MAX_COLUMNS).row - The row (0 <= row < Worksheet.MAX_ROWS).
public void applyWrapText(boolean wrapText,
int startColumn,
int startRow,
int endColumn,
int endRow)
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(StyleBorder border,
int column,
int row)
This may involve restructuring the style regions.
border - The border.column - The column (0 <= column < Worksheet.MAX_COLUMNS).row - The row (0 <= row < Worksheet.MAX_ROWS).
public void applyBorder(StyleBorder border,
int startColumn,
int startRow,
int endColumn,
int endRow)
This may involve restructuring the style regions.
border - The border.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 applyOutline(int column,
int row)
column - The column (0 <= column < Worksheet.MAX_COLUMNS).row - The row (0 <= row < Worksheet.MAX_ROWS).
public void applyOutline(int startColumn,
int startRow,
int endColumn,
int endRow)
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 applyOutline(int borderStyle,
int column,
int row)
public void applyOutline(int lineStyle,
int startColumn,
int startRow,
int endColumn,
int endRow)
lineStyle - The style of line for the border.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 applyForegroundColor(StyleColor color,
int column,
int row)
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 applyForegroundColor(StyleColor color,
int startColumn,
int startRow,
int endColumn,
int endRow)
This may involve restructuring the style regions.
color - The color.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 applyBackgroundColor(StyleColor color,
int column,
int row)
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 applyBackgroundColor(StyleColor color,
int startColumn,
int startRow,
int endColumn,
int endRow)
This may involve restructuring the style regions.
color - The color.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 applyPatternColor(StyleColor color,
int column,
int row)
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(StyleColor color,
int startColumn,
int startRow,
int endColumn,
int endRow)
This may involve restructuring the style regions.
color - The color.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 static java.lang.String cellReference(int column,
int row)
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).
column - The cell's column (0 <= column < Worksheet.MAX_COLUMNS).row - The cell's row (0 <= row < Worksheet.MAX_ROWS).
public void writeWorksheet(java.io.PrintStream out,
java.lang.String indent)
out - The output stream.indent - The indentation.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||