aspose.cells

Class Area

Encapsulates the object that represents an area format.

Example:

//Instantiating a Workbook object
$workbook = new cells\Workbook();
//Adding a new worksheet to the Workbook object
//Obtaining the reference of the newly added worksheet by passing its sheet index
$worksheet = $workbook->getWorksheets()->get(0);
$cells = $worksheet->getCells();
//Adding a sample value to "A1" cell
$cells->get("A1")->putValue(50);
//Adding a sample value to "A2" cell
$cells->get("A2")->putValue(100);
//Adding a sample value to "A3" cell
$cells->get("A3")->putValue(150);
//Adding a sample value to "B1" cell
$cells->get("B1")->putValue(60);
//Adding a sample value to "B2" cell
$cells->get("B2")->putValue(32);
//Adding a sample value to "B3" cell
$cells->get("B3")->putValue(50);
//Adding a chart to the worksheet
$chartIndex = $worksheet->getCharts()->add(cells\ChartType::COLUMN, 5, 0, 15, 5);
//Accessing the instance of the newly added chart
$chart = $worksheet->getCharts()->get($chartIndex);
//Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B3"
$chart->getNSeries()->add("A1:B3", true);
//Setting the foreground color of the plot area
$chart->getPlotArea()->getArea()->setForegroundColor(cells\Color::getBlue());
//Setting the foreground color of the chart area
$chart->getChartArea()->getArea()->setForegroundColor(cells\Color::getYellow());
//Setting the foreground color of the 1st NSeries area
$chart->getNSeries()->get(0)->getArea()->setForegroundColor(cells\Color::getRed());
//Setting the foreground color of the area of the 1st NSeries point
$chart->getNSeries()->get(0)->getPoints()->get(0)->getArea()->setForegroundColor(cells\Color::getCyan());

Property Getters/Setters Summary
functiongetBackgroundColor()
function
           Gets or sets the background com.aspose.cells.Color of the Area.
functiongetFillFormat()
Represents a FillFormat object that contains fill formatting properties for the specified chart or shape.
functiongetForegroundColor()
function
           Gets or sets the foreground com.aspose.cells.Color.
functiongetFormatting()
function
           Represents the formatting of the area. The value of the property is FormattingType integer constant.
functiongetInvertIfNegative()
function
           If the property is true and the value of chart point is a negative number, the foreground color and background color will be exchanged.
functiongetTransparency()
function
           Returns or sets the degree of transparency of the area as a value from 0.0 (opaque) through 1.0 (clear).
 

    • Property Getters/Setters Detail

      • getBackgroundColor/setBackgroundColor : Color 

        function getBackgroundColor() / function setBackgroundColor(value)
        
        Gets or sets the background com.aspose.cells.Color of the Area.
      • getForegroundColor/setForegroundColor : Color 

        function getForegroundColor() / function setForegroundColor(value)
        
        Gets or sets the foreground com.aspose.cells.Color.
      • getFormatting/setFormatting : Number 

        function getFormatting() / function setFormatting(value)
        
        Represents the formatting of the area. The value of the property is FormattingType integer constant.
      • getInvertIfNegative/setInvertIfNegative : boolean 

        function getInvertIfNegative() / function setInvertIfNegative(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.

        Example:

        //Instantiating a Workbook object
        $workbook = new cells\Workbook();
        $worksheet = $workbook->getWorksheets()->get(0);
        $cells = $worksheet->getCells();
        $cells->get("A1")->putValue(50);
        $cells->get("A2")->putValue(-100);
        $cells->get("A3")->putValue(150);
        //Adding a chart to the worksheet
        $chartIndex = $worksheet->getCharts()->add(cells\ChartType::COLUMN, 5, 0, 15, 5);
        //Accessing the instance of the newly added chart
        $chart = $worksheet->getCharts()->get($chartIndex);
        //Adding NSeries (chart data source) to the chart ranging from "A1" cell to "A3"
        $chart->getNSeries()->add("A1:A3", true);
        $chart->getNSeries()->get(0)->getArea()->setInvertIfNegative(true);
        //Setting the foreground color of the 1st NSeries area
        $chart->getNSeries()->get(0)->getArea()->setForegroundColor(cells\Color::getRed());
        //Setting the background color of the 1st NSeries area->
        //The displayed area color of second chart point will be the background color->
        $chart->getNSeries()->get(0)->getArea()->setBackgroundColor(cells\Color::getYellow());
      • getFillFormat : FillFormat 

        function getFillFormat()
        
        Represents a FillFormat object that contains fill formatting properties for the specified chart or shape.
      • getTransparency/setTransparency : Number 

        function getTransparency() / function setTransparency(value)
        
        Returns or sets the degree of transparency of the area as a value from 0.0 (opaque) through 1.0 (clear).