ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
PHPExcel_Writer_Excel5_Xf Class Reference
+ Collaboration diagram for PHPExcel_Writer_Excel5_Xf:

Public Member Functions

 __construct (PHPExcel_Style $style=null)
 Constructor.
 writeXf ()
 Generate an Excel BIFF XF record (style or cell).
 setBIFFVersion ($BIFFVersion)
 Set BIFF version.
 setIsStyleXf ($value)
 Is this a style XF ?
 setBottomColor ($colorIndex)
 Sets the cell's bottom border color.
 setTopColor ($colorIndex)
 Sets the cell's top border color.
 setLeftColor ($colorIndex)
 Sets the cell's left border color.
 setRightColor ($colorIndex)
 Sets the cell's right border color.
 setFgColor ($colorIndex)
 Sets the cell's foreground color.
 setBgColor ($colorIndex)
 Sets the cell's background color.
 setNumberFormatIndex ($numberFormatIndex)
 Sets the index to the number format record It can be date, time, currency, etc...
 setFontIndex ($value)
 Set the font index.

Data Fields

 $_numberFormatIndex
 $_text_justlast
 $_fg_color
 $_bg_color
 $_bottom_color
 $_top_color
 $_left_color
 $_right_color

Private Member Functions

 _mapBorderStyle ($borderStyle)
 Map border style.
 _mapFillType ($fillType)
 Map fill type.
 _mapHAlign ($hAlign)
 Map to BIFF2-BIFF8 codes for horizontal alignment.
 _mapVAlign ($vAlign)
 Map to BIFF2-BIFF8 codes for vertical alignment.
 _mapTextRotation ($textRotation)
 Map to BIFF8 codes for text rotation angle.
 _mapLocked ($locked)
 Map locked.
 _mapHidden ($hidden)
 Map hidden.

Private Attributes

 $_BIFFVersion
 $_isStyleXf
 $_fontIndex

Detailed Description

Definition at line 92 of file Xf.php.

Constructor & Destructor Documentation

PHPExcel_Writer_Excel5_Xf::__construct ( PHPExcel_Style  $style = null)

Constructor.

private

Parameters
integer$indexthe XF index for the format.
PHPExcel_Style

Definition at line 169 of file Xf.php.

{
$this->_isStyleXf = false;
$this->_BIFFVersion = 0x0600;
$this->_fontIndex = 0;
$this->_numberFormatIndex = 0;
$this->_text_justlast = 0;
$this->_fg_color = 0x40;
$this->_bg_color = 0x41;
$this->_diag = 0;
$this->_bottom_color = 0x40;
$this->_top_color = 0x40;
$this->_left_color = 0x40;
$this->_right_color = 0x40;
$this->_diag_color = 0x40;
$this->_style = $style;
}

Member Function Documentation

PHPExcel_Writer_Excel5_Xf::_mapBorderStyle (   $borderStyle)
private

Map border style.

Definition at line 446 of file Xf.php.

References PHPExcel_Style_Border\BORDER_DASHDOT, PHPExcel_Style_Border\BORDER_DASHDOTDOT, PHPExcel_Style_Border\BORDER_DASHED, PHPExcel_Style_Border\BORDER_DOTTED, PHPExcel_Style_Border\BORDER_DOUBLE, PHPExcel_Style_Border\BORDER_HAIR, PHPExcel_Style_Border\BORDER_MEDIUM, PHPExcel_Style_Border\BORDER_MEDIUMDASHDOT, PHPExcel_Style_Border\BORDER_MEDIUMDASHDOTDOT, PHPExcel_Style_Border\BORDER_MEDIUMDASHED, PHPExcel_Style_Border\BORDER_NONE, PHPExcel_Style_Border\BORDER_SLANTDASHDOT, PHPExcel_Style_Border\BORDER_THICK, and PHPExcel_Style_Border\BORDER_THIN.

Referenced by writeXf().

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel5_Xf::_mapFillType (   $fillType)
private

Map fill type.

Definition at line 469 of file Xf.php.

