com.jniwrapper.win32.jexcel
Class Cell

java.lang.Object
  extended by com.jniwrapper.win32.jexcel.Cell
All Implemented Interfaces:
com.jniwrapper.AutoDeleteParameter

public class Cell
extends java.lang.Object

This class represents a cell of a Worksheet.


Field Summary
protected  com.jniwrapper.win32.excel.Font _font
           
protected  com.jniwrapper.win32.excel.Interior _interior
           
protected static com.jniwrapper.util.Logger _log
           
protected  com.jniwrapper.win32.excel.Range _pureRange
           
 
Method Summary
 void clear()
          Clears the content of the cell or range.
 void delete(int shift)
          Delete range from worksheet.
 boolean equals(java.lang.Object obj)
           
 java.lang.String getAddress()
          Returns the absolute address of the cell or range.
 Application getApplication()
          Returns the application object.
 Border getBorder(Border.Kind kind)
          Returns the border of interest.
 int getColumn()
          Returns the column number of the cell.
 java.lang.String getColumnName()
          Returns the column name of this range.
 double getColumnWidth()
          Returns the column width.
 java.util.Date getDate()
          If the cell contains data of a date type, the function returns a Date representation of the cell value.
 EntireRange getEntireColumn()
          Returns the range that represents an entire column.
 EntireRange getEntireRow()
          Returns the range that represents an entire row.
 Font getFont()
          Returns the text font.
 java.lang.String getFormula()
          Returns a formula that is contained in the cell or null if the cell doesn't contain a formula.
 TextAlignment getHorizontalAlignment()
          Returns the horizontal text alignment kind.
 java.awt.Color getInteriorColor()
          Returns the interior color.
 InteriorPattern getInteriorPattern()
          Returns the interior pattern kind.
 java.awt.Color getInteriorPatternColor()
          Returns the interior pattern color.
 java.lang.Boolean getLogical()
          If the cell contains a boolean data, the function returns a Boolean representation of the cell value.
 java.lang.String getName()
          Returns the name of the range.
 java.lang.Number getNumber()
          If the cell contains a numeric data, the function returns a Number representation of the cell value.
 java.lang.String getNumberFormat()
          Returns the string representation of the number format.
 com.jniwrapper.win32.automation.OleMessageLoop getOleMessageLoop()
          Returns the message loop thread for processing native peer function calls.
 Worksheet getParent()
          Returns the parent worksheet.
 com.jniwrapper.win32.excel.Range getPeer()
          Returns the appropriate native peer.
protected  com.jniwrapper.win32.excel.Range getRange()
           
 int getRow()
          Returns the row number of the cell.
 double getRowHeight()
          Returns the row height.
 java.lang.String getString()
          Returns a string representation of the cell value.
 java.lang.String getText()
          Returns text value of this range.
 TextOrientation getTextOrientation()
          Returns the text orientation kind.
 TextAlignment getVerticalAlignment()
          Returns the vertical text alignment kind.
 boolean hasArray()
          Returns true of the cell contains an array or false otherwise.
 boolean hasFormula()
          Returns true of the cell contains a formula or false otherwise.
 boolean isAutoDelete()
           
 boolean isEmpty()
          Returns true if the cell is empty.
 boolean isError()
          Returns true if the cell contains an error value.
 boolean isLogical()
          Returns true if the cell contains a number or false otherwise.
 boolean isNumber()
          Returns true if the cell contains a number or false otherwise.
 boolean isText()
          Returns true if the cell contains a text or false otherwise.
 void release()
          Releases this wrapper object.
protected  void releaseRangeResources()
           
 void setAutoDelete(boolean value)
           
 void setAutoFit()
          Sets autofit behavior for cells, columns or rows.
 void setBorder(Border.Kind kind, Border border)
          Sets up the specified kind of border.
 void setColumnWidth(double width)
          Sets up the column width.
 void setFont(Font font)
          Sets up the text font.
 void setHorizontalAlignment(TextAlignment textAlignment)
          Sets up the horizontal text alignment kind.
 void setInteriorColor(java.awt.Color color)
          Sets up the interior color.
 void setInteriorPattern(InteriorPattern pattern)
          Sets up the interior pattern kind.
 void setInteriorPatternColor(java.awt.Color color)
          Sets up the interior pattern color.
 void setName(java.lang.String rangeName)
          Sets up the range name, so that the range become named and could be accessed by the name.
 void setNumberFormat(java.lang.String numberFormat)
          Sets up the number format.
