Home  Products  Purchase  Downloads  Demos  Forums  Blogs  Ticket  Wiki  API  Corporate


com.aspose.cells
Class Style

java.lang.Object
  extended by com.aspose.cells.Style
All Implemented Interfaces:
java.lang.Cloneable

public class Style
extends java.lang.Object
implements java.lang.Cloneable

Represents display styles of Workbook spreadsheets.


Method Summary
 java.lang.Object clone()
          Creates and returns a copy of this object.
 void copy(Style style)
          Copies from another style.
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one.
 Color getBorderColor(int borderType)
          Gets the color of the specified border.
 int getBorderLine(int borderType)
          Gets the border line type of the specified boder.
 Color getColor()
          Gets the cell shading color.
 java.lang.String getCustom()
          Gets the custom number format string.
 Font getFont()
          Gets the font of the style.
 short getHAlignment()
          Gets the horizontal alignment type.
 int getIndent()
          Gets the indent level.
 java.lang.String getName()
          Gets the style name.
 int getNumber()
          Gets the built-in display format of numbers and dates.
 byte getNumberFormatType()
          Gets the number format typ.
 Color getPatternColor()
          Gets the pattern color.
 short getPatternStyle()
          Gets the pattern style.
 int getRotation()
          Gets the rotation degrees.
 int getTextDirection()
          Gets the text direction type.
 int getVAlignment()
          Gets the vertical alignment type.
 boolean isCellLocked()
          Checks whether the cell is locked.
 boolean isDateStyle()
          Indicates whether this is a date time style.
 boolean isFormulaHidden()
          Checks if the formula is hidden.
 boolean isPercent()
          Indicates whether the number format is percent format.
 boolean isShrinked()
          Checks if the text is shrunk to fit.
 boolean isTextWrapped()
          Checks if the text is wrapped.
 void setBorderColor(int borderType, Color color)
          Sets the color of the specified border.
 void setBorderLine(int borderType, int borderLineType)
          Sets the border line type of the specified border.
 void setCellLocked(boolean bLocked)
          Sets whether cells to be locked or not.
 void setColor(Color color)
          Sets the cell shading color.
 void setCustom(java.lang.String custom)
          Sets the custom number format string.
 void setFont(Font font)
          Sets the font of the style.
 void setFormulaHidden(boolean bHidden)
          Sets whether formulas to be hidden or not.
 void setHAlignment(short horAlignmentType)
          Sets the horizontal text alignment type.
 void setIndent(int indent)
          Sets the indent level.
 void setName(java.lang.String name)
          Sets the name of the style.
 void setNumber(int number)
          Sets the built-in display format of numbers and dates.
Use built-in numbers for better performance.
 void setPatternColor(Color color)
          Sets the pattern color.
 void setPatternStyle(short patternType)
          Sets the pattern style.
 void setRotation(int rotation)
          Sets the rotation degrees.
 void setShrinked(boolean bShrinked)
          Sets whether the text should be shrunk to fit or not.
 void setTextDirection(int directionType)
          Sets the text direction type.
 void setTextWrapped(boolean bWrapped)
          Sets whether the text should be wrapped.
 void setVAlignment(short verAlignmentType)
          Sets the vertical text alignment type.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

copy

public void copy(Style style)
Copies from another style.

Parameters:
style - the style to copy from.
Throws:
java.lang.IllegalArgumentException - if the style is null.

clone

public java.lang.Object clone()
Creates and returns a copy of this object. NOTE:If you clone a named style, name is not cloned becaule style name must be unique. Therefore, the cloned style will not "equals to" the original style.

Overrides:
clone in class java.lang.Object
See Also:
Object.clone()

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(Object).

getFont

public Font getFont()
Gets the font of the style. The returned Font object is for read only. To apply the modification of this Font object to Style, please call setFont(Font).

Returns:
font of the style.

setFont

public void setFont(Font font)
Sets the font of the style.

Parameters:
font - font of the style. If null will set the font of this style to be inherited from its parent.