References PHPExcel_Style_Fill\FILL_GRADIENT_LINEAR, PHPExcel_Style_Fill\FILL_GRADIENT_PATH, PHPExcel_Style_Fill\FILL_NONE, PHPExcel_Style_Fill\FILL_PATTERN_DARKDOWN, PHPExcel_Style_Fill\FILL_PATTERN_DARKGRAY, PHPExcel_Style_Fill\FILL_PATTERN_DARKGRID, PHPExcel_Style_Fill\FILL_PATTERN_DARKHORIZONTAL, PHPExcel_Style_Fill\FILL_PATTERN_DARKTRELLIS, PHPExcel_Style_Fill\FILL_PATTERN_DARKUP, PHPExcel_Style_Fill\FILL_PATTERN_DARKVERTICAL, PHPExcel_Style_Fill\FILL_PATTERN_GRAY0625, PHPExcel_Style_Fill\FILL_PATTERN_GRAY125, PHPExcel_Style_Fill\FILL_PATTERN_LIGHTDOWN, PHPExcel_Style_Fill\FILL_PATTERN_LIGHTGRAY, PHPExcel_Style_Fill\FILL_PATTERN_LIGHTGRID, PHPExcel_Style_Fill\FILL_PATTERN_LIGHTHORIZONTAL, PHPExcel_Style_Fill\FILL_PATTERN_LIGHTTRELLIS, PHPExcel_Style_Fill\FILL_PATTERN_LIGHTUP, PHPExcel_Style_Fill\FILL_PATTERN_LIGHTVERTICAL, PHPExcel_Style_Fill\FILL_PATTERN_MEDIUMGRAY, and PHPExcel_Style_Fill\FILL_SOLID.

Referenced by writeXf().

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel5_Xf::_mapHAlign (   $hAlign)
private
PHPExcel_Writer_Excel5_Xf::_mapHidden (   $hidden)
private

Map hidden.

Parameters
string
Returns
int

Definition at line 570 of file Xf.php.

References PHPExcel_Style_Protection\PROTECTION_INHERIT, PHPExcel_Style_Protection\PROTECTION_PROTECTED, and PHPExcel_Style_Protection\PROTECTION_UNPROTECTED.

Referenced by writeXf().

{
switch ($hidden) {
default: return 0;
}
}

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel5_Xf::_mapLocked (   $locked)
private

Map locked.

Parameters
string
Returns
int

Definition at line 555 of file Xf.php.

References PHPExcel_Style_Protection\PROTECTION_INHERIT, PHPExcel_Style_Protection\PROTECTION_PROTECTED, and PHPExcel_Style_Protection\PROTECTION_UNPROTECTED.

Referenced by writeXf().

{
switch ($locked) {
default: return 1;
}
}

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel5_Xf::_mapTextRotation (   $textRotation)
private

Map to BIFF8 codes for text rotation angle.

Parameters
int$textRotation
Returns
int

Definition at line 537 of file Xf.php.

Referenced by writeXf().

{
if ($textRotation >= 0) {
return $textRotation;
}
if ($textRotation == -165) {
return 255;
}
if ($textRotation < 0) {
return 90 - $textRotation;
}
}

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel5_Xf::_mapVAlign (   $vAlign)
private

Map to BIFF2-BIFF8 codes for vertical alignment.

Parameters
string$vAlign
Returns
int

Definition at line 521 of file Xf.php.

References PHPExcel_Style_Alignment\VERTICAL_BOTTOM, PHPExcel_Style_Alignment\VERTICAL_CENTER, PHPExcel_Style_Alignment\VERTICAL_JUSTIFY, and PHPExcel_Style_Alignment\VERTICAL_TOP.

Referenced by writeXf().

{
switch ($vAlign) {
default: return 2;
}
}

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel5_Xf::setBgColor (   $colorIndex)

Sets the cell's background color.

public

Parameters
int$colorIndexColor index

Definition at line 416 of file Xf.php.

{
$this->_bg_color = $colorIndex;
}
PHPExcel_Writer_Excel5_Xf::setBIFFVersion (   $BIFFVersion)

Set BIFF version.

Parameters
int$BIFFVersion

Definition at line 339 of file Xf.php.

{
$this->_BIFFVersion = $BIFFVersion;
}
PHPExcel_Writer_Excel5_Xf::setBottomColor (   $colorIndex)

Sets the cell's bottom border color.

public

Parameters
int$colorIndexColor index

Definition at line 360 of file Xf.php.

{
$this->_bottom_color = $colorIndex;
}
PHPExcel_Writer_Excel5_Xf::setFgColor (   $colorIndex)

Sets the cell's foreground color.

public

Parameters
int$colorIndexColor index

Definition at line 405 of file Xf.php.

{
$this->_fg_color = $colorIndex;
}
PHPExcel_Writer_Excel5_Xf::setFontIndex (   $value)

