Source for file DataValidation.php
Documentation is available at DataValidation.php
* Copyright (c) 2006 - 2009 PHPExcel
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.6.5, 2009-01-05
* PHPExcel_Cell_DataValidation
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
/* Data validation types */
const TYPE_NONE = 'none';
const TYPE_CUSTOM = 'custom';
const TYPE_DATE = 'date';
const TYPE_DECIMAL = 'decimal';
const TYPE_LIST = 'list';
const TYPE_TEXTLENGTH = 'textLength';
const TYPE_TIME = 'time';
const TYPE_WHOLE = 'whole';
/* Data validation error styles */
const STYLE_STOP = 'stop';
const STYLE_WARNING = 'warning';
const STYLE_INFORMATION = 'information';
/* Data validation operators */
const OPERATOR_BETWEEN = 'between';
const OPERATOR_EQUAL = 'equal';
const OPERATOR_GREATERTHAN = 'greaterThan';
const OPERATOR_GREATERTHANOREQUAL = 'greaterThanOrEqual';
const OPERATOR_LESSTHAN = 'lessThan';
const OPERATOR_LESSTHANOREQUAL = 'lessThanOrEqual';
const OPERATOR_NOTBETWEEN = 'notBetween';
const OPERATOR_NOTEQUAL = 'notEqual';
private $_type = PHPExcel_Cell_DataValidation::TYPE_NONE;
private $_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP;
* Create a new PHPExcel_Cell_DataValidation
* @param PHPExcel_Cell $pCell Parent cell
public function __construct(PHPExcel_Cell $pCell = null)
// Initialise member variables
public function setType($value = PHPExcel_Cell_DataValidation::TYPE_NONE) {
public function setErrorStyle($value = PHPExcel_Cell_DataValidation::STYLE_STOP) {
* @param PHPExcel_Cell $value
* @return string Hash code
* Implement PHP __clone to create a deep clone, not just a shallow copy.
foreach ($vars as $key => $value) {
$this->$key = clone $value;
<complexType name="CT_DataValidation">
<element name="formula1" type="ST_Formula" minOccurs="0" maxOccurs="1"/>
<element name="formula2" type="ST_Formula" minOccurs="0" maxOccurs="1"/>
<attribute name="type" type="ST_DataValidationType" use="optional" default="none"/>
<attribute name="errorStyle" type="ST_DataValidationErrorStyle" use="optional" default="stop"/>
<attribute name="imeMode" type="ST_DataValidationImeMode" use="optional" default="noControl"/>
<attribute name="operator" type="ST_DataValidationOperator" use="optional" default="between"/>
<attribute name="allowBlank" type="xsd:boolean" use="optional" default="false"/>
<attribute name="showDropDown" type="xsd:boolean" use="optional" default="false"/>
<attribute name="showInputMessage" type="xsd:boolean" use="optional" default="false"/>
<attribute name="showErrorMessage" type="xsd:boolean" use="optional" default="false"/>
<attribute name="errorTitle" type="ST_Xstring" use="optional"/>
<attribute name="error" type="ST_Xstring" use="optional"/>
<attribute name="promptTitle" type="ST_Xstring" use="optional"/>
<attribute name="prompt" type="ST_Xstring" use="optional"/>
<attribute name="sqref" type="ST_Sqref" use="required"/>
|