BorderCollection
Inheritance: java.lang.Object
public class BorderCollection
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!");
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("book1.xls");
Methods
Method | Description |
---|---|
equals(Object arg0) | |
getByBorderType(int borderType) | Gets the Border element at the specified index. |
getClass() | |
getDiagonalColor() | Gets the Color of Diagonal lines. |
getDiagonalStyle() | Gets the style of Diagonal lines. |
hashCode() | |
notify() | |
notifyAll() | |
setColor(Color color) | Sets the Color of all borders in the collection. |
setDiagonalColor(Color value) | Sets the Color of Diagonal lines. |
setDiagonalStyle(int value) | Sets the style of Diagonal lines. |
setStyle(int style) | Sets the style of all borders of the collection. |
toString() | |
wait() | |
wait(long arg0) | |
wait(long arg0, int arg1) |
equals(Object arg0)
public boolean equals(Object arg0)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | java.lang.Object |
Returns: boolean
getByBorderType(int borderType)
public Border getByBorderType(int borderType)
Gets the Border element at the specified index.
Parameters:
Parameter | Type | Description |
---|---|---|
borderType | int | BorderType. The border to be retrieved. |
Returns: Border - The element at the specified index.
getClass()
public final native Class<?> getClass()
Returns: java.lang.Class
getDiagonalColor()
public Color getDiagonalColor()
Gets the Color of Diagonal lines.
Returns: Color
getDiagonalStyle()
public int getDiagonalStyle()
Gets the style of Diagonal lines.
See CellBorderType.
Returns: int
hashCode()
public native int hashCode()
Returns: int
notify()
public final native void notify()
notifyAll()
public final native void notifyAll()
setColor(Color color)
public void setColor(Color color)
Sets the Color of all borders in the collection.
Parameters:
Parameter | Type | Description |
---|---|---|
color | Color | Borders’ Color. |
setDiagonalColor(Color value)
public void setDiagonalColor(Color value)
Sets the Color of Diagonal lines.
Parameters:
Parameter | Type | Description |
---|---|---|
value | Color |
setDiagonalStyle(int value)
public void setDiagonalStyle(int value)
Sets the style of Diagonal lines.
See CellBorderType.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setStyle(int style)
public void setStyle(int style)
Sets the style of all borders of the collection.
Parameters:
Parameter | Type | Description |
---|---|---|
style | int | CellBorderType. Borders’ style |
toString()
public String toString()
Returns: java.lang.String
wait()
public final void wait()
wait(long arg0)
public final native void wait(long arg0)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | long |
wait(long arg0, int arg1)
public final void wait(long arg0, int arg1)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | long | |
arg1 | int |