protected  void setOleMessageLoop(com.jniwrapper.win32.automation.OleMessageLoop oleMessageLoop)
           
protected  void setRange(com.jniwrapper.win32.excel.Range range)
           
 void setRowHeight(double height)
          Sets up the row height.
 void setTextOrientation(TextOrientation textOrientation)
          Sets up the text orientation kind.
 void setValue(java.util.Date value)
          Changes the cell value to the specified one.
 void setValue(double value)
          Changes the cell value to the specified one.
 void setValue(long value)
          Changes the cell value to the specified one.
 void setValue(java.lang.String value)
          Changes the cell value to the specified one.
 void setValue2(com.jniwrapper.win32.automation.types.Variant value)
          Sets cell content in the range.
 void setVerticalAlignment(TextAlignment textAlignment)
          Sets up the vertical text alignment kind.
 void setWrapText(boolean value)
          Sets wrapText for cells, columns or rows.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_log

protected static final com.jniwrapper.util.Logger _log

_pureRange

protected com.jniwrapper.win32.excel.Range _pureRange

_interior

protected com.jniwrapper.win32.excel.Interior _interior

_font

protected com.jniwrapper.win32.excel.Font _font
Method Detail

getRow

public int getRow()
Returns the row number of the cell.

Returns:
the row number of the cell.

getColumn

public int getColumn()
Returns the column number of the cell.

Returns:
the column number of the cell.

setValue

public void setValue(java.lang.String value)
Changes the cell value to the specified one.

Parameters:
value - may a text, a formula or a number represented in the string format.

setValue

public void setValue(long value)
Changes the cell value to the specified one.

Parameters:
value - is any long number.

setValue

public void setValue(double value)
Changes the cell value to the specified one.

Parameters:
value - is any double number.

setValue

public void setValue(java.util.Date value)
Changes the cell value to the specified one.

Parameters:
value - is an instance of Date class.

getFormula

public java.lang.String getFormula()
Returns a formula that is contained in the cell or null if the cell doesn't contain a formula.

Returns:
a formula that is contained in the cell or null if the cell doesn't contain a formula.

hasFormula

public boolean hasFormula()
Returns true of the cell contains a formula or false otherwise.

Returns:
true of the cell contains a formula or false otherwise.

hasArray

public boolean hasArray()
Returns true of the cell contains an array or false otherwise.

Returns:
true of the cell contains an array or false otherwise.

isError

public boolean isError()
Returns true if the cell contains an error value.

Returns:
true if the cell contains an error value.

isEmpty

public boolean isEmpty()
Returns true if the cell is empty.

Returns:
true if the cell is empty.

isText

public boolean isText()
Returns true if the cell contains a text or false otherwise.

Returns:
true if the cell contains a text or false otherwise.

isNumber

public boolean isNumber()
Returns true if the cell contains a number or false otherwise.

Returns:
true if the cell contains a number or false otherwise.

isLogical

public boolean isLogical()
Returns true if the cell contains a number or false otherwise.

Returns:
true if the cell contains a number or false otherwise.

getString

public java.lang.String getString()
Returns a string representation of the cell value.

Returns:
a string representation of the cell value.

getDate

public java.util.Date getDate()
If the cell contains data of a date type, the function returns a Date representation of the cell value. Otherwise the function returns null.

Returns:
a Date representation of the cell value.

getNumber

public java.lang.Number getNumber()
If the cell contains a numeric data, the function returns a Number representation of the cell value. Otherwise the function returns null.

Returns:
a Number representation of the cell value.

getLogical

public java.lang.Boolean getLogical()
If the cell contains a boolean data, the function returns a Boolean representation of the cell value. Otherwise the function returns null.

