public class ThemeColor
Example:
//Instantiating a Workbook object
Workbook workbook = new Workbook();
Cells cells = workbook.getWorksheets().get(0).getCells();
cells.get("A1").putValue("Hello World");
Style style = cells.get("A1").getStyle();
//Set ThemeColorType.Text2 color type with 40% lighten as the font color.
style.getFont().setThemeColor(new ThemeColor(ThemeColorType.TEXT_2, 0.4));
style.setPattern(BackgroundType.SOLID);
//Set ThemeColorType.Background2 color type with 75% darken as the foreground color
style.setForegroundThemeColor(new ThemeColor(ThemeColorType.BACKGROUND_2, -0.75));
cells.get("A1").setStyle(style);
//Saving the Excel file
workbook.save("C:\\book1.xlsx");
Constructor Summary |
---|
ThemeColor(inttype, doubletint)
|
Property Getters/Setters Summary | ||
---|---|---|
int | getColorType() | |
void | setColorType(intvalue) | |
Gets and sets the theme type. The value of the property is ThemeColorType integer constant. | ||
double | getTint() | |
void | setTint(doublevalue) | |
Gets and sets the tint value. |
public ThemeColor(int type, double tint)
type
- A tint
- The tint value.public int getColorType() / public void setColorType(int value)
public double getTint() / public void setTint(double value)