com.aspose.cells.BorderCollection.html Maven / Gradle / Ivy
BorderCollection
com.aspose.cells
Class BorderCollection
java.lang.Object
com.aspose.cells.BorderCollection
public class BorderCollection
- extends java.lang.Object
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!");
Style 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());
cell.setStyle(style);
//Saving the Excel file
workbook.save("C:\\book1.xls");
Property Getters/Setters Summary | ||
---|---|---|
com.aspose.cells.Color | getDiagonalColor() | |
void | setDiagonalColor(com.aspose.cells.Color) | |
Gets or sets the |
||
int | getDiagonalStyle() | |
void | setDiagonalStyle(int) | |
Gets or sets the style of Diagonal lines. The value of the property is CellBorderType integer constant. | ||
Border | getByBorderType(int) | |
Gets the |
Method Summary | ||
---|---|---|
void | setColor(com.aspose.cells.Color color) | |
Sets the |
||
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
- ABorderType value. The border to be retrieved.
- Returns:
- The element at the specified index.
Method Detail |
---|
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
- ACellBorderType value. Borders' style
See Also:
Aspose.Cells Documentation - the home page for the Aspose.Cells Product Documentation.
Aspose.Cells Support Forum - our preferred method of support.