Skip to content

Commit dc6a013

Browse files
authored
Merge pull request #130 from jeremysalmon/main
Doc Update : OpenSpout Doc Link from 3.x to 4.x and How to make border
2 parents d5dad05 + fbc84e5 commit dc6a013

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,19 +394,30 @@ Jane,Doe
394394

395395
#### Adding layout
396396

397-
Under the hood this package uses the [openspout/openspout](https://github.com/openspout/openspout) package. That package contains a `StyleBuilder` that you can use to format rows. Styles can only be used on excel documents.
397+
Under the hood this package uses the [openspout/openspout](https://github.com/openspout/openspout) package. That package contains a `Style` builder that you can use to format rows. Styles can only be used on excel documents.
398398

399399
```php
400400
use OpenSpout\Common\Entity\Style\Color;
401401
use OpenSpout\Common\Entity\Style\CellAlignment;
402402
use OpenSpout\Common\Entity\Style\Style;
403-
403+
use OpenSpout\Common\Entity\Style\Border;
404+
use OpenSpout\Common\Entity\Style\BorderPart;
405+
406+
/* Create a border around a cell */
407+
$border = new Border(
408+
new BorderPart(Border::BOTTOM, Color::LIGHT_BLUE, Border::WIDTH_THIN, Border::STYLE_SOLID),
409+
new BorderPart(Border::LEFT, Color::LIGHT_BLUE, Border::WIDTH_THIN, Border::STYLE_SOLID),
410+
new BorderPart(Border::RIGHT, Color::LIGHT_BLUE, Border::WIDTH_THIN, Border::STYLE_SOLID),
411+
new BorderPart(Border::TOP, Color::LIGHT_BLUE, Border::WIDTH_THIN, Border::STYLE_SOLID)
412+
);
413+
404414
$style = (new Style())
405415
->setFontBold()
406416
->setFontSize(15)
407417
->setFontColor(Color::BLUE)
408418
->setShouldWrapText()
409-
->setBackgroundColor(Color::YELLOW);
419+
->setBackgroundColor(Color::YELLOW)
420+
->setBorder($border);
410421

411422
$writer->addRow(['values', 'of', 'the', 'row'], $style);
412423
```
@@ -416,7 +427,7 @@ To style your HeaderRow simply call the `setHeaderStyle($style)` Method.
416427
$writer->setHeaderStyle($style);
417428
```
418429

419-
For more information on styles head over to [the Spout docs](https://github.com/openspout/openspout/tree/3.x/docs).
430+
For more information on styles head over to [the Spout docs](https://github.com/openspout/openspout/tree/4.x/docs).
420431

421432
#### Creating an additional sheets
422433

0 commit comments

Comments
 (0)