Text color

Function Prototype

1
fontColor(int $color): self
Copied!

int $color

RGB hexadecimal value or color constant

Example

1
$config = [
2
'path' => './tests'
3
];
4
5
$fileObject = new \Vtiful\Kernel\Excel($config);
6
7
$fileObject = $fileObject->fileName('tutorial.xlsx');
8
$fileHandle = $fileObject->getHandle();
9
10
// Create a style resource
11
$format = new \Vtiful\Kernel\Format($fileHandle);
12
$colorStyle = $format->fontColor(\Vtiful\Kernel\Format::COLOR_ORANGE)->toResource();
13
14
$filePath = $fileObject->header(['name', 'age'])
15
->data([
16
['viest', 21],
17
['wjx', 21]
18
])
19
->setRow('A1', 50, $colorStyle) // Apply style
20
->output();
Copied!
Last modified 2yr ago