2
有誰知道用於將圖案樣式添加到單元格顏色的語法?我想添加一個薄的反向對角線條紋。PHPExcel圖案樣式
有誰知道用於將圖案樣式添加到單元格顏色的語法?我想添加一個薄的反向對角線條紋。PHPExcel圖案樣式
據我所知,這是不可能的。在\Style\Fill.php
,這些似乎是唯一的選擇,雖然可能有一個更新的版本有更多的選擇。
$worksheet->getStyle('A:C')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
/* Fill types */
const FILL_NONE = 'none';
const FILL_SOLID = 'solid';
const FILL_GRADIENT_LINEAR = 'linear';
const FILL_GRADIENT_PATH = 'path';
const FILL_PATTERN_DARKDOWN = 'darkDown';
const FILL_PATTERN_DARKGRAY = 'darkGray';
const FILL_PATTERN_DARKGRID = 'darkGrid';
const FILL_PATTERN_DARKHORIZONTAL = 'darkHorizontal';
const FILL_PATTERN_DARKTRELLIS = 'darkTrellis';
const FILL_PATTERN_DARKUP = 'darkUp';
const FILL_PATTERN_DARKVERTICAL = 'darkVertical';
const FILL_PATTERN_GRAY0625 = 'gray0625';
const FILL_PATTERN_GRAY125 = 'gray125';
const FILL_PATTERN_LIGHTDOWN = 'lightDown';
const FILL_PATTERN_LIGHTGRAY = 'lightGray';
const FILL_PATTERN_LIGHTGRID = 'lightGrid';
const FILL_PATTERN_LIGHTHORIZONTAL = 'lightHorizontal';
const FILL_PATTERN_LIGHTTRELLIS = 'lightTrellis';
const FILL_PATTERN_LIGHTUP = 'lightUp';
const FILL_PATTERN_LIGHTVERTICAL = 'lightVertical';
const FILL_PATTERN_MEDIUMGRAY = 'mediumGray';
選擇那些在國內生產總值的答案水平或垂直列出的最合適的模式,設置適當的顏色,然後setRotation()爲填充:
$worksheet->getStyle('A1')->getFill()
->setFillType(PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR)
->setStartColor(new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK))
->setEndColor(new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_WHITE))
->setRotation(45);