getCustom

public java.lang.String getCustom()
Gets the custom number format string.

Returns:
the custom number format string.

setCustom

public void setCustom(java.lang.String custom)
Sets the custom number format string. will be set to zero.

Parameters:
custom - the custom format string. Empty string does not make sense and will be treated as null.

getNumber

public int getNumber()
Gets the built-in display format of numbers and dates. See setNumber() for more details.

Returns:
the built-in format number.
See Also:
setNumber(int)

setNumber

public void setNumber(int number)
Sets the built-in display format of numbers and dates.
Use built-in numbers for better performance. The following table list all the valid numbers and what they mean.
Value Type Format String
0 General General
1 Decimal 0
2 Decimal 0.00
3 Decimal #,##0
4 Decimal #,##0.00
5 Currency $#,##0_);($#,##0)
6 Currency $#,##0_);[Red]($#,##0)
7 Currency $#,##0.00_);($#,##0.00)
8 Currency $#,##0.00_);[Red]($#,##0.00)
9 Percent 0%
10 Percent 0.00%
11 Scientific 0.00E+00
12 Fraction # ?/?
13 Fraction # ??/??
14 Date M/D/YY
15 Date D-MMM-YY
16 Date D-MMM
17 Date MMM-YY
18 Time h:mm AM/PM
19 Time h:mm:ss AM/PM
20 Time h:mm
21 Time h:mm:ss
22 Date/Time M/D/YY h:mm
37 Accounting _(#,##0_);(#,##0)
38 Accounting _(#,##0_);[Red](#,##0)
39 Accounting _(#,##0.00_);(#,##0.00)
40 Accounting _(#,##0.00_);[Red](#,##0.00)
41 Currency _(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)
42 Currency _($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)
43 Currency _(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)
44 Currency _($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)
45 Time mm:ss
46 Time [h]:mm:ss
47 Time mm:ss.0
48 Scientific ##0.0E+0
49 Text @

Parameters:
number - the built-in formatting number.
Throws:
java.lang.IllegalArgumentException - if number is invalid.

isCellLocked

public boolean isCellLocked()
Checks whether the cell is locked.

Returns:
true if locked.

setCellLocked

public void setCellLocked(boolean bLocked)
Sets whether cells to be locked or not.

Parameters:
bLocked - true for locked.

isFormulaHidden

public boolean isFormulaHidden()
Checks if the formula is hidden.

Returns:
true if the formula is hidden.

setFormulaHidden

public void setFormulaHidden(boolean bHidden)
Sets whether formulas to be hidden or not.

Parameters:
bHidden - true for hidden.

isTextWrapped

public boolean isTextWrapped()
Checks if the text is wrapped.

Returns:
true if wrapped.

setTextWrapped

public void setTextWrapped(boolean bWrapped)
Sets whether the text should be wrapped.

Parameters:
bWrapped - true for wrapped.

isShrinked

public boolean isShrinked()
Checks if the text is shrunk to fit.

Returns:
true if the text is shrunk to fit.

setShrinked

public void setShrinked(boolean bShrinked)
Sets whether the text should be shrunk to fit or not.

Parameters:
bShrinked -

getHAlignment

public short getHAlignment()
Gets the horizontal alignment type.

Returns:
the horizontal alignment type.
See Also:
HorizontalAlignmentType

setHAlignment

public void setHAlignment(short horAlignmentType)
Sets the horizontal text alignment type.

Parameters:
horAlignmentType - the horizontal text alignment type.
Throws:
java.lang.IllegalArgumentException - if the horizontal text alignment type is invalid.
See Also:
HorizontalAlignmentType

getVAlignment

public int getVAlignment()
Gets the vertical alignment type.

Returns:
the vertical alignment type.
See Also:
VerticalAlignmentType

setVAlignment

public void setVAlignment(short verAlignmentType)
Sets the vertical text alignment type.

Parameters:
verAlignmentType - the vertical text alignment type.
Throws:
java.lang.IllegalArgumentException - if the vertical alignment type is invalid.
See Also:
VerticalAlignmentType

getRotation

public int getRotation()
Gets the rotation degrees.

Returns:
the rotation degrees. 255 means letters are stacked top-to-bottom, but not rotated.

setRotation

public void setRotation(int rotation)
Sets the rotation degrees.

Parameters:
rotation - the rotation degrees(-90 to 90, and 255). 255 means letters are stacked top-to-bottom, but not rotated.
Throws:
java.lang.IllegalArgumentException - invalid rotation degrees.

getIndent

public int getIndent()
Gets the indent level.

Returns:
the indent level.

setIndent

public void setIndent(int indent)
Sets the indent level.

Parameters:
indent - the indent level(0-250).
Throws:
java.lang.IllegalArgumentException - if the indent level is invalid.

getTextDirection

public int getTextDirection()
Gets the text direction type.

Returns:
the text direction type.
See Also:
TextDirectionType

setTextDirection

public void setTextDirection(int directionType)
Sets the text direction type.

Parameters:
directionType - the direction type.
Throws:
java.lang.IllegalArgumentException - if the direction type is invalid.
See Also:
TextDirectionType

getName

public java.lang.String getName()
Gets the style name.

Returns:
name of the style.

setName

public void setName(java.lang.String name)
Sets the name of the style.

Parameters:
name - style name. If null will remove the specified named style. "" does not make sense and is treated as null.
Throws:
java.lang.IllegalArgumentException - if the style name is invalid.

getPatternStyle

public short getPatternStyle()
Gets the pattern style.

Returns:
the pattern style.
See Also:
PatternType

setPatternStyle

public void setPatternStyle(short patternType)
Sets the pattern style.

Parameters:
patternType - the pattern style type.
Throws:
java.lang.IllegalArgumentException - if the pattern style type is invalid.
See Also:
PatternType

getColor

public Color getColor()
Gets the cell shading color. The returned Color object is for read only. To apply the modification of this Color object to Style, please call setColor(Color).

Returns:
the cell shading color.

setColor

public void setColor(Color color)
Sets the cell shading color.

Parameters:
color - the cell shading color.

getPatternColor

public Color getPatternColor()
Gets the pattern color. The returned Color object is for read only. To apply the modification of this Color object to Style, please call setPatternColor(Color).

Returns:
the pattern color.

setPatternColor

public void setPatternColor(Color color)
Sets the pattern color. The pattern color will be set true.

Parameters:
color - the pattern color.

getBorderLine

public int getBorderLine(int borderType)
Gets the border line type of the specified boder.

Parameters:
borderType - which border to get.
Returns:
the border line type.
Throws:
java.lang.IllegalArgumentException - if the border type is invalid.
See Also:
BorderType, BorderLineType

setBorderLine

public void setBorderLine(int borderType,
                          int borderLineType)
Sets the border line type of the specified border.

Parameters:
borderType - which border to set.
borderLineType - border line type of the specified border.
Throws:
java.lang.IllegalArgumentException - if any of the parameters is invalid.
See Also:
BorderType, BorderLineType

getBorderColor

public Color getBorderColor(int borderType)
Gets the color of the specified border. The returned Color object is for read only. To apply the modification of this Color object to Style, please call setBorderColor(int, Color).

Parameters:
borderType - which border to get.
Returns:
color of the specified border.
Throws:
java.lang.IllegalArgumentException - if the border type is invalid.
See Also:
BorderType, BorderLineType

setBorderColor

public void setBorderColor(int borderType,
                           Color color)
Sets the color of the specified border.

Parameters:
borderType - which border to set.
color - color of the specified border.

isDateStyle

public boolean isDateStyle()
Indicates whether this is a date time style.

Returns:
whether this is a date time style.

getNumberFormatType

public byte getNumberFormatType()
Gets the number format typ.

Returns:
the number format type.
See Also:
NumberFormatType

isPercent

public boolean isPercent()
Indicates whether the number format is percent format.

Returns:
whether the number format is percent format.