Returns:
a Boolean representation of the cell value.

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getColumnName

public java.lang.String getColumnName()
Returns the column name of this range.

Returns:
the column name

release

public void release()
Releases this wrapper object.


releaseRangeResources

protected void releaseRangeResources()

getAddress

public java.lang.String getAddress()
Returns the absolute address of the cell or range.

Returns:
the absolute address of the cell or range.

getFont

public Font getFont()
Returns the text font.

Returns:
the text font.

setFont

public void setFont(Font font)
Sets up the text font.

Parameters:
font - is the font to be set up.

getBorder

public Border getBorder(Border.Kind kind)
Returns the border of interest.

Parameters:
kind - specifies which fragment of border to return.
Returns:
the border of interest.
Throws:
java.lang.IllegalArgumentException - if the kind argument is null.

setBorder

public void setBorder(Border.Kind kind,
                      Border border)
Sets up the specified kind of border.

Parameters:
kind - specifies the border kind.
border - is the border to be set up.
Throws:
java.lang.IllegalArgumentException - if any parameter is null.

getVerticalAlignment

public TextAlignment getVerticalAlignment()
Returns the vertical text alignment kind. The return value may be one of the following values: TextAlignment.BOTTOM, TextAlignment.CENTER, TextAlignment.DISTRIBUTED, TextAlignment.TOP and TextAlignment.JUSTIFY.

Returns:
the vertical text alignment kind.
See Also:
TextAlignment

setVerticalAlignment

public void setVerticalAlignment(TextAlignment textAlignment)
Sets up the vertical text alignment kind. The method can take one of the following values: TextAlignment.BOTTOM, TextAlignment.CENTER, TextAlignment.DISTRIBUTED, TextAlignment.TOP and TextAlignment.JUSTIFY.

Parameters:
textAlignment - is the vertical text alignment kind to be set up.
Throws:
java.lang.IllegalArgumentException - if the target text alignment is null or cannot be applied.
See Also:
TextAlignment

getHorizontalAlignment

public TextAlignment getHorizontalAlignment()
Returns the horizontal text alignment kind. The return value may be one of the following values: TextAlignment.CENTER, TextAlignment.DISTRIBUTED, TextAlignment.FILL, TextAlignment.GENERAL, TextAlignment.JUSTIFY, TextAlignment.LEFT and TextAlignment.RIGHT.

Returns:
the horizontal text alignment kind.
See Also:
TextAlignment

setHorizontalAlignment

public void setHorizontalAlignment(TextAlignment textAlignment)
Sets up the horizontal text alignment kind. The method can take one of the following values: TextAlignment.CENTER, TextAlignment.DISTRIBUTED, TextAlignment.FILL, TextAlignment.GENERAL, TextAlignment.JUSTIFY, TextAlignment.LEFT and TextAlignment.RIGHT.

Parameters:
textAlignment - is the horizontal text alignment kind to be set up.
Throws:
java.lang.IllegalArgumentException - if the target text alignment is null or cannot be applied.
See Also:
TextAlignment

setAutoFit

public void setAutoFit()
Sets autofit behavior for cells, columns or rows.


setWrapText

public void setWrapText(boolean value)
Sets wrapText for cells, columns or rows.

Parameters:
value - specifies whether text should be wrapped or not

getEntireColumn

public EntireRange getEntireColumn()
Returns the range that represents an entire column.

Returns:
entire column

getEntireRow

public EntireRange getEntireRow()
Returns the range that represents an entire row.

Returns:
entire row

getTextOrientation

public TextOrientation getTextOrientation()
Returns the text orientation kind.

Returns:
the text orientation kind.
See Also:
TextOrientation

setTextOrientation

public void setTextOrientation(TextOrientation textOrientation)
Sets up the text orientation kind.

Parameters:
textOrientation - is the text orientation kind to be set up.
Throws:
java.lang.IllegalArgumentException - if the tanget text orientation is null
See Also:
TextOrientation

getParent

