Encapsulates the object that represents fill formatting for a shape.
Example:
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Adding a new worksheet to the Excel object
int sheetIndex = workbook.getWorksheets().add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.getWorksheets().get(sheetIndex);
//Adding a sample value to "A1" cell
worksheet.getCells().get("A1").putValue(50);
//Adding a sample value to "A2" cell
worksheet.getCells().get("A2").putValue(100);
//Adding a sample value to "A3" cell
worksheet.getCells().get("A3").putValue(150);
//Adding a sample value to "A4" cell
worksheet.getCells().get("A4").putValue(200);
//Adding a sample value to "B1" cell
worksheet.getCells().get("B1").putValue(60);
//Adding a sample value to "B2" cell
worksheet.getCells().get("B2").putValue(32);
//Adding a sample value to "B3" cell
worksheet.getCells().get("B3").putValue(50);
//Adding a sample value to "B4" cell
worksheet.getCells().get("B4").putValue(40);
//Adding a sample value to "C1" cell as category data
worksheet.getCells().get("C1").putValue("Q1");
//Adding a sample value to "C2" cell as category data
worksheet.getCells().get("C2").putValue("Q2");
//Adding a sample value to "C3" cell as category data
worksheet.getCells().get("C3").putValue("Y1");
//Adding a sample value to "C4" cell as category data
worksheet.getCells().get("C4").putValue("Y2");
//Adding a chart to the worksheet
int chartIndex = worksheet.getCharts().add(ChartType.COLUMN, 5, 0, 15, 5);
//Accessing the instance of the newly added chart
Chart chart = worksheet.getCharts().get(chartIndex);
//Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B4"
int seriesIndex = chart.getNSeries().add("A1:B4", true);
//Setting the data source for the category data of NSeries
chart.getNSeries().setCategoryData("C1:C4");
//Filling the area of the 2nd NSeries with a gradient
chart.getNSeries().get(seriesIndex).getArea().getFillFormat().setOneColorGradient(Color.getLime(), 1, GradientStyleType.HORIZONTAL, 1);
Sets the specified fill to a preset-color gradient.
Only applies for Excel 2007.
void
setTwoColorGradient(com.aspose.cells.Color color1, com.aspose.cells.Color color2, int style, int variant)
Sets the specified fill to a two-color gradient.
Only applies for Excel 2007.
void
setTwoColorGradient(com.aspose.cells.Color color1, double transparency1, com.aspose.cells.Color color2, double transparency2, int style, int variant)
Sets the specified fill to a two-color gradient.
Only applies for Excel 2007.
Property Getters/Setters Detail
getType/setType
public int getType() / public void setType(int value)
Gets and sets the fill type.
The value of the property is FillType integer constant.
NOTE: This member is now obsolete. Instead,
please use FillFormat.FillType property instead.
This property will be removed 12 months later since July 2016.
Aspose apologizes for any inconvenience you may have experienced.
getFillType/setFillType
public int getFillType() / public void setFillType(int value)
Gets and sets fill type
The value of the property is FillType integer constant.
getTransparency/setTransparency
public double getTransparency() / public void setTransparency(double value)
Returns or sets the degree of transparency of the area as a value from 0.0 (opaque) through 1.0 (clear).
getSetType/setSetType
public int getSetType() / public void setSetType(int value)
Gets the fill format set type.
The value of the property is FormatSetType integer constant.
NOTE: This member is now obsolete. Instead,
please use FillFormat.FillType property instead.
This property will be removed 12 months later since July 2016.
Aspose apologizes for any inconvenience you may have experienced.
Returns the gradient color type for the specified fill.
The value of the property is GradientColorType integer constant.
getGradientStyle
public int getGradientStyle()
Returns the gradient style for the specified fill.
The value of the property is GradientStyleType integer constant.
getGradientColor1
public com.aspose.cells.Color getGradientColor1()
Returns the gradient color 1 for the specified fill.
getGradientColor2
public com.aspose.cells.Color getGradientColor2()
Returns the gradient color 2 for the specified fill.
Only when the gradient color type is GradientColorType.TwoColors, this property is meaningful.
getGradientDegree
public double getGradientDegree()
Returns the gradient degree for the specified fill.
Only applies for Excel 2007.
Can only be a value from 0.0 (dark) through 1.0 (light).
getGradientVariant
public int getGradientVariant()
Returns the gradient variant for the specified fill.
Only applies for Excel 2007.
Can only 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.
getPresetColor
public int getPresetColor()
Returns the gradient preset color for the specified fill.
The value of the property is GradientPresetType integer constant.
getTexture/setTexture
public int getTexture() / public void setTexture(int value)
Represents the texture type for the specified fill.
The value of the property is TextureType integer constant.
getPattern/setPattern
public int getPattern() / public void setPattern(int value)
Represents an area's display pattern.
The value of the property is FillPattern integer constant.
getPictureFormatType/setPictureFormatType
public int getPictureFormatType() / public void setPictureFormatType(int value)
Gets and sets the picture format type.
The value of the property is FillPictureType integer constant.
getScale/setScale
public double getScale() / public void setScale(double value)
Gets and sets the picture format scale.
getImageData/setImageData
public byte[] getImageData() / public void setImageData(byte[] value)
Gets and sets the picture image data.
If the fill format is not custom texture format, returns null.
Method Detail
setOneColorGradient
public void setOneColorGradient(com.aspose.cells.Color color, double degree, int style, int variant)
Sets the specified fill to a one-color gradient.
Only applies for Excel 2007.
Parameters:
color - One gradient color.
degree - The gradient degree. Can be a value from 0.0 (dark) through 1.0 (light).
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.
setTwoColorGradient
public void setTwoColorGradient(com.aspose.cells.Color color1, com.aspose.cells.Color color2, int style, int variant)
Sets the specified fill to a two-color gradient.
Only applies for Excel 2007.
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.
setTwoColorGradient
public void setTwoColorGradient(com.aspose.cells.Color color1, double transparency1, com.aspose.cells.Color color2, double transparency2, int style, int variant)
Sets the specified fill to a two-color gradient.
Only applies for Excel 2007.
Parameters:
color1 - One gradient color.
transparency1 - The degree of transparency of the color1 as a value from 0.0 (opaque) through 1.0 (clear).
color2 - Two gradient color.
transparency2 - The degree of transparency of the color2 as a value from 0.0 (opaque) through 1.0 (clear).
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.
setPresetColorGradient
public void setPresetColorGradient(int presetColor, int style, int variant)
Sets the specified fill to a preset-color gradient.
Only applies for Excel 2007.
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.