Example:
$workbook = new cells\Workbook(); //Obtaining the reference of the newly added worksheet by passing its sheet index $worksheet = $workbook->getWorksheets()->get(0); //Accessing the "A1" cell from the worksheet $cell = $worksheet->getCells()->get("B2"); //Adding some value to the "A1" cell $cell->putValue("Visit Aspose!"); //Get style object from cell $style = $cell->getStyle(); //Setting the line style of the top border $style->getBorders()->getByBorderType(cells\BorderType::TOP_BORDER)->setLineStyle(cells\CellBorderType::THICK); //Setting the color of the top border $style->getBorders()->getByBorderType(cells\BorderType::TOP_BORDER)->setColor(cells\Color::getBlack()); //Setting the line style of the bottom border $style->getBorders()->getByBorderType(cells\BorderType::BOTTOM_BORDER)->setLineStyle(cells\CellBorderType::THICK); //Setting the color of the bottom border $style->getBorders()->getByBorderType(cells\BorderType::BOTTOM_BORDER)->setColor(cells\Color::getBlack()); //Setting the line style of the left border $style->getBorders()->getByBorderType(cells\BorderType::LEFT_BORDER)->setLineStyle(cells\CellBorderType::THICK); //Setting the color of the left border $style->getBorders()->getByBorderType(cells\BorderType::LEFT_BORDER)->setColor(cells\Color::getBlack()); //Setting the line style of the right border $style->getBorders()->getByBorderType(cells\BorderType::RIGHT_BORDER)->setLineStyle(cells\CellBorderType::THICK); //Setting the color of the right border $style->getBorders()->getByBorderType(cells\BorderType::RIGHT_BORDER)->setColor(cells\Color::getBlack()); //Set style object to cell $cell->setStyle($style);
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