Generate an Excel BIFF XF record (style or cell).
170 {
171
172 if ($this->_isStyleXf) {
174 } else {
177 }
178
179
180 $atr_num = ($this->_numberFormatIndex != 0)?1:0;
181 $atr_fnt = ($this->_fontIndex != 0)?1:0;
182 $atr_alc = ((int) $this->_style->getAlignment()->getWrapText()) ? 1 : 0;
187 $atr_pat = (($this->_fg_color != 0x40) ||
188 ($this->_bg_color != 0x41) ||
192
193
194 if (self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) == 0) {
195 $this->_bottom_color = 0;
196 }
197 if (self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) == 0) {
198 $this->_top_color = 0;
199 }
200 if (self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) == 0) {
201 $this->_right_color = 0;
202 }
203 if (self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) == 0) {
204 $this->_left_color = 0;
205 }
206 if (self::_mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) == 0) {
207 $this->_diag_color = 0;
208 }
209
210 $record = 0x00E0;
211 $length = 0x0014;
212
215
216 $align = $this->
_mapHAlign($this->_style->getAlignment()->getHorizontal());
217 $align |= (int) $this->_style->getAlignment()->getWrapText() << 3;
218 $align |=
self::_mapVAlign($this->_style->getAlignment()->getVertical()) << 4;
219 $align |= $this->_text_justlast << 7;
220
221 $used_attrib = $atr_num << 2;
222 $used_attrib |= $atr_fnt << 3;
223 $used_attrib |= $atr_alc << 4;
224 $used_attrib |= $atr_bdr << 5;
225 $used_attrib |= $atr_pat << 6;
226 $used_attrib |= $atr_prot << 7;
227
229 $icv |= $this->_bg_color << 7;
230
235 $border1 |= $this->_left_color << 16;
236 $border1 |= $this->_right_color << 23;
237
238 $diagonalDirection = $this->_style->getBorders()->getDiagonalDirection();
243 $border1 |= $diag_tl_to_rb << 30;
244 $border1 |= $diag_tr_to_lb << 31;
245
247 $border2 |= $this->_bottom_color << 7;
248 $border2 |= $this->_diag_color << 14;
249 $border2 |=
self::_mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) << 21;
251
252 $header = pack(
"vv", $record, $length);
253
254
255 $biff8_options = $this->_style->getAlignment()->getIndent();
256 $biff8_options |= (int) $this->_style->getAlignment()->getShrinkToFit() << 4;
257
258 $data = pack(
"vvvC", $ifnt, $ifmt,
$style, $align);
260 , self::_mapTextRotation($this->_style->getAlignment()->getTextRotation())
261 , $biff8_options
262 , $used_attrib
263 );
264 $data .= pack(
"VVv", $border1, $border2, $icv);
265
267 }
static _mapVAlign($vAlign)
Map to BIFF2-BIFF8 codes for vertical alignment.
static _mapFillType($fillType)
Map fill type.
static _mapLocked($locked)
Map locked.
static _mapHidden($hidden)
Map hidden.
static _mapBorderStyle($borderStyle)
Map border style.
_mapHAlign($hAlign)
Map to BIFF2-BIFF8 codes for horizontal alignment.