BorderCollection
Contents
[
Hide
]BorderCollection class
Encapsulates a collection of Border objects.
class BorderCollection;
Example
const { Workbook, BorderType, CellBorderType, Color } = require("aspose.cells.node");
//Instantiating a Workbook object
var workbook = new Workbook();
//Obtaining the reference of the newly added worksheet by passing its sheet index
var worksheet = workbook.getWorksheets().get(0);
//Accessing the "A1" cell from the worksheet
var cell = worksheet.getCells().get("A1");
//Adding some value to the "A1" cell
cell.putValue("Visit Aspose!");
//Get style object from cell
var style = cell.getStyle();
//Setting the line style of the top border
style.getBorders().get(BorderType.TopBorder).setLineStyle(CellBorderType.Thick);
//Setting the color of the top border
style.getBorders().get(BorderType.TopBorder).setColor(Color.Black);
//Setting the line style of the bottom border
style.getBorders().get(BorderType.BottomBorder).setLineStyle(CellBorderType.Thick);
//Setting the color of the bottom border
style.getBorders().get(BorderType.BottomBorder).setColor(Color.Black);
//Setting the line style of the left border
style.getBorders().get(BorderType.LeftBorder).setLineStyle(CellBorderType.Thick);
//Setting the color of the left border
style.getBorders().get(BorderType.LeftBorder).setColor(Color.Black);
//Setting the line style of the right border
style.getBorders().get(BorderType.RightBorder).setLineStyle(CellBorderType.Thick);
//Setting the color of the right border
style.getBorders().get(BorderType.RightBorder).setColor(Color.Black);
//Set style object to cell
cell.setStyle(style);
//Saving the Excel file
workbook.save("output/BorderCollection.xls");
Methods
Method | Description |
---|---|
get(BorderType) | Gets the Border element at the specified index. |
getDiagonalColor() | Gets or sets the Color of Diagonal lines. |
setDiagonalColor(Color) | Gets or sets the Color of Diagonal lines. |
getDiagonalStyle() | Gets or sets the style of Diagonal lines. |
setDiagonalStyle(CellBorderType) | Gets or sets the style of Diagonal lines. |
setColor(Color) | Sets the Color of all borders in the collection. |
setStyle(CellBorderType) | Sets the style of all borders of the collection. |
isNull() | Checks whether the implementation object is null. |
get(BorderType)
Gets the Border element at the specified index.
get(borderType: BorderType) : Border;
Parameters:
Parameter | Type | Description |
---|---|---|
borderType | BorderType | The border to be retrieved. |
Returns
The element at the specified index.
getDiagonalColor()
Gets or sets the Color of Diagonal lines.
getDiagonalColor() : Color;
Returns
setDiagonalColor(Color)
Gets or sets the Color of Diagonal lines.
setDiagonalColor(value: Color) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | Color | The value to set. |
getDiagonalStyle()
Gets or sets the style of Diagonal lines.
getDiagonalStyle() : CellBorderType;
Returns
setDiagonalStyle(CellBorderType)
Gets or sets the style of Diagonal lines.
setDiagonalStyle(value: CellBorderType) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | CellBorderType | The value to set. |
setColor(Color)
Sets the Color of all borders in the collection.
setColor(color: Color) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
color | Color | Borders’ Color. |
setStyle(CellBorderType)
Sets the style of all borders of the collection.
setStyle(style: CellBorderType) : void;
Parameters:
Parameter | Type | Description |
---|---|---|
style | CellBorderType | Borders’ style |
isNull()
Checks whether the implementation object is null.
isNull() : boolean;