Generate an Excel BIFF XF record (style or cell).
172 if ($this->_isStyleXf) {
175 $style = self::_mapLocked($this->_style->getProtection()->getLocked());
176 $style |= self::_mapHidden($this->_style->getProtection()->getHidden()) << 1;
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;
183 $atr_bdr = (self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) ||
184 self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) ||
185 self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) ||
186 self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()))?1:0;
187 $atr_pat = (($this->_fg_color != 0x40) ||
188 ($this->_bg_color != 0x41) ||
189 self::_mapFillType($this->_style->getFill()->getFillType()))?1:0;
190 $atr_prot = self::_mapLocked($this->_style->getProtection()->getLocked())
191 | self::_mapHidden($this->_style->getProtection()->getHidden());
194 if (self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) == 0) {
195 $this->_bottom_color = 0;
197 if (self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) == 0) {
198 $this->_top_color = 0;
200 if (self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) == 0) {
201 $this->_right_color = 0;
203 if (self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) == 0) {
204 $this->_left_color = 0;
206 if (self::_mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) == 0) {
207 $this->_diag_color = 0;
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;
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;
229 $icv |= $this->_bg_color << 7;
231 $border1 = self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle());
232 $border1 |= self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) << 4;
233 $border1 |= self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) << 8;
234 $border1 |= self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) << 12;
235 $border1 |= $this->_left_color << 16;
236 $border1 |= $this->_right_color << 23;
238 $diagonalDirection = $this->_style->getBorders()->getDiagonalDirection();
243 $border1 |= $diag_tl_to_rb << 30;
244 $border1 |= $diag_tr_to_lb << 31;
247 $border2 |= $this->_bottom_color << 7;
248 $border2 |= $this->_diag_color << 14;
249 $border2 |= self::_mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) << 21;
250 $border2 |= self::_mapFillType($this->_style->getFill()->getFillType()) << 26;
252 $header = pack(
"vv", $record, $length);
255 $biff8_options = $this->_style->getAlignment()->getIndent();
256 $biff8_options |= (int) $this->_style->getAlignment()->getShrinkToFit() << 4;
258 $data = pack(
"vvvC", $ifnt, $ifmt,
$style, $align);
260 , self::_mapTextRotation($this->_style->getAlignment()->getTextRotation())
264 $data .= pack(
"VVv", $border1, $border2, $icv);
266 return($header .
$data);
_mapHAlign($hAlign)
Map to BIFF2-BIFF8 codes for horizontal alignment.