public class Style
Example:
//First method
Style style1 = excel.getWorksheets().get(0).getCells().get("A1").getStyle();
style1.getFont().setName("Times New Roman");
style1.getFont().setColor(Color.getBlue());
excel.getWorksheets().get(0).getCells().get("A1").setStyle(style1);
Constructor Summary |
---|
Property Getters/Setters Summary | ||
---|---|---|
int | getBackgroundArgbColor() | |
void | setBackgroundArgbColor(intvalue) | |
Gets and sets the background color with a 32-bit ARGB value. | ||
com.aspose.cells.Color | getBackgroundColor() | |
void | setBackgroundColor(com.aspose.cells.Colorvalue) | |
Gets or sets a style's background color. | ||
ThemeColor | getBackgroundThemeColor() | |
void | ||
Gets and sets the background theme color. | ||
BorderCollection | getBorders() | |
Gets the |
||
java.lang.String | getCultureCustom() | |
void | setCultureCustom(java.lang.Stringvalue) | |
Gets and sets the culture-dependent pattern string for number format. If no number format has been set for this object, null will be returned. If number format is builtin, the pattern string corresponding to the builtin number will be returned. | ||
java.lang.String | getCustom() | |
void | setCustom(java.lang.Stringvalue) | |
Represents the custom number format string of this style object. If the custom number format is not set(For example, the number format is builtin), "" will be returned. | ||
Font | getFont() | |
Gets a |
||
int | getForegroundArgbColor() | |
void | setForegroundArgbColor(intvalue) | |
Gets and sets the foreground color with a 32-bit ARGB value. | ||
com.aspose.cells.Color | getForegroundColor() | |
void | setForegroundColor(com.aspose.cells.Colorvalue) | |
Gets or sets a style's foreground color. | ||
ThemeColor | getForegroundThemeColor() | |
void | ||
Gets and sets the foreground theme color. | ||
int | getHorizontalAlignment() | |
void | setHorizontalAlignment(intvalue) | |
Gets or sets the horizontal alignment type of the text in a cell. The value of the property is TextAlignmentType integer constant. | ||
int | getIndentLevel() | |
void | setIndentLevel(intvalue) | |
Represents the m_IndentLevel level for the cell or range. Can only be an integer from 0 to 250. | ||
java.lang.String | getInvariantCustom() | |
Gets the culture-independent pattern string for number format.
If no number format has been set for this object, null will be returned.
If number format is builtin, the pattern string corresponding to the builtin number will be returned.
|
||
boolean | isDateTime() | |
Indicates whether the number format is a date format.
|
||
boolean | isFormulaHidden() | |
void | setFormulaHidden(booleanvalue) | |
Represents if the formula will be hidden when the worksheet is protected. | ||
boolean | isGradient() | |
void | setGradient(booleanvalue) | |
Indicates whether the cell shading is a gradient pattern. | ||
boolean | isJustifyDistributed() | |
void | setJustifyDistributed(booleanvalue) | |
Indicates if the cells justified or distributed alignment should be used on the last line of text. | ||
boolean | isLocked() | |
void | setLocked(booleanvalue) | |
Gets or sets a value indicating whether a cell can be modified or not. | ||
boolean | isPercent() | |
Indicates whether the number format is a percent format.
|
||
boolean | isTextWrapped() | |
void | setTextWrapped(booleanvalue) | |
Gets or sets a value indicating whether the text within a cell is wrapped. | ||
java.lang.String | getName() | |
void | setName(java.lang.Stringvalue) | |
Gets or sets the name of the style. | ||
int | getNumber() | |
void | setNumber(intvalue) | |
Gets or sets the display format of numbers and dates. The formatting patterns are different for different regions. | ||
Style | getParentStyle() | |
Gets the parent style of this style.
|
||
int | getPattern() | |
void | setPattern(intvalue) | |
Gets or sets the cell background pattern type. The value of the property is BackgroundType integer constant. | ||
boolean | getQuotePrefix() | |
void | setQuotePrefix(booleanvalue) | |
Indicates whether the cell's value starts with single quote mark. | ||
int | getRotation() | |
void | setRotation(intvalue) | |
Represents text rotation angle. | ||
int | getRotationAngle() | |
void | setRotationAngle(intvalue) | |
Represents text rotation angle. | ||
boolean | getShrinkToFit() | |
void | setShrinkToFit(booleanvalue) | |
Represents if text automatically shrinks to fit in the available column width. | ||
int | getTextDirection() | |
void | setTextDirection(intvalue) | |
Represents text reading order. The value of the property is TextDirectionType integer constant. | ||
int | getVerticalAlignment() | |
void | setVerticalAlignment(intvalue) | |
Gets or sets the vertical alignment type of the text in a cell. The value of the property is TextAlignmentType integer constant. |
Method Summary | ||
---|---|---|
void | copy(Style style) | |
Copies data from another style object
|
||
boolean | equals(java.lang.Object obj) | |
Determines whether two Style instances are equal.
|
||
int | hashCode() | |
Serves as a hash function for a Style object.
|
||
boolean | isModified(int modifyFlag) | |
Checks whether the specified properties of the style have been modified.
Used for style of ConditionalFormattings to check whether the specified properties of this style should be used when applying the ConditionalFormattings on a cell.
|
||
boolean | setBorder(int borderEdge, int borderStyle, com.aspose.cells.Color borderColor) | |
Sets the border of the style.
|
||
void | setCustom(java.lang.String custom, boolean builtinPreference) | |
Sets the Custom number format string of a cell.
|
||
void | setPatternColor(int pattern, com.aspose.cells.Color color1, com.aspose.cells.Color color2) | |
Sets the background color.
|
||
void | setTwoColorGradient(com.aspose.cells.Color color1, com.aspose.cells.Color color2, int gradientStyleType, int variant) | |
Sets the specified fill to a two-color gradient.
|
||
void | update() | |
Apply the named style to the styles of the cells which use this named style.
It works like clicking the "ok" button after you finished modifying the style.
Only applies for named style.
|
public Style()
public ThemeColor getBackgroundThemeColor() / public void setBackgroundThemeColor(ThemeColor value)
public ThemeColor getForegroundThemeColor() / public void setForegroundThemeColor(ThemeColor value)
public java.lang.String getName() / public void setName(java.lang.String value)
public int getPattern() / public void setPattern(int value)
public BorderCollection getBorders()
public com.aspose.cells.Color getBackgroundColor() / public void setBackgroundColor(com.aspose.cells.Color value)
public int getBackgroundArgbColor() / public void setBackgroundArgbColor(int value)
public com.aspose.cells.Color getForegroundColor() / public void setForegroundColor(com.aspose.cells.Color value)
public int getForegroundArgbColor() / public void setForegroundArgbColor(int value)
public Style getParentStyle()
public int getIndentLevel() / public void setIndentLevel(int value)
public Font getFont()
public int getRotationAngle() / public void setRotationAngle(int value)
0: Not rotated.
255: Top to Bottom.
-90: Downward.
90: Upward.
You can set 255 or value ranged from -90 to 90.public int getRotation() / public void setRotation(int value)
0: Not rotated.
255: Top to Bottom.
-90: Downward.
90: Upward.
You can set 255 or value ranged from -90 to 90.public int getVerticalAlignment() / public void setVerticalAlignment(int value)
public int getHorizontalAlignment() / public void setHorizontalAlignment(int value)
public boolean isTextWrapped() / public void setTextWrapped(boolean value)
public int getNumber() / public void setNumber(int value)
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 | Percentage | 0% |
10 | Percentage | 0.00% |
11 | Scientific | 0.00E+00 |
12 | Fraction | # ?/? |
13 | Fraction | # ??/?? |
14 | Date | m/d/yyyy |
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 | Time | m/d/yyyy 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 | Accounting | _(* #,##0_);_(* (#,##0);_(* "-"_);_(@_) |
42 | Currency | _($* #,##0_);_($* (#,##0);_($* "-"_);_(@_) |
43 | Accounting | _(* #,##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 | @ |
public boolean isLocked() / public void setLocked(boolean value)
public java.lang.String getCustom() / public void setCustom(java.lang.String value)
public java.lang.String getCultureCustom() / public void setCultureCustom(java.lang.String value)
public java.lang.String getInvariantCustom()
public boolean isFormulaHidden() / public void setFormulaHidden(boolean value)
public boolean getShrinkToFit() / public void setShrinkToFit(boolean value)
public int getTextDirection() / public void setTextDirection(int value)
public boolean isJustifyDistributed() / public void setJustifyDistributed(boolean value)
public boolean getQuotePrefix() / public void setQuotePrefix(boolean value)
public boolean isGradient() / public void setGradient(boolean value)
public boolean isPercent()
public boolean isDateTime()
public void setTwoColorGradient(com.aspose.cells.Color color1, com.aspose.cells.Color color2, int gradientStyleType, int variant)
color1
- One gradient color.color2
- Two gradient color.gradientStyleType
- A variant
- The gradient variant. Can be a value from 1 through 4, corresponding to one of the four variants on the Gradient tab in the Fill Effects dialog box. If style is GradientStyle.FromCenter, the Variant argument can only be 1 or 2.public void setPatternColor(int pattern, com.aspose.cells.Color color1, com.aspose.cells.Color color2)
pattern
- A color1
- The forground color.color2
- The background color. Only works when pattern is not BackgroundType.None and BackgroundType.Solid.public void copy(Style style)
style
- Source Style objectpublic void update()
public boolean isModified(int modifyFlag)
modifyFlag
- A public boolean equals(java.lang.Object obj)
obj
- The Style object to compare with the current Style object. public int hashCode()
public boolean setBorder(int borderEdge, int borderStyle, com.aspose.cells.Color borderColor)
borderEdge
- A borderStyle
- A borderColor
- public void setCustom(java.lang.String custom, boolean builtinPreference)
custom
- _Custom number format string, should be InvariantCulture pattern.builtinPreference
- If given Custom number format string matches one of the built-in number formats
corresponding to current regional settings, whether set the number format as built-in instead of _Custom.