设置文字颜色

函数原型

  1. color(int $color)

int $color

RGB 十六进制值

实例

  1. $config = ['path' => './tests'];
  2. $fileObject = new \Vtiful\Kernel\Excel($config);
  3.  
  4. $fileObject = $fileObject->fileName('tutorial.xlsx');
  5. $fileHandle = $fileObject->getHandle();
  6.  
  7. $format = new \Vtiful\Kernel\Format($fileHandle);
  8. $colorStyle = $format->color(0xFF0000)->toResource();
  9. //或 $colorStyle = $format->color(\Vtiful\Kernel\Format::COLOR_ORANGE)->toResource();
  10.  
  11. $filePath = $fileObject->header(['name', 'age'])
  12. ->data([
  13. ['viest', 21],
  14. ['wjx', 21]
  15. ])
  16. ->setRow('A1', 50, $colorStyle)
  17. ->output();
  18.  
  19. var_dump($filePath);