Aspose::Cells::Drawing::FillFormat class

FillFormat class

Encapsulates the object that represents fill formatting for a shape.

class FillFormat

Methods

MethodDescription
FillFormat(FillFormat_Impl* impl)Constructs from an implementation object.
FillFormat(const FillFormat& src)Copy constructor.
GetFillType()Gets and sets fill type.
GetGradientColor1()Returns the gradient color 1 for the specified fill.
GetGradientColor2()Returns the gradient color 2 for the specified fill.
GetGradientColorType()Returns the gradient color type for the specified fill.
GetGradientDegree()Returns the gradient degree for the specified fill. Only applies for Excel 2007.
GetGradientFill()Gets GradientFill object.
GetGradientStyle()Returns the gradient style for the specified fill.
GetGradientVariant()Returns the gradient variant for the specified fill. Only applies for Excel 2007.
GetHashCode()Gets the hash code.
GetImageData()Gets and sets the picture image data.
GetPattern()Represents an area’s display pattern.
GetPatternFill()Gets PatternFill object.
GetPictureFormatType()Gets and sets the picture format type.
GetPresetColor()Returns the gradient preset color for the specified fill.
GetScale()Gets and sets the picture format scale.
GetSolidFill()Gets SolidFill object.
GetTexture()Represents the texture type for the specified fill.
GetTextureFill()Gets TextureFill object.
GetTransparency()Returns or sets the degree of transparency of the area as a value from 0.0 (opaque) through 1.0 (clear).
IsNull() constChecks whether the implementation object is nullptr.
explicit operator bool() constoperator bool()
operator=(const FillFormat& src)operator=
SetFillType(FillType value)Gets and sets fill type.
SetImageData(const Vector <uint8_t>& value)Gets and sets the picture image data.
SetOneColorGradient(const Aspose::Cells::Color& color, double degree, GradientStyleType style, int32_t variant)Sets the specified fill to a one-color gradient. Only applies for Excel 2007.
SetPattern(FillPattern value)Represents an area’s display pattern.
SetPictureFormatType(FillPictureType value)Gets and sets the picture format type.
SetPresetColorGradient(GradientPresetType presetColor, GradientStyleType style, int32_t variant)Sets the specified fill to a preset-color gradient. Only applies for Excel 2007.
SetScale(double value)Gets and sets the picture format scale.
SetTexture(TextureType value)Represents the texture type for the specified fill.
SetTransparency(double value)Returns or sets the degree of transparency of the area as a value from 0.0 (opaque) through 1.0 (clear).
SetTwoColorGradient(const Aspose::Cells::Color& color1, const Aspose::Cells::Color& color2, GradientStyleType style, int32_t variant)Sets the specified fill to a two-color gradient. Only applies for Excel 2007.
SetTwoColorGradient(const Aspose::Cells::Color& color1, double transparency1, const Aspose::Cells::Color& color2, double transparency2, GradientStyleType style, int32_t variant)Sets the specified fill to a two-color gradient. Only applies for Excel 2007.
~FillFormat()Destructor.

Fields

FieldDescription
_implThe implementation object.

Examples

Aspose::Cells::Startup();
//Instantiating a Workbook object
Workbook 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(u"A1").PutValue(50);
//Adding a sample value to "A2" cell
worksheet.GetCells().Get(u"A2").PutValue(100);
//Adding a sample value to "A3" cell
worksheet.GetCells().Get(u"A3").PutValue(150);
//Adding a sample value to "A4" cell
worksheet.GetCells().Get(u"A4").PutValue(200);
//Adding a sample value to "B1" cell
worksheet.GetCells().Get(u"B1").PutValue(60);
//Adding a sample value to "B2" cell
worksheet.GetCells().Get(u"B2").PutValue(32);
//Adding a sample value to "B3" cell
worksheet.GetCells().Get(u"B3").PutValue(50);
//Adding a sample value to "B4" cell
worksheet.GetCells().Get(u"B4").PutValue(40);
//Adding a sample value to "C1" cell as category data
worksheet.GetCells().Get(u"C1").PutValue(u"Q1");
//Adding a sample value to "C2" cell as category data
worksheet.GetCells().Get(u"C2").PutValue(u"Q2");
//Adding a sample value to "C3" cell as category data
worksheet.GetCells().Get(u"C3").PutValue(u"Y1");
//Adding a sample value to "C4" cell as category data
worksheet.GetCells().Get(u"C4").PutValue(u"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(u"A1:B4", true);
//Setting the data source for the category data of NSeries
chart.GetNSeries().SetCategoryData(u"C1:C4");
//Filling the area of the 2nd NSeries with a gradient
chart.GetNSeries().Get(seriesIndex).GetArea().GetFillFormat().SetOneColorGradient(Color{ 0xff,0,0xff,0 }, 1, GradientStyleType::Horizontal, 1);

Aspose::Cells::Cleanup();

See Also