141 $this->isStyleXf =
false;
142 $this->fontIndex = 0;
144 $this->numberFormatIndex = 0;
146 $this->textJustLast = 0;
148 $this->foregroundColor = 0x40;
149 $this->backgroundColor = 0x41;
153 $this->bottomBorderColor = 0x40;
154 $this->topBorderColor = 0x40;
155 $this->leftBorderColor = 0x40;
156 $this->rightBorderColor = 0x40;
157 $this->diagColor = 0x40;
169 if ($this->isStyleXf) {
172 $style = self::mapLocked($this->
style->getProtection()->getLocked());
173 $style |= self::mapHidden($this->
style->getProtection()->getHidden()) << 1;
177 $atr_num = ($this->numberFormatIndex != 0) ? 1 : 0;
178 $atr_fnt = ($this->fontIndex != 0) ? 1 : 0;
179 $atr_alc = ((int) $this->
style->getAlignment()->getWrapText()) ? 1 : 0;
184 $atr_pat = ($this->foregroundColor != 0x40) ? 1 : 0;
185 $atr_pat = ($this->backgroundColor != 0x41) ? 1 : $atr_pat;
187 $atr_prot = self::mapLocked($this->
style->getProtection()->getLocked())
188 | self::mapHidden($this->
style->getProtection()->getHidden());
192 $this->bottomBorderColor = 0;
195 $this->topBorderColor = 0;
198 $this->rightBorderColor = 0;
201 $this->leftBorderColor = 0;
204 $this->diagColor = 0;
214 $align = CellAlignment::horizontal($this->
style->getAlignment());
215 $align |= CellAlignment::wrap($this->
style->getAlignment()) << 3;
216 $align |= CellAlignment::vertical($this->
style->getAlignment()) << 4;
217 $align |= $this->textJustLast << 7;
219 $used_attrib = $atr_num << 2;
220 $used_attrib |= $atr_fnt << 3;
221 $used_attrib |= $atr_alc << 4;
222 $used_attrib |= $atr_bdr << 5;
223 $used_attrib |= $atr_pat << 6;
224 $used_attrib |= $atr_prot << 7;
227 $icv |= $this->backgroundColor << 7;
233 $border1 |= $this->leftBorderColor << 16;
234 $border1 |= $this->rightBorderColor << 23;
236 $diagonalDirection = $this->
style->getBorders()->getDiagonalDirection();
241 $border1 |= $diag_tl_to_rb << 30;
242 $border1 |= $diag_tr_to_lb << 31;
245 $border2 |= $this->bottomBorderColor << 7;
246 $border2 |= $this->diagColor << 14;
250 $header = pack(
'vv', $record, $length);
253 $biff8_options = $this->
style->getAlignment()->getIndent();
254 $biff8_options |= (int) $this->
style->getAlignment()->getShrinkToFit() << 4;
256 $data = pack(
'vvvC', $ifnt, $ifmt,
$style, $align);
257 $data .= pack(
'CCC', self::mapTextRotation($this->
style->getAlignment()->getTextRotation()), $biff8_options, $used_attrib);
258 $data .= pack(
'VVv', $border1, $border2, $icv);
260 return $header .
$data;
270 $this->isStyleXf = $value;
280 $this->bottomBorderColor = $colorIndex;
290 $this->topBorderColor = $colorIndex;
300 $this->leftBorderColor = $colorIndex;
310 $this->rightBorderColor = $colorIndex;
320 $this->diagColor = $colorIndex;
330 $this->foregroundColor = $colorIndex;
340 $this->backgroundColor = $colorIndex;
361 $this->fontIndex = $value;
373 if ($textRotation >= 0) {
374 return $textRotation;
380 return 90 - $textRotation;
384 Protection::PROTECTION_INHERIT => 1,
385 Protection::PROTECTION_PROTECTED => 1,
386 Protection::PROTECTION_UNPROTECTED => 0,
398 return array_key_exists($locked, self::LOCK_ARRAY) ? self::LOCK_ARRAY[$locked] : 1;
402 Protection::PROTECTION_INHERIT => 0,
403 Protection::PROTECTION_PROTECTED => 1,
404 Protection::PROTECTION_UNPROTECTED => 0,
416 return array_key_exists($hidden, self::HIDDEN_ARRAY) ? self::HIDDEN_ARRAY[$hidden] : 0;
setIsStyleXf($value)
Is this a style XF ?
const TEXTROTATION_STACK_EXCEL
static mapHidden($hidden)
Map hidden.
setFontIndex($value)
Set the font index.
setNumberFormatIndex($numberFormatIndex)
Sets the index to the number format record It can be date, time, currency, etc... ...
setTopColor($colorIndex)
Sets the cell's top border color.
const TEXTROTATION_STACK_PHPSPREADSHEET
setLeftColor($colorIndex)
Sets the cell's left border color.
setFgColor($colorIndex)
Sets the cell's foreground color.
static mapTextRotation($textRotation)
Map to BIFF8 codes for text rotation angle.
setDiagColor($colorIndex)
Sets the cell's diagonal border color.
setBottomColor($colorIndex)
Sets the cell's bottom border color.
__construct(Style $style)
Constructor.
setRightColor($colorIndex)
Sets the cell's right border color.
static mapLocked($locked)
Map locked values.
setBgColor($colorIndex)
Sets the cell's background color.
writeXf()
Generate an Excel BIFF XF record (style or cell).