Set the font index.

Parameters
int$valueFont index, note that value 4 does not exist

Definition at line 438 of file Xf.php.

{
$this->_fontIndex = $value;
}
PHPExcel_Writer_Excel5_Xf::setIsStyleXf (   $value)

Is this a style XF ?

Parameters
boolean$value

Definition at line 349 of file Xf.php.

{
$this->_isStyleXf = $value;
}
PHPExcel_Writer_Excel5_Xf::setLeftColor (   $colorIndex)

Sets the cell's left border color.

public

Parameters
int$colorIndexColor index

Definition at line 382 of file Xf.php.

{
$this->_left_color = $colorIndex;
}
PHPExcel_Writer_Excel5_Xf::setNumberFormatIndex (   $numberFormatIndex)

Sets the index to the number format record It can be date, time, currency, etc...

public

Parameters
integer$numberFormatIndexIndex to format record

Definition at line 428 of file Xf.php.

{
$this->_numberFormatIndex = $numberFormatIndex;
}
PHPExcel_Writer_Excel5_Xf::setRightColor (   $colorIndex)

Sets the cell's right border color.

public

Parameters
int$colorIndexColor index

Definition at line 393 of file Xf.php.

{
$this->_right_color = $colorIndex;
}
PHPExcel_Writer_Excel5_Xf::setTopColor (   $colorIndex)

Sets the cell's top border color.

public

Parameters
int$colorIndexColor index

Definition at line 371 of file Xf.php.

{
$this->_top_color = $colorIndex;
}
PHPExcel_Writer_Excel5_Xf::writeXf ( )

Generate an Excel BIFF XF record (style or cell).

Parameters
string$styleThe type of the XF record ('style' or 'cell').
Returns
string The XF record

Definition at line 200 of file Xf.php.

References $_fg_color, $_fontIndex, $_left_color, $_numberFormatIndex, $_top_color, $data, _mapBorderStyle(), _mapFillType(), _mapHAlign(), _mapHidden(), _mapLocked(), _mapTextRotation(), _mapVAlign(), and elseif().

