本文整理汇总了PHP中PHPExcel_Style_Conditional::getConditions方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Style_Conditional::getConditions方法的具体用法?PHP PHPExcel_Style_Conditional::getConditions怎么用?PHP PHPExcel_Style_Conditional::getConditions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPExcel_Style_Conditional
的用法示例。
在下文中一共展示了PHPExcel_Style_Conditional::getConditions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _writeCFRule
/**
* Write CFRule Record
* @param PHPExcel_Style_Conditional $conditional
*/
private function _writeCFRule(PHPExcel_Style_Conditional $conditional)
{
$record = 0x1b1;
// Record identifier
// $type : Type of the CF
// $operatorType : Comparison operator
if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) {
$type = 0x2;
$operatorType = 0x0;
} else {
if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS) {
$type = 0x1;
switch ($conditional->getOperatorType()) {
case PHPExcel_Style_Conditional::OPERATOR_NONE:
$operatorType = 0x0;
break;
case PHPExcel_Style_Conditional::OPERATOR_EQUAL:
$operatorType = 0x3;
break;
case PHPExcel_Style_Conditional::OPERATOR_GREATERTHAN:
$operatorType = 0x5;
break;
case PHPExcel_Style_Conditional::OPERATOR_GREATERTHANOREQUAL:
$operatorType = 0x7;
break;
case PHPExcel_Style_Conditional::OPERATOR_LESSTHAN:
$operatorType = 0x6;
break;
case PHPExcel_Style_Conditional::OPERATOR_LESSTHANOREQUAL:
$operatorType = 0x8;
break;
case PHPExcel_Style_Conditional::OPERATOR_NOTEQUAL:
$operatorType = 0x4;
break;
case PHPExcel_Style_Conditional::OPERATOR_BETWEEN:
$operatorType = 0x1;
break;
// not OPERATOR_NOTBETWEEN 0x02
}
}
}
// $szValue1 : size of the formula data for first value or formula
// $szValue2 : size of the formula data for second value or formula
$arrConditions = $conditional->getConditions();
$numConditions = sizeof($arrConditions);
if ($numConditions == 1) {
$szValue1 = $arrConditions[0] <= 65535 ? 3 : 0x0;
$szValue2 = 0x0;
$operand1 = pack('Cv', 0x1e, $arrConditions[0]);
$operand2 = null;
} else {
if ($numConditions == 2 && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BETWEEN) {
$szValue1 = $arrConditions[0] <= 65535 ? 3 : 0x0;
$szValue2 = $arrConditions[1] <= 65535 ? 3 : 0x0;
$operand1 = pack('Cv', 0x1e, $arrConditions[0]);
$operand2 = pack('Cv', 0x1e, $arrConditions[1]);
} else {
$szValue1 = 0x0;
$szValue2 = 0x0;
$operand1 = null;
$operand2 = null;
}
}
// $flags : Option flags
// Alignment
$bAlignHz = $conditional->getStyle()->getAlignment()->getHorizontal() == null ? 1 : 0;
$bAlignVt = $conditional->getStyle()->getAlignment()->getVertical() == null ? 1 : 0;
$bAlignWrapTx = $conditional->getStyle()->getAlignment()->getWrapText() == false ? 1 : 0;
$bTxRotation = $conditional->getStyle()->getAlignment()->getTextRotation() == null ? 1 : 0;
$bIndent = $conditional->getStyle()->getAlignment()->getIndent() == 0 ? 1 : 0;
$bShrinkToFit = $conditional->getStyle()->getAlignment()->getShrinkToFit() == false ? 1 : 0;
if ($bAlignHz == 0 || $bAlignVt == 0 || $bAlignWrapTx == 0 || $bTxRotation == 0 || $bIndent == 0 || $bShrinkToFit == 0) {
$bFormatAlign = 1;
} else {
$bFormatAlign = 0;
}
// Protection
$bProtLocked = $conditional->getStyle()->getProtection()->getLocked() == null ? 1 : 0;
$bProtHidden = $conditional->getStyle()->getProtection()->getHidden() == null ? 1 : 0;
if ($bProtLocked == 0 || $bProtHidden == 0) {
$bFormatProt = 1;
} else {
$bFormatProt = 0;
}
// Border
$bBorderLeft = $conditional->getStyle()->getBorders()->getLeft()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK && $conditional->getStyle()->getBorders()->getLeft()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0;
$bBorderRight = $conditional->getStyle()->getBorders()->getRight()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK && $conditional->getStyle()->getBorders()->getRight()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0;
$bBorderTop = $conditional->getStyle()->getBorders()->getTop()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK && $conditional->getStyle()->getBorders()->getTop()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0;
$bBorderBottom = $conditional->getStyle()->getBorders()->getBottom()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK && $conditional->getStyle()->getBorders()->getBottom()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0;
if ($bBorderLeft == 0 || $bBorderRight == 0 || $bBorderTop == 0 || $bBorderBottom == 0) {
$bFormatBorder = 1;
} else {
$bFormatBorder = 0;
}
// Pattern
$bFillStyle = $conditional->getStyle()->getFill()->getFillType() == null ? 0 : 1;
//.........这里部分代码省略.........