public final class ExcelFillPattern extends Object
Following code demonstrates fill formatting:
// 'Fill' formatting group
sheet.getCell("B24").setValue("FillPattern.setPattern(...)");
sheet.getCell("C24").getStyle().getFillPattern().setPattern(FillPatternStyle.THIN_HORIZONTAL_CROSSHATCH, SpreadsheetColor.fromName(ColorName.GREEN), SpreadsheetColor.fromName(ColorName.YELLOW));
sheet.getCell("B25").setValue("FillPattern.setGradient(...)");
sheet.getCell("C25").getStyle().getFillPattern().setGradient(GradientShadingStyle.HORIZONTAL_HIGH, SpreadsheetColor.fromName(ColorName.GREEN), SpreadsheetColor.fromName(ColorName.YELLOW));
Modifier and Type | Method and Description |
---|---|
SpreadsheetColor |
getGradientColor1()
Gets the first color of the gradient fill effect.
|
SpreadsheetColor |
getGradientColor2()
Gets the second color of the gradient fill effect.
|
GradientShadingStyle |
getGradientStyle()
Gets the shading style of the gradient fill effect, if there is any gradient fill effect applied.
|
SpreadsheetColor |
getPatternBackgroundColor()
Gets the pattern fill background color.
|
SpreadsheetColor |
getPatternForegroundColor()
Gets the pattern fill foreground color.
|
FillPatternStyle |
getPatternStyle()
Gets the pattern fill style.
|
void |
setGradient(GradientShadingStyle gradientStyle,
SpreadsheetColor gradientColor1,
SpreadsheetColor gradientColor2)
Sets the gradient fill effect.
|
void |
setGradientColor1(SpreadsheetColor value)
Sets the first color of the gradient fill effect.
|
void |
setGradientColor2(SpreadsheetColor value)
Sets the second color of the gradient fill effect.
|
void |
setGradientStyle(GradientShadingStyle shadingStyle)
Sets the shading style of the gradient fill effect, if there is any gradient fill effect applied.
|
void |
setPattern(FillPatternStyle patternStyle,
SpreadsheetColor foregroundColor,
SpreadsheetColor backgroundColor)
Sets the pattern fill.
|
void |
setPatternBackgroundColor(SpreadsheetColor color)
Sets the pattern fill background color.
|
void |
setPatternForegroundColor(SpreadsheetColor color)
Sets the pattern fill foreground color.
|
void |
setPatternStyle(FillPatternStyle patternStyle)
Sets the pattern fill style.
|
void |
setSolid(SpreadsheetColor fillColor)
Sets the solid pattern fill with the specified fill color.
|
String |
toString()
Returns a
String that represents this ExcelFillPattern instance. |
public SpreadsheetColor getGradientColor1()
Gets the first color of the gradient fill effect.
Default value is color created from name ColorName.EMPTY
.
Gradient fill is currently supported only in XLSX.
public SpreadsheetColor getGradientColor2()
Gets the second color of the gradient fill effect.
Default value is color created from name ColorName.EMPTY
.
Gradient fill is currently supported only in XLSX.
public GradientShadingStyle getGradientStyle()
Gets the shading style of the gradient fill effect, if there is any gradient fill effect applied.
Default value is GradientShadingStyle.NONE
.
Gradient fill is currently supported only in XLSX.
public SpreadsheetColor getPatternBackgroundColor()
Gets the pattern fill background color.
Default value is color created from name ColorName.EMPTY
.
public SpreadsheetColor getPatternForegroundColor()
Gets the pattern fill foreground color.
Default value is color created from name ColorName.EMPTY
.
public FillPatternStyle getPatternStyle()
Gets the pattern fill style.
Default value is FillPatternStyle.NONE
.
Currently supported only in XLSX and XLS. For all other formats it defaults to either FillPatternStyle.NONE
or FillPatternStyle.SOLID
.
public void setGradient(GradientShadingStyle gradientStyle, SpreadsheetColor gradientColor1, SpreadsheetColor gradientColor2)
gradientStyle
- The shading style of the gradient fill effect.gradientColor1
- The first color of the gradient fill effect.gradientColor2
- The second color of the gradient fill effect.public void setGradientColor1(SpreadsheetColor value)
Sets the first color of the gradient fill effect.
Default value is color created from name ColorName.EMPTY
.
Gradient fill is currently supported only in XLSX.
value
- The first color of the gradient fill effect.public void setGradientColor2(SpreadsheetColor value)
Sets the second color of the gradient fill effect.
Default value is color created from name ColorName.EMPTY
.
Gradient fill is currently supported only in XLSX.
value
- The second color of the gradient fill effect.public void setGradientStyle(GradientShadingStyle shadingStyle)
Sets the shading style of the gradient fill effect, if there is any gradient fill effect applied.
Default value is GradientShadingStyle.NONE
.
Gradient fill is currently supported only in XLSX.
shadingStyle
- The shading style of the gradient fill effect, if there is any gradient fill effect applied.IllegalArgumentException
- Value cannot be set to GradientShadingStyle.COMPLEX
.public void setPattern(FillPatternStyle patternStyle, SpreadsheetColor foregroundColor, SpreadsheetColor backgroundColor)
patternStyle
- The pattern style.foregroundColor
- Foreground color of the pattern fill.backgroundColor
- Background color of the pattern fill.public void setPatternBackgroundColor(SpreadsheetColor color)
Sets the pattern fill background color.
Default value is color created from name ColorName.EMPTY
.
color
- The pattern fill background color.public void setPatternForegroundColor(SpreadsheetColor color)
Sets the pattern fill foreground color.
Default value is color created from name ColorName.EMPTY
.
color
- The pattern fill foreground color.public void setPatternStyle(FillPatternStyle patternStyle)
Sets the pattern fill style.
Default value is FillPatternStyle.NONE
.
Currently supported only in XLSX and XLS. For all other formats it defaults to either FillPatternStyle.NONE
or FillPatternStyle.SOLID
.
If set value is not FillPatternStyle.NONE
, then setPatternForegroundColor(com.gembox.spreadsheet.SpreadsheetColor)
and/or setPatternBackgroundColor(com.gembox.spreadsheet.SpreadsheetColor)
should also be set.
patternStyle
- The pattern fill style.public void setSolid(SpreadsheetColor fillColor)
Sets the solid pattern fill with the specified fill color.
Sets setPatternStyle(com.gembox.spreadsheet.FillPatternStyle)
to FillPatternStyle.SOLID
and setPatternForegroundColor(com.gembox.spreadsheet.SpreadsheetColor)
to fillColor
.
fillColor
- Foreground color of the solid pattern fill.public String toString()
String
that represents this ExcelFillPattern
instance.
This method should be used primarily for debugging purposes and should be considered volatile (format of its return value might change in future versions).
toString
in class Object
String
that represents this ExcelFillPattern
instance.© GemBox d.o.o. — All rights reserved.