java.lang.Object
com.aspose.cells.BorderCollection
public class BorderCollection
- extends java.lang.Object
Encapsulates a collection of Border objects.
Example:
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Adding a new worksheet to the Excel object
workbook.getWorksheets().add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.getWorksheets().get(0);
//Accessing the "A1" cell from the worksheet
Cell cell = worksheet.getCells().get("A1");
//Adding some value to the "A1" cell
cell.putValue("Visit Aspose!");
//Setting the line style of the top border
cell.getStyle().getBorders().getByBorderType(BorderType.TOP_BORDER).setLineStyle(CellBorderType.THICK);
//Setting the color of the top border
cell.getStyle().getBorders().getByBorderType(BorderType.TOP_BORDER).setColor(Color.getBlack());
//Setting the line style of the bottom border
cell.getStyle().getBorders().getByBorderType(BorderType.BOTTOM_BORDER).setLineStyle(CellBorderType.THICK);
//Setting the color of the bottom border
cell.getStyle().getBorders().getByBorderType(BorderType.BOTTOM_BORDER).setColor(Color.getBlack());
//Setting the line style of the left border
cell.getStyle().getBorders().getByBorderType(BorderType.LEFT_BORDER).setLineStyle(CellBorderType.THICK);
//Setting the color of the left border
cell.getStyle().getBorders().getByBorderType(BorderType.LEFT_BORDER).setColor(Color.getBlack());
//Setting the line style of the right border
cell.getStyle().getBorders().getByBorderType(BorderType.RIGHT_BORDER).setLineStyle(CellBorderType.THICK);
//Setting the color of the right border
cell.getStyle().getBorders().getByBorderType(BorderType.RIGHT_BORDER).setColor(Color.getBlack());
//Saving the Excel file
workbook.save("C:\\book1.xls");
Method Summary |
void | setColor(com.aspose.cells.Color color) | |
Sets the com.aspose.cells.Color of all borders in the collection.
|
void | setStyle(int style) | |
Sets the style of all borders of the collection.
|
Property Getters/Setters Detail |
getDiagonalColor/setDiagonalColor | |
public com.aspose.cells.Color getDiagonalColor() / public void setDiagonalColor(com.aspose.cells.Color value)
|
-
Gets or sets the com.aspose.cells.Color of Diagonal lines.
getDiagonalStyle/setDiagonalStyle | |
public int getDiagonalStyle() / public void setDiagonalStyle(int value)
|
-
Gets or sets the style of Diagonal lines.
The value of the property is CellBorderType integer constant.
getByBorderType | |
public Border getByBorderType(int 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.
setColor | |
public void setColor(com.aspose.cells.Color color) |
-
Sets the com.aspose.cells.Color of all borders in the collection.
- Parameters:
color
- Borders' com.aspose.cells.Color.
setStyle | |
public void setStyle(int style) |
-
Sets the style of all borders of the collection.
- Parameters:
style
- 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.