Aspose::Cells::Drawing::Area class
Contents
[
Hide
]Area class
Encapsulates the object that represents an area format.
class Area
Methods
Method | Description |
---|---|
Area(Area_Impl* impl) | Constructs from an implementation object. |
Area(const Area& src) | Copy constructor. |
GetBackgroundColor() | Gets or sets the background Color of the Area. |
GetFillFormat() | Represents a FillFormat object that contains fill formatting properties for the specified chart or shape. |
GetForegroundColor() | Gets or sets the foreground Color. |
GetFormatting() | Represents the formatting of the area. |
GetInvertIfNegative() | If the property is true and the value of chart point is a negative number, the foreground color and background color will be exchanged. |
GetTransparency() | Returns or sets the degree of transparency of the area as a value from 0.0 (opaque) through 1.0 (clear). |
IsNull() const | Checks whether the implementation object is nullptr. |
explicit operator bool() const | operator bool() |
operator=(const Area& src) | operator= |
SetBackgroundColor(const Aspose::Cells::Color& value) | Gets or sets the background Color of the Area. |
SetForegroundColor(const Aspose::Cells::Color& value) | Gets or sets the foreground Color. |
SetFormatting(FormattingType value) | Represents the formatting of the area. |
SetInvertIfNegative(bool value) | If the property is true and the value of chart point is a negative number, the foreground color and background color will be exchanged. |
SetTransparency(double value) | Returns or sets the degree of transparency of the area as a value from 0.0 (opaque) through 1.0 (clear). |
~Area() | Destructor. |
Fields
Field | Description |
---|---|
_impl | The implementation object. |
Examples
Aspose::Cells::Startup();
//Instantiating a Workbook object
Workbook workbook;
//Adding a new worksheet to the Workbook 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 "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 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 "B3"
chart.GetNSeries().Add(u"A1:B3", true);
//Setting the foreground color of the plot area
chart.GetPlotArea().GetArea().SetForegroundColor(Color{ 0xff, 0, 0, 0xff });//Blue
//Setting the foreground color of the chart area
chart.GetChartArea().GetArea().SetForegroundColor(Color{ 0xff, 0xff, 0xff, 0 });//Yellow
//Setting the foreground color of the 1st NSeries area
chart.GetNSeries().Get(0).GetArea().SetForegroundColor(Color{ 0xff, 0xff, 0, 0 });//Red
//Setting the foreground color of the area of the 1st NSeries point
chart.GetNSeries().Get(0).GetPoints().Get(0).GetArea().SetForegroundColor(Color{ 0xff, 0, 0xff, 0xff });//Cyan
//Saving the Excel file
workbook.Save(u"book1.xls");
Aspose::Cells::Cleanup();
See Also
- Namespace Aspose::Cells::Drawing
- Library Aspose.Cells for C++