本文整理汇总了PHP中Style::getFill方法的典型用法代码示例。如果您正苦于以下问题:PHP Style::getFill方法的具体用法?PHP Style::getFill怎么用?PHP Style::getFill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Style
的用法示例。
在下文中一共展示了Style::getFill方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _writeCellStyleDxf
/**
* Write Cell Style Dxf
*
* @param Shared_XMLWriter $objWriter XML Writer
* @param Style $pStyle Style
* @throws Exception
*/
private function _writeCellStyleDxf(Shared_XMLWriter $objWriter = null, Style $pStyle = null)
{
// dxf
$objWriter->startElement('dxf');
// font
$this->_writeFont($objWriter, $pStyle->getFont());
// numFmt
$this->_writeNumFmt($objWriter, $pStyle->getNumberFormat());
// fill
$this->_writeFill($objWriter, $pStyle->getFill());
// alignment
$objWriter->startElement('alignment');
$objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
$objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
$textRotation = 0;
if ($pStyle->getAlignment()->getTextRotation() >= 0) {
$textRotation = $pStyle->getAlignment()->getTextRotation();
} else {
if ($pStyle->getAlignment()->getTextRotation() < 0) {
$textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
}
}
$objWriter->writeAttribute('textRotation', $textRotation);
$objWriter->endElement();
// border
$this->_writeBorder($objWriter, $pStyle->getBorders());
// protection
if ($pStyle->getProtection()->getLocked() != Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != Style_Protection::PROTECTION_INHERIT) {
$objWriter->startElement('protection');
if ($pStyle->getProtection()->getLocked() != Style_Protection::PROTECTION_INHERIT) {
$objWriter->writeAttribute('locked', $pStyle->getProtection()->getLocked() == Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false');
}
if ($pStyle->getProtection()->getHidden() != Style_Protection::PROTECTION_INHERIT) {
$objWriter->writeAttribute('hidden', $pStyle->getProtection()->getHidden() == Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false');
}
$objWriter->endElement();
}
$objWriter->endElement();
}
示例2: _readXf
//.........这里部分代码省略.........
if ($bordersBottomStyle = $this->_mapBorderStyle((0xf000 & $this->_GetInt4d($recordData, 10)) >> 12)) {
$objStyle->getBorders()->getBottom()->setBorderStyle($bordersBottomStyle);
}
// bit: 22-16; mask: 0x007F0000; left color
$objStyle->getBorders()->getLeft()->colorIndex = (0x7f0000 & $this->_GetInt4d($recordData, 10)) >> 16;
// bit: 29-23; mask: 0x3F800000; right color
$objStyle->getBorders()->getRight()->colorIndex = (0x3f800000 & $this->_GetInt4d($recordData, 10)) >> 23;
// bit: 30; mask: 0x40000000; 1 = diagonal line from top left to right bottom
$diagonalDown = (0x40000000 & $this->_GetInt4d($recordData, 10)) >> 30 ? true : false;
// bit: 31; mask: 0x80000000; 1 = diagonal line from bottom left to top right
$diagonalUp = (0x80000000 & $this->_GetInt4d($recordData, 10)) >> 31 ? true : false;
if ($diagonalUp == false && $diagonalDown == false) {
$objStyle->getBorders()->setDiagonalDirection(Style_Borders::DIAGONAL_NONE);
} elseif ($diagonalUp == true && $diagonalDown == false) {
$objStyle->getBorders()->setDiagonalDirection(Style_Borders::DIAGONAL_UP);
} elseif ($diagonalUp == false && $diagonalDown == true) {
$objStyle->getBorders()->setDiagonalDirection(Style_Borders::DIAGONAL_DOWN);
} elseif ($diagonalUp == true && $diagonalDown == true) {
$objStyle->getBorders()->setDiagonalDirection(Style_Borders::DIAGONAL_BOTH);
}
// offset: 14; size: 4;
// bit: 6-0; mask: 0x0000007F; top color
$objStyle->getBorders()->getTop()->colorIndex = (0x7f & $this->_GetInt4d($recordData, 14)) >> 0;
// bit: 13-7; mask: 0x00003F80; bottom color
$objStyle->getBorders()->getBottom()->colorIndex = (0x3f80 & $this->_GetInt4d($recordData, 14)) >> 7;
// bit: 20-14; mask: 0x001FC000; diagonal color
$objStyle->getBorders()->getDiagonal()->colorIndex = (0x1fc000 & $this->_GetInt4d($recordData, 14)) >> 14;
// bit: 24-21; mask: 0x01E00000; diagonal style
if ($bordersDiagonalStyle = $this->_mapBorderStyle((0x1e00000 & $this->_GetInt4d($recordData, 14)) >> 21)) {
$objStyle->getBorders()->getDiagonal()->setBorderStyle($bordersDiagonalStyle);
}
// bit: 31-26; mask: 0xFC000000 fill pattern
if ($fillType = $this->_mapFillPattern((0xfc000000 & $this->_GetInt4d($recordData, 14)) >> 26)) {
$objStyle->getFill()->setFillType($fillType);
}
// offset: 18; size: 2; pattern and background colour
// bit: 6-0; mask: 0x007F; color index for pattern color
$objStyle->getFill()->startcolorIndex = (0x7f & $this->_GetInt2d($recordData, 18)) >> 0;
// bit: 13-7; mask: 0x3F80; color index for pattern background
$objStyle->getFill()->endcolorIndex = (0x3f80 & $this->_GetInt2d($recordData, 18)) >> 7;
} else {
// BIFF5
// offset: 7; size: 1; Text orientation and flags
$orientationAndFlags = ord($recordData[7]);
// bit: 1-0; mask: 0x03; XF_ORIENTATION: Text orientation
$xfOrientation = (0x3 & $orientationAndFlags) >> 0;
switch ($xfOrientation) {
case 0:
$objStyle->getAlignment()->setTextRotation(0);
break;
case 1:
$objStyle->getAlignment()->setTextRotation(-165);
break;
case 2:
$objStyle->getAlignment()->setTextRotation(90);
break;
case 3:
$objStyle->getAlignment()->setTextRotation(-90);
break;
}
// offset: 8; size: 4; cell border lines and background area
$borderAndBackground = $this->_GetInt4d($recordData, 8);
// bit: 6-0; mask: 0x0000007F; color index for pattern color
$objStyle->getFill()->startcolorIndex = (0x7f & $borderAndBackground) >> 0;
// bit: 13-7; mask: 0x00003F80; color index for pattern background
$objStyle->getFill()->endcolorIndex = (0x3f80 & $borderAndBackground) >> 7;
示例3: _createCSSStyle
/**
* Create CSS style
*
* @param Style $pStyle Style
* @return array
*/
private function _createCSSStyle(Style $pStyle)
{
// Construct CSS
$css = '';
// Create CSS
$css = array_merge($this->_createCSSStyleAlignment($pStyle->getAlignment()), $this->_createCSSStyleBorders($pStyle->getBorders()), $this->_createCSSStyleFont($pStyle->getFont()), $this->_createCSSStyleFill($pStyle->getFill()));
// Return
return $css;
}