本文整理汇总了PHP中Style::getBorders方法的典型用法代码示例。如果您正苦于以下问题:PHP Style::getBorders方法的具体用法?PHP Style::getBorders怎么用?PHP Style::getBorders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Style
的用法示例。
在下文中一共展示了Style::getBorders方法的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
//.........这里部分代码省略.........
// offset: 7; size: 1; XF_ROTATION: Text rotation angle
$angle = ord($recordData[7]);
$rotation = 0;
if ($angle <= 90) {
$rotation = $angle;
} else {
if ($angle <= 180) {
$rotation = 90 - $angle;
} else {
if ($angle == 255) {
$rotation = -165;
}
}
}
$objStyle->getAlignment()->setTextRotation($rotation);
// offset: 8; size: 1; Indentation, shrink to cell size, and text direction
// bit: 3-0; mask: 0x0F; indent level
$indent = (0xf & ord($recordData[8])) >> 0;
$objStyle->getAlignment()->setIndent($indent);
// bit: 4; mask: 0x10; 1 = shrink content to fit into cell
$shrinkToFit = (0x10 & ord($recordData[8])) >> 4;
switch ($shrinkToFit) {
case 0:
$objStyle->getAlignment()->setShrinkToFit(false);
break;
case 1:
$objStyle->getAlignment()->setShrinkToFit(true);
break;
}
// offset: 9; size: 1; Flags used for attribute groups
// offset: 10; size: 4; Cell border lines and background area
// bit: 3-0; mask: 0x0000000F; left style
if ($bordersLeftStyle = $this->_mapBorderStyle((0xf & $this->_GetInt4d($recordData, 10)) >> 0)) {
$objStyle->getBorders()->getLeft()->setBorderStyle($bordersLeftStyle);
}
// bit: 7-4; mask: 0x000000F0; right style
if ($bordersRightStyle = $this->_mapBorderStyle((0xf0 & $this->_GetInt4d($recordData, 10)) >> 4)) {
$objStyle->getBorders()->getRight()->setBorderStyle($bordersRightStyle);
}
// bit: 11-8; mask: 0x00000F00; top style
if ($bordersTopStyle = $this->_mapBorderStyle((0xf00 & $this->_GetInt4d($recordData, 10)) >> 8)) {
$objStyle->getBorders()->getTop()->setBorderStyle($bordersTopStyle);
}
// bit: 15-12; mask: 0x0000F000; bottom style
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
示例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;
}