Example:
//Instantiating a Workbook object var workbook = new aspose.cells.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().getByBorderType(aspose.cells.BorderType.TOP_BORDER).setLineStyle(aspose.cells.CellBorderType.THICK); //Setting the color of the top border style.getBorders().getByBorderType(aspose.cells.BorderType.TOP_BORDER).setColor(aspose.cells.Color.getBlack()); //Setting the line style of the bottom border style.getBorders().getByBorderType(aspose.cells.BorderType.BOTTOM_BORDER).setLineStyle(aspose.cells.CellBorderType.THICK); //Setting the color of the bottom border style.getBorders().getByBorderType(aspose.cells.BorderType.BOTTOM_BORDER).setColor(aspose.cells.Color.getBlack()); //Setting the line style of the left border style.getBorders().getByBorderType(aspose.cells.BorderType.LEFT_BORDER).setLineStyle(aspose.cells.CellBorderType.THICK); //Setting the color of the left border style.getBorders().getByBorderType(aspose.cells.BorderType.LEFT_BORDER).setColor(aspose.cells.Color.getBlack()); //Setting the line style of the right border style.getBorders().getByBorderType(aspose.cells.BorderType.RIGHT_BORDER).setLineStyle(aspose.cells.CellBorderType.THICK); //Setting the color of the right border style.getBorders().getByBorderType(aspose.cells.BorderType.RIGHT_BORDER).setColor(aspose.cells.Color.getBlack()); //Set style object to cell cell.setStyle(style); //Saving the Excel file workbook.save("Book1.xls");
Property Getters/Setters Summary | ||
---|---|---|
function | getDiagonalColor() | |
function | setDiagonalColor(value) | |
Gets or sets the |
||
function | getDiagonalStyle() | |
function | setDiagonalStyle(value) | |
Gets or sets the style of Diagonal lines. The value of the property is CellBorderType integer constant. | ||
function | getByBorderType(borderType) | |
Gets the |
Method Summary | ||
---|---|---|
function | setColor(color) | |
Sets the |
||
function | setStyle(style) | |
Sets the style of all borders of the collection.
|
function getDiagonalColor() / function setDiagonalColor(value)
function getDiagonalStyle() / function setDiagonalStyle(value)
function getByBorderType(borderType)
borderType
- A function setColor(color)
color: Color
- Borders' function setStyle(style)
style: Number
- A