public Worksheet getParent()
Returns the parent worksheet.

Returns:
the parent worksheet.
See Also:
Worksheet

setName

public void setName(java.lang.String rangeName)
Sets up the range name, so that the range become named and could be accessed by the name.

Parameters:
rangeName - is the name to be set up.
Throws:
java.lang.IllegalArgumentException - if the target range name is null or cannot be set up.

delete

public void delete(int shift)
Delete range from worksheet.

Parameters:
shift - - XlDeleteShiftDirection constant which specifies shifting direction.

getName

public java.lang.String getName()
Returns the name of the range. If the name is not present the return value is null.

Returns:
the name of the range.

getColumnWidth

public double getColumnWidth()
Returns the column width.

Returns:
the column width.

setColumnWidth

public void setColumnWidth(double width)
Sets up the column width.

Parameters:
width - is the column width to be set up.
Throws:
java.lang.IllegalArgumentException - if the specified width is negative or cannot be set up.

getRowHeight

public double getRowHeight()
Returns the row height.

Returns:
the row height.

setRowHeight

public void setRowHeight(double height)
Sets up the row height.

Parameters:
height - is the row height to be set up.
Throws:
java.lang.IllegalArgumentException - if the specified height is negative or cannot be set up.

setValue2

public void setValue2(com.jniwrapper.win32.automation.types.Variant value)
Sets cell content in the range. If provided value is a simple type, it is replicated across all cells. In array case, each cell gets corresponding value from the array. The method is named according to used Excel interface.

Parameters:
value - - simple value or SimpleArray wrapped into Variant

getNumberFormat

public java.lang.String getNumberFormat()
Returns the string representation of the number format.

Returns:
the string representation of the number format.

setNumberFormat

public void setNumberFormat(java.lang.String numberFormat)
Sets up the number format.

Parameters:
numberFormat - is the string representation of the number format to be set up.
Throws:
java.lang.IllegalArgumentException - if the specified number format cannot be set up.

clear

public void clear()
Clears the content of the cell or range.


setInteriorPattern

public void setInteriorPattern(InteriorPattern pattern)
Sets up the interior pattern kind.

Parameters:
pattern - is the interior pattern kind to be set up.
See Also:
InteriorPattern

getInteriorPattern

public InteriorPattern getInteriorPattern()
Returns the interior pattern kind.

Returns:
the interior pattern kind.

setInteriorColor

public void setInteriorColor(java.awt.Color color)
Sets up the interior color.

Parameters:
color - is the color to be set up.

getInteriorColor

public java.awt.Color getInteriorColor()
Returns the interior color.

Returns:
the interior color.

setInteriorPatternColor

public void setInteriorPatternColor(java.awt.Color color)
Sets up the interior pattern color.

Parameters:
color - is the color to be set up.

getInteriorPatternColor

public java.awt.Color getInteriorPatternColor()
Returns the interior pattern color.

Returns:
the interior pattern color.

toString

public java.lang.String toString()

getPeer

public com.jniwrapper.win32.excel.Range getPeer()
Returns the appropriate native peer.

Returns:
the appropriate native peer.

getText

public java.lang.String getText()
Returns text value of this range.

Returns:
text value of this range

getRange

protected com.jniwrapper.win32.excel.Range getRange()

setRange

protected void setRange(com.jniwrapper.win32.excel.Range range)

getApplication

public Application getApplication()
Returns the application object.

Returns:
the application.

getOleMessageLoop

public com.jniwrapper.win32.automation.OleMessageLoop getOleMessageLoop()
Returns the message loop thread for processing native peer function calls.

Returns:
the message loop thread for processing native peer function calls.

setOleMessageLoop

protected void setOleMessageLoop(com.jniwrapper.win32.automation.OleMessageLoop oleMessageLoop)

setAutoDelete

public void setAutoDelete(boolean value)
Specified by:
setAutoDelete in interface com.jniwrapper.AutoDeleteParameter

isAutoDelete

public boolean isAutoDelete()
Specified by:
isAutoDelete in interface com.jniwrapper.AutoDeleteParameter