{
// Set the type of the XF record and some of the attributes.
if ($this->_isStyleXf) {
$style = 0xFFF5;
} else {
$style = $this->_mapLocked($this->_style->getProtection()->getLocked());
$style |= $this->_mapHidden($this->_style->getProtection()->getHidden()) << 1;
}
// Flags to indicate if attributes have been set.
$atr_num = ($this->_numberFormatIndex != 0)?1:0;
$atr_fnt = ($this->_fontIndex != 0)?1:0;
$atr_alc = ((int) $this->_style->getAlignment()->getWrapText())?1:0;
$atr_bdr = ($this->_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) ||
$this->_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) ||
$this->_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) ||
$this->_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()))?1:0;
$atr_pat = (($this->_fg_color != 0x40) ||
($this->_bg_color != 0x41) ||
$this->_mapFillType($this->_style->getFill()->getFillType()))?1:0;
$atr_prot = $this->_mapLocked($this->_style->getProtection()->getLocked())
| $this->_mapHidden($this->_style->getProtection()->getHidden());
// Zero the default border colour if the border has not been set.
if ($this->_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) == 0) {
$this->_bottom_color = 0;
}
if ($this->_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) == 0) {
$this->_top_color = 0;
}
if ($this->_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) == 0) {
$this->_right_color = 0;
}
if ($this->_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) == 0) {
$this->_left_color = 0;
}
if ($this->_diag == 0) {
$this->_diag_color = 0;
}
$record = 0x00E0; // Record identifier
if ($this->_BIFFVersion == 0x0500) {
$length = 0x0010; // Number of bytes to follow
}
if ($this->_BIFFVersion == 0x0600) {
$length = 0x0014;
}
$ifnt = $this->_fontIndex; // Index to FONT record
$ifmt = $this->_numberFormatIndex; // Index to FORMAT record
if ($this->_BIFFVersion == 0x0500) {
$align = $this->_mapHAlign($this->_style->getAlignment()->getHorizontal()); // Alignment
$align |= (int) $this->_style->getAlignment()->getWrapText() << 3;
$align |= $this->_mapVAlign($this->_style->getAlignment()->getVertical()) << 4;
$align |= $this->_text_justlast << 7;
$align |= 0 << 8; // rotation
$align |= $atr_num << 10;
$align |= $atr_fnt << 11;
$align |= $atr_alc << 12;
$align |= $atr_bdr << 13;
$align |= $atr_pat << 14;
$align |= $atr_prot << 15;
$icv = $this->_fg_color; // fg and bg pattern colors
$icv |= $this->_bg_color << 7;
$fill = $this->_mapFillType($this->_style->getFill()->getFillType()); // Fill and border line style
$fill |= $this->_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) << 6;
$fill |= $this->_bottom_color << 9;
$border1 = $this->_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()); // Border line style and color
$border1 |= $this->_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) << 3;
$border1 |= $this->_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) << 6;
$border1 |= $this->_top_color << 9;
$border2 = $this->_left_color; // Border color
$border2 |= $this->_right_color << 7;
$header = pack("vv", $record, $length);
$data = pack("vvvvvvvv", $ifnt, $ifmt, $style, $align,
$icv, $fill,
$border1, $border2);
} elseif ($this->_BIFFVersion == 0x0600) {
$align = $this->_mapHAlign($this->_style->getAlignment()->getHorizontal()); // Alignment
$align |= (int) $this->_style->getAlignment()->getWrapText() << 3;
$align |= $this->_mapVAlign($this->_style->getAlignment()->getVertical()) << 4;
$align |= $this->_text_justlast << 7;
$used_attrib = $atr_num << 2;
$used_attrib |= $atr_fnt << 3;
$used_attrib |= $atr_alc << 4;
$used_attrib |= $atr_bdr << 5;
$used_attrib |= $atr_pat << 6;
$used_attrib |= $atr_prot << 7;
$icv = $this->_fg_color; // fg and bg pattern colors
$icv |= $this->_bg_color << 7;
$border1 = $this->_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()); // Border line style and color
$border1 |= $this->_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) << 4;
$border1 |= $this->_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) << 8;
$border1 |= $this->_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) << 12;
$border1 |= $this->_left_color << 16;
$border1 |= $this->_right_color << 23;
$diag_tl_to_rb = 0;
$diag_tr_to_lb = 0;
$border1 |= $diag_tl_to_rb << 30;
$border1 |= $diag_tr_to_lb << 31;
$border2 = $this->_top_color; // Border color
$border2 |= $this->_bottom_color << 7;
$border2 |= $this->_diag_color << 14;
$border2 |= $this->_diag << 21;
$border2 |= $this->_mapFillType($this->_style->getFill()->getFillType()) << 26;
$header = pack("vv", $record, $length);
//BIFF8 options: identation, shrinkToFit and text direction
$biff8_options = $this->_style->getAlignment()->getIndent();
$biff8_options |= (int) $this->_style->getAlignment()->getShrinkToFit() << 4;
$data = pack("vvvC", $ifnt, $ifmt, $style, $align);
$data .= pack("CCC"
, $this->_mapTextRotation($this->_style->getAlignment()->getTextRotation())
, $biff8_options
, $used_attrib
);
$data .= pack("VVv", $border1, $border2, $icv);
}
return($header . $data);
}

+ Here is the call graph for this function:

Field Documentation

PHPExcel_Writer_Excel5_Xf::$_bg_color

Definition at line 136 of file Xf.php.

PHPExcel_Writer_Excel5_Xf::$_BIFFVersion
private

Definition at line 99 of file Xf.php.

PHPExcel_Writer_Excel5_Xf::$_bottom_color

Definition at line 142 of file Xf.php.

PHPExcel_Writer_Excel5_Xf::$_fg_color

Definition at line 130 of file Xf.php.

Referenced by writeXf().

PHPExcel_Writer_Excel5_Xf::$_fontIndex
private

Definition at line 112 of file Xf.php.

Referenced by writeXf().

PHPExcel_Writer_Excel5_Xf::$_isStyleXf
private

Definition at line 106 of file Xf.php.

PHPExcel_Writer_Excel5_Xf::$_left_color

Definition at line 154 of file Xf.php.

Referenced by writeXf().

PHPExcel_Writer_Excel5_Xf::$_numberFormatIndex

Definition at line 118 of file Xf.php.

Referenced by writeXf().

PHPExcel_Writer_Excel5_Xf::$_right_color

Definition at line 160 of file Xf.php.

PHPExcel_Writer_Excel5_Xf::$_text_justlast

Definition at line 124 of file Xf.php.

PHPExcel_Writer_Excel5_Xf::$_top_color

Definition at line 148 of file Xf.php.

Referenced by writeXf().


The documentation for this class was generated from the following file: