aspose.cells

Class BorderCollection

Encapsulates a collection of Border objects.

Example:

$workbook = new cells\Workbook();
//Obtaining the reference of the newly added worksheet by passing its sheet index
$worksheet = $workbook->getWorksheets()->get(0);
//Accessing the "A1" cell from the worksheet
$cell = $worksheet->getCells()->get("B2");
//Adding some value to the "A1" cell
$cell->putValue("Visit Aspose!");
//Get style object from cell
$style = $cell->getStyle();
//Setting the line style of the top border
$style->getBorders()->getByBorderType(cells\BorderType::TOP_BORDER)->setLineStyle(cells\CellBorderType::THICK);
//Setting the color of the top border
$style->getBorders()->getByBorderType(cells\BorderType::TOP_BORDER)->setColor(cells\Color::getBlack());
//Setting the line style of the bottom border
$style->getBorders()->getByBorderType(cells\BorderType::BOTTOM_BORDER)->setLineStyle(cells\CellBorderType::THICK);
//Setting the color of the bottom border
$style->getBorders()->getByBorderType(cells\BorderType::BOTTOM_BORDER)->setColor(cells\Color::getBlack());
//Setting the line style of the left border
$style->getBorders()->getByBorderType(cells\BorderType::LEFT_BORDER)->setLineStyle(cells\CellBorderType::THICK);
//Setting the color of the left border
$style->getBorders()->getByBorderType(cells\BorderType::LEFT_BORDER)->setColor(cells\Color::getBlack());
//Setting the line style of the right border
$style->getBorders()->getByBorderType(cells\BorderType::RIGHT_BORDER)->setLineStyle(cells\CellBorderType::THICK);
//Setting the color of the right border
$style->getBorders()->getByBorderType(cells\BorderType::RIGHT_BORDER)->setColor(cells\Color::getBlack());
//Set style object to cell
$cell->setStyle($style);

Property Getters/Setters Summary
functiongetDiagonalColor()
function
           Gets or sets the com.aspose.cells.Color of Diagonal lines.
functiongetDiagonalStyle()
function
           Gets or sets the style of Diagonal lines. The value of the property is CellBorderType integer constant.
functiongetByBorderType(borderType)
Gets the Border element at the specified index.
 
Method Summary
functionsetColor(color)
Sets the com.aspose.cells.Color of all borders in the collection.
functionsetStyle(style)
Sets the style of all borders of the collection.
 

    • Property Getters/Setters Detail

      • getDiagonalColor/setDiagonalColor : Color 

        function getDiagonalColor() / function setDiagonalColor(value)
        
        Gets or sets the com.aspose.cells.Color of Diagonal lines.
      • getDiagonalStyle/setDiagonalStyle : Number 

        function getDiagonalStyle() / function setDiagonalStyle(value)
        
        Gets or sets the style of Diagonal lines. The value of the property is CellBorderType integer constant.
      • getByBorderType : Border 

        function getByBorderType(borderType)
        
        Gets the Border element at the specified index.
        Parameters:
        borderType - A BorderType value. The border to be retrieved.
        Returns:
        The element at the specified index.
    • Method Detail

      • setColor

        function setColor(color)
        Sets the com.aspose.cells.Color of all borders in the collection.
        Parameters:
        color: Color - Borders' com.aspose.cells.Color.
      • setStyle

        function setStyle(style)
        Sets the style of all borders of the collection.
        Parameters:
        style: Number - A CellBorderType value. Borders' style