asposecells.api
Class BorderCollection

Encapsulates a collection of Border objects.

Example:

# Instantiating a Workbook object
workbook = 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("A1")
# 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(BorderType.TOP_BORDER).setLineStyle(CellBorderType.THICK)
# Setting the color of the top border
style.getBorders().getByBorderType(BorderType.TOP_BORDER).setColor(Color.getBlack())
# Setting the line style of the bottom border
style.getBorders().getByBorderType(BorderType.BOTTOM_BORDER).setLineStyle(CellBorderType.THICK)
# Setting the color of the bottom border
style.getBorders().getByBorderType(BorderType.BOTTOM_BORDER).setColor(Color.getBlack())
# Setting the line style of the left border
style.getBorders().getByBorderType(BorderType.LEFT_BORDER).setLineStyle(CellBorderType.THICK)
# Setting the color of the left border
style.getBorders().getByBorderType(BorderType.LEFT_BORDER).setColor(Color.getBlack())
# Setting the line style of the right border
style.getBorders().getByBorderType(BorderType.RIGHT_BORDER).setLineStyle(CellBorderType.THICK)
# Setting the color of the right border
style.getBorders().getByBorderType(BorderType.RIGHT_BORDER).setColor(Color.getBlack())
# Set style object to cell
cell.setStyle(style)

# Saving the Excel file
workbook.save("Book1.xls")

Property Getters/Setters Summary
methodgetDiagonalColor()
methodsetDiagonalColor(value)
           Gets or sets the com.aspose.cells.Color of Diagonal lines.
methodgetDiagonalStyle()
methodsetDiagonalStyle(value)
           Gets or sets the style of Diagonal lines. The value of the property is CellBorderType integer constant.
methodgetByBorderType(borderType)
           Gets the Border element at the specified index.
 
Method Summary
methodsetColor(color)
           Sets the com.aspose.cells.Color of all borders in the collection.
methodsetStyle(style)
           Sets the style of all borders of the collection.
 

Property Getters/Setters Detail

getDiagonalColor/setDiagonalColor : Color 

Color getDiagonalColor() / setDiagonalColor(value)
Gets or sets the com.aspose.cells.Color of Diagonal lines.

getDiagonalStyle/setDiagonalStyle : int 

int getDiagonalStyle() / setDiagonalStyle(value)
Gets or sets the style of Diagonal lines. The value of the property is CellBorderType integer constant.

getByBorderType : Border 

Border 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

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

setStyle

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

See Also:
          Aspose.Cells Documentation - the home page for the Aspose.Cellss Product Documentation.
          Aspose.Cells Support Forum - our preferred method of support.