Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 88
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 215
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 216
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 217
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 218
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 219
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 220
PK ! Te6 6 Typography.phpnu [ tags
*
* @var string
*/
public $block_elements = 'address|blockquote|div|dl|fieldset|form|h\d|hr|noscript|object|ol|p|pre|script|table|ul';
/**
* Elements that should not have and
tags within them.
*
* @var string
*/
public $skip_elements = 'p|pre|ol|ul|dl|object|table|h\d';
/**
* Tags we want the parser to completely ignore when splitting the string.
*
* @var string
*/
public $inline_elements = 'a|abbr|acronym|b|bdo|big|br|button|cite|code|del|dfn|em|i|img|ins|input|label|map|kbd|q|samp|select|small|span|strong|sub|sup|textarea|tt|var';
/**
* array of block level elements that require inner content to be within another block level element
*
* @var array
*/
public $inner_block_required = array('blockquote');
/**
* the last block element parsed
*
* @var string
*/
public $last_block_element = '';
/**
* whether or not to protect quotes within { curly braces }
*
* @var bool
*/
public $protect_braced_quotes = FALSE;
/**
* Auto Typography
*
* This function converts text, making it typographically correct:
* - Converts double spaces into paragraphs.
* - Converts single line breaks into
tags
* - Converts single and double quotes into correctly facing curly quote entities.
* - Converts three dots into ellipsis.
* - Converts double dashes into em-dashes.
* - Converts two spaces into entities
*
* @param string
* @param bool whether to reduce more then two consecutive newlines to two
* @return string
*/
public function auto_typography($str, $reduce_linebreaks = FALSE)
{
if ($str === '')
{
return '';
}
// Standardize Newlines to make matching easier
if (strpos($str, "\r") !== FALSE)
{
$str = str_replace(array("\r\n", "\r"), "\n", $str);
}
// Reduce line breaks. If there are more than two consecutive linebreaks
// we'll compress them down to a maximum of two since there's no benefit to more.
if ($reduce_linebreaks === TRUE)
{
$str = preg_replace("/\n\n+/", "\n\n", $str);
}
// HTML comment tags don't conform to patterns of normal tags, so pull them out separately, only if needed
$html_comments = array();
if (strpos($str, '\n";
}
return $r;
}
// --------------------------------------------------------------------
/**
* Executes the Method
*
* @param object
* @return mixed
*/
protected function _execute($m)
{
$methName = $m->method_name;
// Check to see if it is a system call
$system_call = (strpos($methName, 'system') === 0);
if ($this->xss_clean === FALSE)
{
$m->xss_clean = FALSE;
}
//-------------------------------------
// Valid Method
//-------------------------------------
if ( ! isset($this->methods[$methName]['function']))
{
return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']);
}
//-------------------------------------
// Check for Method (and Object)
//-------------------------------------
$method_parts = explode('.', $this->methods[$methName]['function']);
$objectCall = ! empty($method_parts[1]);
if ($system_call === TRUE)
{
if ( ! is_callable(array($this, $method_parts[1])))
{
return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']);
}
}
elseif (($objectCall && ! is_callable(array($method_parts[0], $method_parts[1])))
OR ( ! $objectCall && ! is_callable($this->methods[$methName]['function']))
)
{
return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']);
}
//-------------------------------------
// Checking Methods Signature
//-------------------------------------
if (isset($this->methods[$methName]['signature']))
{
$sig = $this->methods[$methName]['signature'];
for ($i = 0, $c = count($sig); $i < $c; $i++)
{
$current_sig = $sig[$i];
if (count($current_sig) === count($m->params)+1)
{
for ($n = 0, $mc = count($m->params); $n < $mc; $n++)
{
$p = $m->params[$n];
$pt = ($p->kindOf() === 'scalar') ? $p->scalarval() : $p->kindOf();
if ($pt !== $current_sig[$n+1])
{
$pno = $n+1;
$wanted = $current_sig[$n+1];
return new XML_RPC_Response(0,
$this->xmlrpcerr['incorrect_params'],
$this->xmlrpcstr['incorrect_params'] .
': Wanted '.$wanted.', got '.$pt.' at param '.$pno.')');
}
}
}
}
}
//-------------------------------------
// Calls the Function
//-------------------------------------
if ($objectCall === TRUE)
{
if ($method_parts[0] === 'this' && $system_call === TRUE)
{
return call_user_func(array($this, $method_parts[1]), $m);
}
elseif ($this->object === FALSE)
{
return get_instance()->{$method_parts[1]}($m);
}
return $this->object->{$method_parts[1]}($m);
}
return call_user_func($this->methods[$methName]['function'], $m);
}
// --------------------------------------------------------------------
/**
* Server Function: List Methods
*
* @param mixed
* @return object
*/
public function listMethods($m)
{
$v = new XML_RPC_Values();
$output = array();
foreach ($this->methods as $key => $value)
{
$output[] = new XML_RPC_Values($key, 'string');
}
foreach ($this->system_methods as $key => $value)
{
$output[] = new XML_RPC_Values($key, 'string');
}
$v->addArray($output);
return new XML_RPC_Response($v);
}
// --------------------------------------------------------------------
/**
* Server Function: Return Signature for Method
*
* @param mixed
* @return object
*/
public function methodSignature($m)
{
$parameters = $m->output_parameters();
$method_name = $parameters[0];
if (isset($this->methods[$method_name]))
{
if ($this->methods[$method_name]['signature'])
{
$sigs = array();
$signature = $this->methods[$method_name]['signature'];
for ($i = 0, $c = count($signature); $i < $c; $i++)
{
$cursig = array();
$inSig = $signature[$i];
for ($j = 0, $jc = count($inSig); $j < $jc; $j++)
{
$cursig[]= new XML_RPC_Values($inSig[$j], 'string');
}
$sigs[] = new XML_RPC_Values($cursig, 'array');
}
return new XML_RPC_Response(new XML_RPC_Values($sigs, 'array'));
}
return new XML_RPC_Response(new XML_RPC_Values('undef', 'string'));
}
return new XML_RPC_Response(0, $this->xmlrpcerr['introspect_unknown'], $this->xmlrpcstr['introspect_unknown']);
}
// --------------------------------------------------------------------
/**
* Server Function: Doc String for Method
*
* @param mixed
* @return object
*/
public function methodHelp($m)
{
$parameters = $m->output_parameters();
$method_name = $parameters[0];
if (isset($this->methods[$method_name]))
{
$docstring = isset($this->methods[$method_name]['docstring']) ? $this->methods[$method_name]['docstring'] : '';
return new XML_RPC_Response(new XML_RPC_Values($docstring, 'string'));
}
return new XML_RPC_Response(0, $this->xmlrpcerr['introspect_unknown'], $this->xmlrpcstr['introspect_unknown']);
}
// --------------------------------------------------------------------
/**
* Server Function: Multi-call
*
* @param mixed
* @return object
*/
public function multicall($m)
{
// Disabled
return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']);
$parameters = $m->output_parameters();
$calls = $parameters[0];
$result = array();
foreach ($calls as $value)
{
$m = new XML_RPC_Message($value[0]);
$plist = '';
for ($i = 0, $c = count($value[1]); $i < $c; $i++)
{
$m->addParam(new XML_RPC_Values($value[1][$i], 'string'));
}
$attempt = $this->_execute($m);
if ($attempt->faultCode() !== 0)
{
return $attempt;
}
$result[] = new XML_RPC_Values(array($attempt->value()), 'array');
}
return new XML_RPC_Response(new XML_RPC_Values($result, 'array'));
}
// --------------------------------------------------------------------
/**
* Multi-call Function: Error Handling
*
* @param mixed
* @return object
*/
public function multicall_error($err)
{
$str = is_string($err) ? $this->xmlrpcstr["multicall_${err}"] : $err->faultString();
$code = is_string($err) ? $this->xmlrpcerr["multicall_${err}"] : $err->faultCode();
$struct['faultCode'] = new XML_RPC_Values($code, 'int');
$struct['faultString'] = new XML_RPC_Values($str, 'string');
return new XML_RPC_Values($struct, 'struct');
}
// --------------------------------------------------------------------
/**
* Multi-call Function: Processes method
*
* @param mixed
* @return object
*/
public function do_multicall($call)
{
if ($call->kindOf() !== 'struct')
{
return $this->multicall_error('notstruct');
}
elseif ( ! $methName = $call->me['struct']['methodName'])
{
return $this->multicall_error('nomethod');
}
list($scalar_value, $scalar_type) = array(reset($methName->me), key($methName->me));
$scalar_type = $scalar_type === $this->xmlrpcI4 ? $this->xmlrpcInt : $scalar_type;
if ($methName->kindOf() !== 'scalar' OR $scalar_type !== 'string')
{
return $this->multicall_error('notstring');
}
elseif ($scalar_value === 'system.multicall')
{
return $this->multicall_error('recursion');
}
elseif ( ! $params = $call->me['struct']['params'])
{
return $this->multicall_error('noparams');
}
elseif ($params->kindOf() !== 'array')
{
return $this->multicall_error('notarray');
}
list($b, $a) = array(reset($params->me), key($params->me));
$msg = new XML_RPC_Message($scalar_value);
for ($i = 0, $numParams = count($b); $i < $numParams; $i++)
{
$msg->params[] = $params->me['array'][$i];
}
$result = $this->_execute($msg);
if ($result->faultCode() !== 0)
{
return $this->multicall_error($result);
}
return new XML_RPC_Values(array($result->value()), 'array');
}
}
PK !
Parser.phpnu [ CI =& get_instance();
log_message('info', 'Parser Class Initialized');
}
// --------------------------------------------------------------------
/**
* Parse a template
*
* Parses pseudo-variables contained in the specified template view,
* replacing them with the data in the second param
*
* @param string
* @param array
* @param bool
* @return string
*/
public function parse($template, $data, $return = FALSE)
{
$template = $this->CI->load->view($template, $data, TRUE);
return $this->_parse($template, $data, $return);
}
// --------------------------------------------------------------------
/**
* Parse a String
*
* Parses pseudo-variables contained in the specified string,
* replacing them with the data in the second param
*
* @param string
* @param array
* @param bool
* @return string
*/
public function parse_string($template, $data, $return = FALSE)
{
return $this->_parse($template, $data, $return);
}
// --------------------------------------------------------------------
/**
* Parse a template
*
* Parses pseudo-variables contained in the specified template,
* replacing them with the data in the second param
*
* @param string
* @param array
* @param bool
* @return string
*/
protected function _parse($template, $data, $return = FALSE)
{
if ($template === '')
{
return FALSE;
}
$replace = array();
foreach ($data as $key => $val)
{
$replace = array_merge(
$replace,
is_array($val)
? $this->_parse_pair($key, $val, $template)
: $this->_parse_single($key, (string) $val, $template)
);
}
unset($data);
$template = strtr($template, $replace);
if ($return === FALSE)
{
$this->CI->output->append_output($template);
}
return $template;
}
// --------------------------------------------------------------------
/**
* Set the left/right variable delimiters
*
* @param string
* @param string
* @return void
*/
public function set_delimiters($l = '{', $r = '}')
{
$this->l_delim = $l;
$this->r_delim = $r;
}
// --------------------------------------------------------------------
/**
* Parse a single key/value
*
* @param string
* @param string
* @param string
* @return string
*/
protected function _parse_single($key, $val, $string)
{
return array($this->l_delim.$key.$this->r_delim => (string) $val);
}
// --------------------------------------------------------------------
/**
* Parse a tag pair
*
* Parses tag pairs: {some_tag} string... {/some_tag}
*
* @param string
* @param array
* @param string
* @return string
*/
protected function _parse_pair($variable, $data, $string)
{
$replace = array();
preg_match_all(
'#'.preg_quote($this->l_delim.$variable.$this->r_delim).'(.+?)'.preg_quote($this->l_delim.'/'.$variable.$this->r_delim).'#s',
$string,
$matches,
PREG_SET_ORDER
);
foreach ($matches as $match)
{
$str = '';
foreach ($data as $row)
{
$temp = array();
foreach ($row as $key => $val)
{
if (is_array($val))
{
$pair = $this->_parse_pair($key, $val, $match[1]);
if ( ! empty($pair))
{
$temp = array_merge($temp, $pair);
}
continue;
}
$temp[$this->l_delim.$key.$this->r_delim] = $val;
}
$str .= strtr($match[1], $temp);
}
$replace[$match[0]] = $str;
}
return $replace;
}
}
PK ! 4r]L L
Driver.phpnu [ load_driver($child);
}
/**
* Load driver
*
* Separate load_driver call to support explicit driver load by library or user
*
* @param string Driver name (w/o parent prefix)
* @return object Child class
*/
public function load_driver($child)
{
// Get CodeIgniter instance and subclass prefix
$prefix = config_item('subclass_prefix');
if ( ! isset($this->lib_name))
{
// Get library name without any prefix
$this->lib_name = str_replace(array('CI_', $prefix), '', get_class($this));
}
// The child will be prefixed with the parent lib
$child_name = $this->lib_name.'_'.$child;
// See if requested child is a valid driver
if ( ! in_array($child, $this->valid_drivers))
{
// The requested driver isn't valid!
$msg = 'Invalid driver requested: '.$child_name;
log_message('error', $msg);
show_error($msg);
}
// Get package paths and filename case variations to search
$CI = get_instance();
$paths = $CI->load->get_package_paths(TRUE);
// Is there an extension?
$class_name = $prefix.$child_name;
$found = class_exists($class_name, FALSE);
if ( ! $found)
{
// Check for subclass file
foreach ($paths as $path)
{
// Does the file exist?
$file = $path.'libraries/'.$this->lib_name.'/drivers/'.$prefix.$child_name.'.php';
if (file_exists($file))
{
// Yes - require base class from BASEPATH
$basepath = BASEPATH.'libraries/'.$this->lib_name.'/drivers/'.$child_name.'.php';
if ( ! file_exists($basepath))
{
$msg = 'Unable to load the requested class: CI_'.$child_name;
log_message('error', $msg);
show_error($msg);
}
// Include both sources and mark found
include_once($basepath);
include_once($file);
$found = TRUE;
break;
}
}
}
// Do we need to search for the class?
if ( ! $found)
{
// Use standard class name
$class_name = 'CI_'.$child_name;
if ( ! class_exists($class_name, FALSE))
{
// Check package paths
foreach ($paths as $path)
{
// Does the file exist?
$file = $path.'libraries/'.$this->lib_name.'/drivers/'.$child_name.'.php';
if (file_exists($file))
{
// Include source
include_once($file);
break;
}
}
}
}
// Did we finally find the class?
if ( ! class_exists($class_name, FALSE))
{
if (class_exists($child_name, FALSE))
{
$class_name = $child_name;
}
else
{
$msg = 'Unable to load the requested driver: '.$class_name;
log_message('error', $msg);
show_error($msg);
}
}
// Instantiate, decorate and add child
$obj = new $class_name();
$obj->decorate($this);
$this->$child = $obj;
return $this->$child;
}
}
// --------------------------------------------------------------------------
/**
* CodeIgniter Driver Class
*
* This class enables you to create drivers for a Library based on the Driver Library.
* It handles the drivers' access to the parent library
*
* @package CodeIgniter
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
* @link
*/
class CI_Driver {
/**
* Instance of the parent class
*
* @var object
*/
protected $_parent;
/**
* List of methods in the parent class
*
* @var array
*/
protected $_methods = array();
/**
* List of properties in the parent class
*
* @var array
*/
protected $_properties = array();
/**
* Array of methods and properties for the parent class(es)
*
* @static
* @var array
*/
protected static $_reflections = array();
/**
* Decorate
*
* Decorates the child with the parent driver lib's methods and properties
*
* @param object
* @return void
*/
public function decorate($parent)
{
$this->_parent = $parent;
// Lock down attributes to what is defined in the class
// and speed up references in magic methods
$class_name = get_class($parent);
if ( ! isset(self::$_reflections[$class_name]))
{
$r = new ReflectionObject($parent);
foreach ($r->getMethods() as $method)
{
if ($method->isPublic())
{
$this->_methods[] = $method->getName();
}
}
foreach ($r->getProperties() as $prop)
{
if ($prop->isPublic())
{
$this->_properties[] = $prop->getName();
}
}
self::$_reflections[$class_name] = array($this->_methods, $this->_properties);
}
else
{
list($this->_methods, $this->_properties) = self::$_reflections[$class_name];
}
}
// --------------------------------------------------------------------
/**
* __call magic method
*
* Handles access to the parent driver library's methods
*
* @param string
* @param array
* @return mixed
*/
public function __call($method, $args = array())
{
if (in_array($method, $this->_methods))
{
return call_user_func_array(array($this->_parent, $method), $args);
}
throw new BadMethodCallException('No such method: '.$method.'()');
}
// --------------------------------------------------------------------
/**
* __get magic method
*
* Handles reading of the parent driver library's properties
*
* @param string
* @return mixed
*/
public function __get($var)
{
if (in_array($var, $this->_properties))
{
return $this->_parent->$var;
}
}
// --------------------------------------------------------------------
/**
* __set magic method
*
* Handles writing to the parent driver library's properties
*
* @param string
* @param array
* @return mixed
*/
public function __set($var, $val)
{
if (in_array($var, $this->_properties))
{
$this->_parent->$var = $val;
}
}
}
PK ! iyY[ [ Encryption.phpnu [ array(
'cbc' => 'cbc',
'ecb' => 'ecb',
'ofb' => 'nofb',
'ofb8' => 'ofb',
'cfb' => 'ncfb',
'cfb8' => 'cfb',
'ctr' => 'ctr',
'stream' => 'stream'
),
'openssl' => array(
'cbc' => 'cbc',
'ecb' => 'ecb',
'ofb' => 'ofb',
'cfb' => 'cfb',
'cfb8' => 'cfb8',
'ctr' => 'ctr',
'stream' => '',
'xts' => 'xts'
)
);
/**
* List of supported HMAC algorithms
*
* name => digest size pairs
*
* @var array
*/
protected $_digests = array(
'sha224' => 28,
'sha256' => 32,
'sha384' => 48,
'sha512' => 64
);
/**
* mbstring.func_overload flag
*
* @var bool
*/
protected static $func_overload;
// --------------------------------------------------------------------
/**
* Class constructor
*
* @param array $params Configuration parameters
* @return void
*/
public function __construct(array $params = array())
{
$this->_drivers = array(
'mcrypt' => defined('MCRYPT_DEV_URANDOM'),
'openssl' => extension_loaded('openssl')
);
if ( ! $this->_drivers['mcrypt'] && ! $this->_drivers['openssl'])
{
show_error('Encryption: Unable to find an available encryption driver.');
}
isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload'));
$this->initialize($params);
if ( ! isset($this->_key) && self::strlen($key = config_item('encryption_key')) > 0)
{
$this->_key = $key;
}
log_message('info', 'Encryption Class Initialized');
}
// --------------------------------------------------------------------
/**
* Initialize
*
* @param array $params Configuration parameters
* @return CI_Encryption
*/
public function initialize(array $params)
{
if ( ! empty($params['driver']))
{
if (isset($this->_drivers[$params['driver']]))
{
if ($this->_drivers[$params['driver']])
{
$this->_driver = $params['driver'];
}
else
{
log_message('error', "Encryption: Driver '".$params['driver']."' is not available.");
}
}
else
{
log_message('error', "Encryption: Unknown driver '".$params['driver']."' cannot be configured.");
}
}
if (empty($this->_driver))
{
$this->_driver = ($this->_drivers['openssl'] === TRUE)
? 'openssl'
: 'mcrypt';
log_message('debug', "Encryption: Auto-configured driver '".$this->_driver."'.");
}
empty($params['cipher']) && $params['cipher'] = $this->_cipher;
empty($params['key']) OR $this->_key = $params['key'];
$this->{'_'.$this->_driver.'_initialize'}($params);
return $this;
}
// --------------------------------------------------------------------
/**
* Initialize MCrypt
*
* @param array $params Configuration parameters
* @return void
*/
protected function _mcrypt_initialize($params)
{
if ( ! empty($params['cipher']))
{
$params['cipher'] = strtolower($params['cipher']);
$this->_cipher_alias($params['cipher']);
if ( ! in_array($params['cipher'], mcrypt_list_algorithms(), TRUE))
{
log_message('error', 'Encryption: MCrypt cipher '.strtoupper($params['cipher']).' is not available.');
}
else
{
$this->_cipher = $params['cipher'];
}
}
if ( ! empty($params['mode']))
{
$params['mode'] = strtolower($params['mode']);
if ( ! isset($this->_modes['mcrypt'][$params['mode']]))
{
log_message('error', 'Encryption: MCrypt mode '.strtoupper($params['mode']).' is not available.');
}
else
{
$this->_mode = $this->_modes['mcrypt'][$params['mode']];
}
}
if (isset($this->_cipher, $this->_mode))
{
if (is_resource($this->_handle)
&& (strtolower(mcrypt_enc_get_algorithms_name($this->_handle)) !== $this->_cipher
OR strtolower(mcrypt_enc_get_modes_name($this->_handle)) !== $this->_mode)
)
{
mcrypt_module_close($this->_handle);
}
if ($this->_handle = mcrypt_module_open($this->_cipher, '', $this->_mode, ''))
{
log_message('info', 'Encryption: MCrypt cipher '.strtoupper($this->_cipher).' initialized in '.strtoupper($this->_mode).' mode.');
}
else
{
log_message('error', 'Encryption: Unable to initialize MCrypt with cipher '.strtoupper($this->_cipher).' in '.strtoupper($this->_mode).' mode.');
}
}
}
// --------------------------------------------------------------------
/**
* Initialize OpenSSL
*
* @param array $params Configuration parameters
* @return void
*/
protected function _openssl_initialize($params)
{
if ( ! empty($params['cipher']))
{
$params['cipher'] = strtolower($params['cipher']);
$this->_cipher_alias($params['cipher']);
$this->_cipher = $params['cipher'];
}
if ( ! empty($params['mode']))
{
$params['mode'] = strtolower($params['mode']);
if ( ! isset($this->_modes['openssl'][$params['mode']]))
{
log_message('error', 'Encryption: OpenSSL mode '.strtoupper($params['mode']).' is not available.');
}
else
{
$this->_mode = $this->_modes['openssl'][$params['mode']];
}
}
if (isset($this->_cipher, $this->_mode))
{
// This is mostly for the stream mode, which doesn't get suffixed in OpenSSL
$handle = empty($this->_mode)
? $this->_cipher
: $this->_cipher.'-'.$this->_mode;
if ( ! in_array($handle, openssl_get_cipher_methods(), TRUE))
{
$this->_handle = NULL;
log_message('error', 'Encryption: Unable to initialize OpenSSL with method '.strtoupper($handle).'.');
}
else
{
$this->_handle = $handle;
log_message('info', 'Encryption: OpenSSL initialized with method '.strtoupper($handle).'.');
}
}
}
// --------------------------------------------------------------------
/**
* Create a random key
*
* @param int $length Output length
* @return string
*/
public function create_key($length)
{
if (function_exists('random_bytes'))
{
try
{
return random_bytes((int) $length);
}
catch (Exception $e)
{
log_message('error', $e->getMessage());
return FALSE;
}
}
elseif (defined('MCRYPT_DEV_URANDOM'))
{
return mcrypt_create_iv($length, MCRYPT_DEV_URANDOM);
}
$is_secure = NULL;
$key = openssl_random_pseudo_bytes($length, $is_secure);
return ($is_secure === TRUE)
? $key
: FALSE;
}
// --------------------------------------------------------------------
/**
* Encrypt
*
* @param string $data Input data
* @param array $params Input parameters
* @return string
*/
public function encrypt($data, array $params = NULL)
{
if (($params = $this->_get_params($params)) === FALSE)
{
return FALSE;
}
isset($params['key']) OR $params['key'] = $this->hkdf($this->_key, 'sha512', NULL, self::strlen($this->_key), 'encryption');
if (($data = $this->{'_'.$this->_driver.'_encrypt'}($data, $params)) === FALSE)
{
return FALSE;
}
$params['base64'] && $data = base64_encode($data);
if (isset($params['hmac_digest']))
{
isset($params['hmac_key']) OR $params['hmac_key'] = $this->hkdf($this->_key, 'sha512', NULL, NULL, 'authentication');
return hash_hmac($params['hmac_digest'], $data, $params['hmac_key'], ! $params['base64']).$data;
}
return $data;
}
// --------------------------------------------------------------------
/**
* Encrypt via MCrypt
*
* @param string $data Input data
* @param array $params Input parameters
* @return string
*/
protected function _mcrypt_encrypt($data, $params)
{
if ( ! is_resource($params['handle']))
{
return FALSE;
}
// The greater-than-1 comparison is mostly a work-around for a bug,
// where 1 is returned for ARCFour instead of 0.
$iv = (($iv_size = mcrypt_enc_get_iv_size($params['handle'])) > 1)
? $this->create_key($iv_size)
: NULL;
if (mcrypt_generic_init($params['handle'], $params['key'], $iv) < 0)
{
if ($params['handle'] !== $this->_handle)
{
mcrypt_module_close($params['handle']);
}
return FALSE;
}
// Use PKCS#7 padding in order to ensure compatibility with OpenSSL
// and other implementations outside of PHP.
if (in_array(strtolower(mcrypt_enc_get_modes_name($params['handle'])), array('cbc', 'ecb'), TRUE))
{
$block_size = mcrypt_enc_get_block_size($params['handle']);
$pad = $block_size - (self::strlen($data) % $block_size);
$data .= str_repeat(chr($pad), $pad);
}
// Work-around for yet another strange behavior in MCrypt.
//
// When encrypting in ECB mode, the IV is ignored. Yet
// mcrypt_enc_get_iv_size() returns a value larger than 0
// even if ECB is used AND mcrypt_generic_init() complains
// if you don't pass an IV with length equal to the said
// return value.
//
// This probably would've been fine (even though still wasteful),
// but OpenSSL isn't that dumb and we need to make the process
// portable, so ...
$data = (mcrypt_enc_get_modes_name($params['handle']) !== 'ECB')
? $iv.mcrypt_generic($params['handle'], $data)
: mcrypt_generic($params['handle'], $data);
mcrypt_generic_deinit($params['handle']);
if ($params['handle'] !== $this->_handle)
{
mcrypt_module_close($params['handle']);
}
return $data;
}
// --------------------------------------------------------------------
/**
* Encrypt via OpenSSL
*
* @param string $data Input data
* @param array $params Input parameters
* @return string
*/
protected function _openssl_encrypt($data, $params)
{
if (empty($params['handle']))
{
return FALSE;
}
$iv = ($iv_size = openssl_cipher_iv_length($params['handle']))
? $this->create_key($iv_size)
: NULL;
$data = openssl_encrypt(
$data,
$params['handle'],
$params['key'],
1, // DO NOT TOUCH!
$iv
);
if ($data === FALSE)
{
return FALSE;
}
return $iv.$data;
}
// --------------------------------------------------------------------
/**
* Decrypt
*
* @param string $data Encrypted data
* @param array $params Input parameters
* @return string
*/
public function decrypt($data, array $params = NULL)
{
if (($params = $this->_get_params($params)) === FALSE)
{
return FALSE;
}
if (isset($params['hmac_digest']))
{
// This might look illogical, but it is done during encryption as well ...
// The 'base64' value is effectively an inverted "raw data" parameter
$digest_size = ($params['base64'])
? $this->_digests[$params['hmac_digest']] * 2
: $this->_digests[$params['hmac_digest']];
if (self::strlen($data) <= $digest_size)
{
return FALSE;
}
$hmac_input = self::substr($data, 0, $digest_size);
$data = self::substr($data, $digest_size);
isset($params['hmac_key']) OR $params['hmac_key'] = $this->hkdf($this->_key, 'sha512', NULL, NULL, 'authentication');
$hmac_check = hash_hmac($params['hmac_digest'], $data, $params['hmac_key'], ! $params['base64']);
// Time-attack-safe comparison
$diff = 0;
for ($i = 0; $i < $digest_size; $i++)
{
$diff |= ord($hmac_input[$i]) ^ ord($hmac_check[$i]);
}
if ($diff !== 0)
{
return FALSE;
}
}
if ($params['base64'])
{
$data = base64_decode($data);
}
isset($params['key']) OR $params['key'] = $this->hkdf($this->_key, 'sha512', NULL, self::strlen($this->_key), 'encryption');
return $this->{'_'.$this->_driver.'_decrypt'}($data, $params);
}
// --------------------------------------------------------------------
/**
* Decrypt via MCrypt
*
* @param string $data Encrypted data
* @param array $params Input parameters
* @return string
*/
protected function _mcrypt_decrypt($data, $params)
{
if ( ! is_resource($params['handle']))
{
return FALSE;
}
// The greater-than-1 comparison is mostly a work-around for a bug,
// where 1 is returned for ARCFour instead of 0.
if (($iv_size = mcrypt_enc_get_iv_size($params['handle'])) > 1)
{
if (mcrypt_enc_get_modes_name($params['handle']) !== 'ECB')
{
$iv = self::substr($data, 0, $iv_size);
$data = self::substr($data, $iv_size);
}
else
{
// MCrypt is dumb and this is ignored, only size matters
$iv = str_repeat("\x0", $iv_size);
}
}
else
{
$iv = NULL;
}
if (mcrypt_generic_init($params['handle'], $params['key'], $iv) < 0)
{
if ($params['handle'] !== $this->_handle)
{
mcrypt_module_close($params['handle']);
}
return FALSE;
}
$data = mdecrypt_generic($params['handle'], $data);
// Remove PKCS#7 padding, if necessary
if (in_array(strtolower(mcrypt_enc_get_modes_name($params['handle'])), array('cbc', 'ecb'), TRUE))
{
$data = self::substr($data, 0, -ord($data[self::strlen($data)-1]));
}
mcrypt_generic_deinit($params['handle']);
if ($params['handle'] !== $this->_handle)
{
mcrypt_module_close($params['handle']);
}
return $data;
}
// --------------------------------------------------------------------
/**
* Decrypt via OpenSSL
*
* @param string $data Encrypted data
* @param array $params Input parameters
* @return string
*/
protected function _openssl_decrypt($data, $params)
{
if ($iv_size = openssl_cipher_iv_length($params['handle']))
{
$iv = self::substr($data, 0, $iv_size);
$data = self::substr($data, $iv_size);
}
else
{
$iv = NULL;
}
return empty($params['handle'])
? FALSE
: openssl_decrypt(
$data,
$params['handle'],
$params['key'],
1, // DO NOT TOUCH!
$iv
);
}
// --------------------------------------------------------------------
/**
* Get params
*
* @param array $params Input parameters
* @return array
*/
protected function _get_params($params)
{
if (empty($params))
{
return isset($this->_cipher, $this->_mode, $this->_key, $this->_handle)
? array(
'handle' => $this->_handle,
'cipher' => $this->_cipher,
'mode' => $this->_mode,
'key' => NULL,
'base64' => TRUE,
'hmac_digest' => 'sha512',
'hmac_key' => NULL
)
: FALSE;
}
elseif ( ! isset($params['cipher'], $params['mode'], $params['key']))
{
return FALSE;
}
if (isset($params['mode']))
{
$params['mode'] = strtolower($params['mode']);
if ( ! isset($this->_modes[$this->_driver][$params['mode']]))
{
return FALSE;
}
$params['mode'] = $this->_modes[$this->_driver][$params['mode']];
}
if (isset($params['hmac']) && $params['hmac'] === FALSE)
{
$params['hmac_digest'] = $params['hmac_key'] = NULL;
}
else
{
if ( ! isset($params['hmac_key']))
{
return FALSE;
}
elseif (isset($params['hmac_digest']))
{
$params['hmac_digest'] = strtolower($params['hmac_digest']);
if ( ! isset($this->_digests[$params['hmac_digest']]))
{
return FALSE;
}
}
else
{
$params['hmac_digest'] = 'sha512';
}
}
$params = array(
'handle' => NULL,
'cipher' => $params['cipher'],
'mode' => $params['mode'],
'key' => $params['key'],
'base64' => isset($params['raw_data']) ? ! $params['raw_data'] : FALSE,
'hmac_digest' => $params['hmac_digest'],
'hmac_key' => $params['hmac_key']
);
$this->_cipher_alias($params['cipher']);
$params['handle'] = ($params['cipher'] !== $this->_cipher OR $params['mode'] !== $this->_mode)
? $this->{'_'.$this->_driver.'_get_handle'}($params['cipher'], $params['mode'])
: $this->_handle;
return $params;
}
// --------------------------------------------------------------------
/**
* Get MCrypt handle
*
* @param string $cipher Cipher name
* @param string $mode Encryption mode
* @return resource
*/
protected function _mcrypt_get_handle($cipher, $mode)
{
return mcrypt_module_open($cipher, '', $mode, '');
}
// --------------------------------------------------------------------
/**
* Get OpenSSL handle
*
* @param string $cipher Cipher name
* @param string $mode Encryption mode
* @return string
*/
protected function _openssl_get_handle($cipher, $mode)
{
// OpenSSL methods aren't suffixed with '-stream' for this mode
return ($mode === 'stream')
? $cipher
: $cipher.'-'.$mode;
}
// --------------------------------------------------------------------
/**
* Cipher alias
*
* Tries to translate cipher names between MCrypt and OpenSSL's "dialects".
*
* @param string $cipher Cipher name
* @return void
*/
protected function _cipher_alias(&$cipher)
{
static $dictionary;
if (empty($dictionary))
{
$dictionary = array(
'mcrypt' => array(
'aes-128' => 'rijndael-128',
'aes-192' => 'rijndael-128',
'aes-256' => 'rijndael-128',
'des3-ede3' => 'tripledes',
'bf' => 'blowfish',
'cast5' => 'cast-128',
'rc4' => 'arcfour',
'rc4-40' => 'arcfour'
),
'openssl' => array(
'rijndael-128' => 'aes-128',
'tripledes' => 'des-ede3',
'blowfish' => 'bf',
'cast-128' => 'cast5',
'arcfour' => 'rc4-40',
'rc4' => 'rc4-40'
)
);
// Notes:
//
// - Rijndael-128 is, at the same time all three of AES-128,
// AES-192 and AES-256. The only difference between them is
// the key size. Rijndael-192, Rijndael-256 on the other hand
// also have different block sizes and are NOT AES-compatible.
//
// - Blowfish is said to be supporting key sizes between
// 4 and 56 bytes, but it appears that between MCrypt and
// OpenSSL, only those of 16 and more bytes are compatible.
// Also, don't know what MCrypt's 'blowfish-compat' is.
//
// - CAST-128/CAST5 produces a longer cipher when encrypted via
// OpenSSL, but (strangely enough) can be decrypted by either
// extension anyway.
// Also, it appears that OpenSSL uses 16 rounds regardless of
// the key size, while RFC2144 says that for key sizes lower
// than 11 bytes, only 12 rounds should be used. This makes
// it portable only with keys of between 11 and 16 bytes.
//
// - RC4 (ARCFour) has a strange implementation under OpenSSL.
// Its 'rc4-40' cipher method seems to work flawlessly, yet
// there's another one, 'rc4' that only works with a 16-byte key.
//
// - DES is compatible, but doesn't need an alias.
//
// Other seemingly matching ciphers between MCrypt, OpenSSL:
//
// - RC2 is NOT compatible and only an obscure forum post
// confirms that it is MCrypt's fault.
}
if (isset($dictionary[$this->_driver][$cipher]))
{
$cipher = $dictionary[$this->_driver][$cipher];
}
}
// --------------------------------------------------------------------
/**
* HKDF
*
* @link https://tools.ietf.org/rfc/rfc5869.txt
* @param $key Input key
* @param $digest A SHA-2 hashing algorithm
* @param $salt Optional salt
* @param $length Output length (defaults to the selected digest size)
* @param $info Optional context/application-specific info
* @return string A pseudo-random key
*/
public function hkdf($key, $digest = 'sha512', $salt = NULL, $length = NULL, $info = '')
{
if ( ! isset($this->_digests[$digest]))
{
return FALSE;
}
if (empty($length) OR ! is_int($length))
{
$length = $this->_digests[$digest];
}
elseif ($length > (255 * $this->_digests[$digest]))
{
return FALSE;
}
self::strlen($salt) OR $salt = str_repeat("\0", $this->_digests[$digest]);
$prk = hash_hmac($digest, $key, $salt, TRUE);
$key = '';
for ($key_block = '', $block_index = 1; self::strlen($key) < $length; $block_index++)
{
$key_block = hash_hmac($digest, $key_block.$info.chr($block_index), $prk, TRUE);
$key .= $key_block;
}
return self::substr($key, 0, $length);
}
// --------------------------------------------------------------------
/**
* __get() magic
*
* @param string $key Property name
* @return mixed
*/
public function __get($key)
{
// Because aliases
if ($key === 'mode')
{
return array_search($this->_mode, $this->_modes[$this->_driver], TRUE);
}
elseif (in_array($key, array('cipher', 'driver', 'drivers', 'digests'), TRUE))
{
return $this->{'_'.$key};
}
return NULL;
}
// --------------------------------------------------------------------
/**
* Byte-safe strlen()
*
* @param string $str
* @return int
*/
protected static function strlen($str)
{
return (self::$func_overload)
? mb_strlen($str, '8bit')
: strlen($str);
}
// --------------------------------------------------------------------
/**
* Byte-safe substr()
*
* @param string $str
* @param int $start
* @param int $length
* @return string
*/
protected static function substr($str, $start, $length = NULL)
{
if (self::$func_overload)
{
// mb_substr($str, $start, null, '8bit') returns an empty
// string on PHP 5.3
isset($length) OR $length = ($start >= 0 ? self::strlen($str) - $start : -$start);
return mb_substr($str, $start, $length, '8bit');
}
return isset($length)
? substr($str, $start, $length)
: substr($str, $start);
}
}
PK ! 1ftڒ ڒ Form_validation.phpnu [ ';
/**
* End tag for error wrapping
*
* @var string
*/
protected $_error_suffix = '
';
/**
* Custom error message
*
* @var string
*/
protected $error_string = '';
/**
* Whether the form data has been validated as safe
*
* @var bool
*/
protected $_safe_form_data = FALSE;
/**
* Custom data to validate
*
* @var array
*/
public $validation_data = array();
/**
* Initialize Form_Validation class
*
* @param array $rules
* @return void
*/
public function __construct($rules = array())
{
$this->CI =& get_instance();
// applies delimiters set in config file.
if (isset($rules['error_prefix']))
{
$this->_error_prefix = $rules['error_prefix'];
unset($rules['error_prefix']);
}
if (isset($rules['error_suffix']))
{
$this->_error_suffix = $rules['error_suffix'];
unset($rules['error_suffix']);
}
// Validation rules can be stored in a config file.
$this->_config_rules = $rules;
// Automatically load the form helper
$this->CI->load->helper('form');
log_message('info', 'Form Validation Class Initialized');
}
// --------------------------------------------------------------------
/**
* Set Rules
*
* This function takes an array of field names and validation
* rules as input, any custom error messages, validates the info,
* and stores it
*
* @param mixed $field
* @param string $label
* @param mixed $rules
* @param array $errors
* @return CI_Form_validation
*/
public function set_rules($field, $label = '', $rules = array(), $errors = array())
{
// No reason to set rules if we have no POST data
// or a validation array has not been specified
if ($this->CI->input->method() !== 'post' && empty($this->validation_data))
{
return $this;
}
// If an array was passed via the first parameter instead of individual string
// values we cycle through it and recursively call this function.
if (is_array($field))
{
foreach ($field as $row)
{
// Houston, we have a problem...
if ( ! isset($row['field'], $row['rules']))
{
continue;
}
// If the field label wasn't passed we use the field name
$label = isset($row['label']) ? $row['label'] : $row['field'];
// Add the custom error message array
$errors = (isset($row['errors']) && is_array($row['errors'])) ? $row['errors'] : array();
// Here we go!
$this->set_rules($row['field'], $label, $row['rules'], $errors);
}
return $this;
}
// No fields or no rules? Nothing to do...
if ( ! is_string($field) OR $field === '' OR empty($rules))
{
return $this;
}
elseif ( ! is_array($rules))
{
// BC: Convert pipe-separated rules string to an array
if ( ! is_string($rules))
{
return $this;
}
$rules = preg_split('/\|(?![^\[]*\])/', $rules);
}
// If the field label wasn't passed we use the field name
$label = ($label === '') ? $field : $label;
$indexes = array();
// Is the field name an array? If it is an array, we break it apart
// into its components so that we can fetch the corresponding POST data later
if (($is_array = (bool) preg_match_all('/\[(.*?)\]/', $field, $matches)) === TRUE)
{
sscanf($field, '%[^[][', $indexes[0]);
for ($i = 0, $c = count($matches[0]); $i < $c; $i++)
{
if ($matches[1][$i] !== '')
{
$indexes[] = $matches[1][$i];
}
}
}
// Build our master array
$this->_field_data[$field] = array(
'field' => $field,
'label' => $label,
'rules' => $rules,
'errors' => $errors,
'is_array' => $is_array,
'keys' => $indexes,
'postdata' => NULL,
'error' => ''
);
return $this;
}
// --------------------------------------------------------------------
/**
* By default, form validation uses the $_POST array to validate
*
* If an array is set through this method, then this array will
* be used instead of the $_POST array
*
* Note that if you are validating multiple arrays, then the
* reset_validation() function should be called after validating
* each array due to the limitations of CI's singleton
*
* @param array $data
* @return CI_Form_validation
*/
public function set_data(array $data)
{
if ( ! empty($data))
{
$this->validation_data = $data;
}
return $this;
}
// --------------------------------------------------------------------
/**
* Set Error Message
*
* Lets users set their own error messages on the fly. Note:
* The key name has to match the function name that it corresponds to.
*
* @param array
* @param string
* @return CI_Form_validation
*/
public function set_message($lang, $val = '')
{
if ( ! is_array($lang))
{
$lang = array($lang => $val);
}
$this->_error_messages = array_merge($this->_error_messages, $lang);
return $this;
}
// --------------------------------------------------------------------
/**
* Set The Error Delimiter
*
* Permits a prefix/suffix to be added to each error message
*
* @param string
* @param string
* @return CI_Form_validation
*/
public function set_error_delimiters($prefix = '', $suffix = '
')
{
$this->_error_prefix = $prefix;
$this->_error_suffix = $suffix;
return $this;
}
// --------------------------------------------------------------------
/**
* Get Error Message
*
* Gets the error message associated with a particular field
*
* @param string $field Field name
* @param string $prefix HTML start tag
* @param string $suffix HTML end tag
* @return string
*/
public function error($field, $prefix = '', $suffix = '')
{
if (empty($this->_field_data[$field]['error']))
{
return '';
}
if ($prefix === '')
{
$prefix = $this->_error_prefix;
}
if ($suffix === '')
{
$suffix = $this->_error_suffix;
}
return $prefix.$this->_field_data[$field]['error'].$suffix;
}
// --------------------------------------------------------------------
/**
* Get Array of Error Messages
*
* Returns the error messages as an array
*
* @return array
*/
public function error_array()
{
return $this->_error_array;
}
// --------------------------------------------------------------------
/**
* Error String
*
* Returns the error messages as a string, wrapped in the error delimiters
*
* @param string
* @param string
* @return string
*/
public function error_string($prefix = '', $suffix = '')
{
// No errors, validation passes!
if (count($this->_error_array) === 0)
{
return '';
}
if ($prefix === '')
{
$prefix = $this->_error_prefix;
}
if ($suffix === '')
{
$suffix = $this->_error_suffix;
}
// Generate the error string
$str = '';
foreach ($this->_error_array as $val)
{
if ($val !== '')
{
$str .= $prefix.$val.$suffix."\n";
}
}
return $str;
}
// --------------------------------------------------------------------
/**
* Run the Validator
*
* This function does all the work.
*
* @param string $group
* @return bool
*/
public function run($group = '')
{
$validation_array = empty($this->validation_data)
? $_POST
: $this->validation_data;
// Does the _field_data array containing the validation rules exist?
// If not, we look to see if they were assigned via a config file
if (count($this->_field_data) === 0)
{
// No validation rules? We're done...
if (count($this->_config_rules) === 0)
{
return FALSE;
}
if (empty($group))
{
// Is there a validation rule for the particular URI being accessed?
$group = trim($this->CI->uri->ruri_string(), '/');
isset($this->_config_rules[$group]) OR $group = $this->CI->router->class.'/'.$this->CI->router->method;
}
$this->set_rules(isset($this->_config_rules[$group]) ? $this->_config_rules[$group] : $this->_config_rules);
// Were we able to set the rules correctly?
if (count($this->_field_data) === 0)
{
log_message('debug', 'Unable to find validation rules');
return FALSE;
}
}
// Load the language file containing error messages
$this->CI->lang->load('form_validation');
// Cycle through the rules for each field and match the corresponding $validation_data item
foreach ($this->_field_data as $field => &$row)
{
// Fetch the data from the validation_data array item and cache it in the _field_data array.
// Depending on whether the field name is an array or a string will determine where we get it from.
if ($row['is_array'] === TRUE)
{
$this->_field_data[$field]['postdata'] = $this->_reduce_array($validation_array, $row['keys']);
}
elseif (isset($validation_array[$field]))
{
$this->_field_data[$field]['postdata'] = $validation_array[$field];
}
}
// Execute validation rules
// Note: A second foreach (for now) is required in order to avoid false-positives
// for rules like 'matches', which correlate to other validation fields.
foreach ($this->_field_data as $field => &$row)
{
// Don't try to validate if we have no rules set
if (empty($row['rules']))
{
continue;
}
$this->_execute($row, $row['rules'], $row['postdata']);
}
// Did we end up with any errors?
$total_errors = count($this->_error_array);
if ($total_errors > 0)
{
$this->_safe_form_data = TRUE;
}
// Now we need to re-set the POST data with the new, processed data
empty($this->validation_data) && $this->_reset_post_array();
return ($total_errors === 0);
}
// --------------------------------------------------------------------
/**
* Prepare rules
*
* Re-orders the provided rules in order of importance, so that
* they can easily be executed later without weird checks ...
*
* "Callbacks" are given the highest priority (always called),
* followed by 'required' (called if callbacks didn't fail),
* and then every next rule depends on the previous one passing.
*
* @param array $rules
* @return array
*/
protected function _prepare_rules($rules)
{
$new_rules = array();
$callbacks = array();
foreach ($rules as &$rule)
{
// Let 'required' always be the first (non-callback) rule
if ($rule === 'required')
{
array_unshift($new_rules, 'required');
}
// 'isset' is a kind of a weird alias for 'required' ...
elseif ($rule === 'isset' && (empty($new_rules) OR $new_rules[0] !== 'required'))
{
array_unshift($new_rules, 'isset');
}
// The old/classic 'callback_'-prefixed rules
elseif (is_string($rule) && strncmp('callback_', $rule, 9) === 0)
{
$callbacks[] = $rule;
}
// Proper callables
elseif (is_callable($rule))
{
$callbacks[] = $rule;
}
// "Named" callables; i.e. array('name' => $callable)
elseif (is_array($rule) && isset($rule[0], $rule[1]) && is_callable($rule[1]))
{
$callbacks[] = $rule;
}
// Everything else goes at the end of the queue
else
{
$new_rules[] = $rule;
}
}
return array_merge($callbacks, $new_rules);
}
// --------------------------------------------------------------------
/**
* Traverse a multidimensional $_POST array index until the data is found
*
* @param array
* @param array
* @param int
* @return mixed
*/
protected function _reduce_array($array, $keys, $i = 0)
{
if (is_array($array) && isset($keys[$i]))
{
return isset($array[$keys[$i]]) ? $this->_reduce_array($array[$keys[$i]], $keys, ($i+1)) : NULL;
}
// NULL must be returned for empty fields
return ($array === '') ? NULL : $array;
}
// --------------------------------------------------------------------
/**
* Re-populate the _POST array with our finalized and processed data
*
* @return void
*/
protected function _reset_post_array()
{
foreach ($this->_field_data as $field => $row)
{
if ($row['postdata'] !== NULL)
{
if ($row['is_array'] === FALSE)
{
isset($_POST[$field]) && $_POST[$field] = is_array($row['postdata']) ? NULL : $row['postdata'];
}
else
{
// start with a reference
$post_ref =& $_POST;
// before we assign values, make a reference to the right POST key
if (count($row['keys']) === 1)
{
$post_ref =& $post_ref[current($row['keys'])];
}
else
{
foreach ($row['keys'] as $val)
{
$post_ref =& $post_ref[$val];
}
}
$post_ref = $row['postdata'];
}
}
}
}
// --------------------------------------------------------------------
/**
* Executes the Validation routines
*
* @param array
* @param array
* @param mixed
* @param int
* @return mixed
*/
protected function _execute($row, $rules, $postdata = NULL, $cycles = 0)
{
// If the $_POST data is an array we will run a recursive call
//
// Note: We MUST check if the array is empty or not!
// Otherwise empty arrays will always pass validation.
if (is_array($postdata) && ! empty($postdata))
{
foreach ($postdata as $key => $val)
{
$this->_execute($row, $rules, $val, $key);
}
return;
}
$rules = $this->_prepare_rules($rules);
foreach ($rules as $rule)
{
$_in_array = FALSE;
// We set the $postdata variable with the current data in our master array so that
// each cycle of the loop is dealing with the processed data from the last cycle
if ($row['is_array'] === TRUE && is_array($this->_field_data[$row['field']]['postdata']))
{
// We shouldn't need this safety, but just in case there isn't an array index
// associated with this cycle we'll bail out
if ( ! isset($this->_field_data[$row['field']]['postdata'][$cycles]))
{
continue;
}
$postdata = $this->_field_data[$row['field']]['postdata'][$cycles];
$_in_array = TRUE;
}
else
{
// If we get an array field, but it's not expected - then it is most likely
// somebody messing with the form on the client side, so we'll just consider
// it an empty field
$postdata = is_array($this->_field_data[$row['field']]['postdata'])
? NULL
: $this->_field_data[$row['field']]['postdata'];
}
// Is the rule a callback?
$callback = $callable = FALSE;
if (is_string($rule))
{
if (strpos($rule, 'callback_') === 0)
{
$rule = substr($rule, 9);
$callback = TRUE;
}
}
elseif (is_callable($rule))
{
$callable = TRUE;
}
elseif (is_array($rule) && isset($rule[0], $rule[1]) && is_callable($rule[1]))
{
// We have a "named" callable, so save the name
$callable = $rule[0];
$rule = $rule[1];
}
// Strip the parameter (if exists) from the rule
// Rules can contain a parameter: max_length[5]
$param = FALSE;
if ( ! $callable && preg_match('/(.*?)\[(.*)\]/', $rule, $match))
{
$rule = $match[1];
$param = $match[2];
}
// Ignore empty, non-required inputs with a few exceptions ...
if (
($postdata === NULL OR $postdata === '')
&& $callback === FALSE
&& $callable === FALSE
&& ! in_array($rule, array('required', 'isset', 'matches'), TRUE)
)
{
continue;
}
// Call the function that corresponds to the rule
if ($callback OR $callable !== FALSE)
{
if ($callback)
{
if ( ! method_exists($this->CI, $rule))
{
log_message('debug', 'Unable to find callback validation rule: '.$rule);
$result = FALSE;
}
else
{
// Run the function and grab the result
$result = $this->CI->$rule($postdata, $param);
}
}
else
{
$result = is_array($rule)
? $rule[0]->{$rule[1]}($postdata)
: $rule($postdata);
// Is $callable set to a rule name?
if ($callable !== FALSE)
{
$rule = $callable;
}
}
// Re-assign the result to the master data array
if ($_in_array === TRUE)
{
$this->_field_data[$row['field']]['postdata'][$cycles] = is_bool($result) ? $postdata : $result;
}
else
{
$this->_field_data[$row['field']]['postdata'] = is_bool($result) ? $postdata : $result;
}
}
elseif ( ! method_exists($this, $rule))
{
// If our own wrapper function doesn't exist we see if a native PHP function does.
// Users can use any native PHP function call that has one param.
if (function_exists($rule))
{
// Native PHP functions issue warnings if you pass them more parameters than they use
$result = ($param !== FALSE) ? $rule($postdata, $param) : $rule($postdata);
if ($_in_array === TRUE)
{
$this->_field_data[$row['field']]['postdata'][$cycles] = is_bool($result) ? $postdata : $result;
}
else
{
$this->_field_data[$row['field']]['postdata'] = is_bool($result) ? $postdata : $result;
}
}
else
{
log_message('debug', 'Unable to find validation rule: '.$rule);
$result = FALSE;
}
}
else
{
$result = $this->$rule($postdata, $param);
if ($_in_array === TRUE)
{
$this->_field_data[$row['field']]['postdata'][$cycles] = is_bool($result) ? $postdata : $result;
}
else
{
$this->_field_data[$row['field']]['postdata'] = is_bool($result) ? $postdata : $result;
}
}
// Did the rule test negatively? If so, grab the error.
if ($result === FALSE)
{
// Callable rules might not have named error messages
if ( ! is_string($rule))
{
$line = $this->CI->lang->line('form_validation_error_message_not_set').'(Anonymous function)';
}
else
{
$line = $this->_get_error_message($rule, $row['field']);
}
// Is the parameter we are inserting into the error message the name
// of another field? If so we need to grab its "field label"
if (isset($this->_field_data[$param], $this->_field_data[$param]['label']))
{
$param = $this->_translate_fieldname($this->_field_data[$param]['label']);
}
// Build the error message
$message = $this->_build_error_msg($line, $this->_translate_fieldname($row['label']), $param);
// Save the error message
$this->_field_data[$row['field']]['error'] = $message;
if ( ! isset($this->_error_array[$row['field']]))
{
$this->_error_array[$row['field']] = $message;
}
return;
}
}
}
// --------------------------------------------------------------------
/**
* Get the error message for the rule
*
* @param string $rule The rule name
* @param string $field The field name
* @return string
*/
protected function _get_error_message($rule, $field)
{
// check if a custom message is defined through validation config row.
if (isset($this->_field_data[$field]['errors'][$rule]))
{
return $this->_field_data[$field]['errors'][$rule];
}
// check if a custom message has been set using the set_message() function
elseif (isset($this->_error_messages[$rule]))
{
return $this->_error_messages[$rule];
}
elseif (FALSE !== ($line = $this->CI->lang->line('form_validation_'.$rule)))
{
return $line;
}
// DEPRECATED support for non-prefixed keys, lang file again
elseif (FALSE !== ($line = $this->CI->lang->line($rule, FALSE)))
{
return $line;
}
return $this->CI->lang->line('form_validation_error_message_not_set').'('.$rule.')';
}
// --------------------------------------------------------------------
/**
* Translate a field name
*
* @param string the field name
* @return string
*/
protected function _translate_fieldname($fieldname)
{
// Do we need to translate the field name? We look for the prefix 'lang:' to determine this
// If we find one, but there's no translation for the string - just return it
if (sscanf($fieldname, 'lang:%s', $line) === 1 && FALSE === ($fieldname = $this->CI->lang->line($line, FALSE)))
{
return $line;
}
return $fieldname;
}
// --------------------------------------------------------------------
/**
* Build an error message using the field and param.
*
* @param string The error message line
* @param string A field's human name
* @param mixed A rule's optional parameter
* @return string
*/
protected function _build_error_msg($line, $field = '', $param = '')
{
// Check for %s in the string for legacy support.
if (strpos($line, '%s') !== FALSE)
{
return sprintf($line, $field, $param);
}
return str_replace(array('{field}', '{param}'), array($field, $param), $line);
}
// --------------------------------------------------------------------
/**
* Checks if the rule is present within the validator
*
* Permits you to check if a rule is present within the validator
*
* @param string the field name
* @return bool
*/
public function has_rule($field)
{
return isset($this->_field_data[$field]);
}
// --------------------------------------------------------------------
/**
* Get the value from a form
*
* Permits you to repopulate a form field with the value it was submitted
* with, or, if that value doesn't exist, with the default
*
* @param string the field name
* @param string
* @return string
*/
public function set_value($field = '', $default = '')
{
if ( ! isset($this->_field_data[$field], $this->_field_data[$field]['postdata']))
{
return $default;
}
// If the data is an array output them one at a time.
// E.g: form_input('name[]', set_value('name[]');
if (is_array($this->_field_data[$field]['postdata']))
{
return array_shift($this->_field_data[$field]['postdata']);
}
return $this->_field_data[$field]['postdata'];
}
// --------------------------------------------------------------------
/**
* Set Select
*
* Enables pull-down lists to be set to the value the user
* selected in the event of an error
*
* @param string
* @param string
* @param bool
* @return string
*/
public function set_select($field = '', $value = '', $default = FALSE)
{
if ( ! isset($this->_field_data[$field], $this->_field_data[$field]['postdata']))
{
return ($default === TRUE && count($this->_field_data) === 0) ? ' selected="selected"' : '';
}
$field = $this->_field_data[$field]['postdata'];
$value = (string) $value;
if (is_array($field))
{
// Note: in_array('', array(0)) returns TRUE, do not use it
foreach ($field as &$v)
{
if ($value === $v)
{
return ' selected="selected"';
}
}
return '';
}
elseif (($field === '' OR $value === '') OR ($field !== $value))
{
return '';
}
return ' selected="selected"';
}
// --------------------------------------------------------------------
/**
* Set Radio
*
* Enables radio buttons to be set to the value the user
* selected in the event of an error
*
* @param string
* @param string
* @param bool
* @return string
*/
public function set_radio($field = '', $value = '', $default = FALSE)
{
if ( ! isset($this->_field_data[$field], $this->_field_data[$field]['postdata']))
{
return ($default === TRUE && count($this->_field_data) === 0) ? ' checked="checked"' : '';
}
$field = $this->_field_data[$field]['postdata'];
$value = (string) $value;
if (is_array($field))
{
// Note: in_array('', array(0)) returns TRUE, do not use it
foreach ($field as &$v)
{
if ($value === $v)
{
return ' checked="checked"';
}
}
return '';
}
elseif (($field === '' OR $value === '') OR ($field !== $value))
{
return '';
}
return ' checked="checked"';
}
// --------------------------------------------------------------------
/**
* Set Checkbox
*
* Enables checkboxes to be set to the value the user
* selected in the event of an error
*
* @param string
* @param string
* @param bool
* @return string
*/
public function set_checkbox($field = '', $value = '', $default = FALSE)
{
// Logic is exactly the same as for radio fields
return $this->set_radio($field, $value, $default);
}
// --------------------------------------------------------------------
/**
* Required
*
* @param string
* @return bool
*/
public function required($str)
{
return is_array($str)
? (empty($str) === FALSE)
: (trim($str) !== '');
}
// --------------------------------------------------------------------
/**
* Performs a Regular Expression match test.
*
* @param string
* @param string regex
* @return bool
*/
public function regex_match($str, $regex)
{
return (bool) preg_match($regex, $str);
}
// --------------------------------------------------------------------
/**
* Match one field to another
*
* @param string $str string to compare against
* @param string $field
* @return bool
*/
public function matches($str, $field)
{
return isset($this->_field_data[$field], $this->_field_data[$field]['postdata'])
? ($str === $this->_field_data[$field]['postdata'])
: FALSE;
}
// --------------------------------------------------------------------
/**
* Differs from another field
*
* @param string
* @param string field
* @return bool
*/
public function differs($str, $field)
{
return ! (isset($this->_field_data[$field]) && $this->_field_data[$field]['postdata'] === $str);
}
// --------------------------------------------------------------------
/**
* Is Unique
*
* Check if the input value doesn't already exist
* in the specified database field.
*
* @param string $str
* @param string $field
* @return bool
*/
public function is_unique($str, $field)
{
sscanf($field, '%[^.].%[^.]', $table, $field);
return isset($this->CI->db)
? ($this->CI->db->limit(1)->get_where($table, array($field => $str))->num_rows() === 0)
: FALSE;
}
// --------------------------------------------------------------------
/**
* Minimum Length
*
* @param string
* @param string
* @return bool
*/
public function min_length($str, $val)
{
if ( ! is_numeric($val))
{
return FALSE;
}
return ($val <= mb_strlen($str));
}
// --------------------------------------------------------------------
/**
* Max Length
*
* @param string
* @param string
* @return bool
*/
public function max_length($str, $val)
{
if ( ! is_numeric($val))
{
return FALSE;
}
return ($val >= mb_strlen($str));
}
// --------------------------------------------------------------------
/**
* Exact Length
*
* @param string
* @param string
* @return bool
*/
public function exact_length($str, $val)
{
if ( ! is_numeric($val))
{
return FALSE;
}
return (mb_strlen($str) === (int) $val);
}
// --------------------------------------------------------------------
/**
* Valid URL
*
* @param string $str
* @return bool
*/
public function valid_url($str)
{
if (empty($str))
{
return FALSE;
}
elseif (preg_match('/^(?:([^:]*)\:)?\/\/(.+)$/', $str, $matches))
{
if (empty($matches[2]))
{
return FALSE;
}
elseif ( ! in_array(strtolower($matches[1]), array('http', 'https'), TRUE))
{
return FALSE;
}
$str = $matches[2];
}
// Apparently, FILTER_VALIDATE_URL doesn't reject digit-only names for some reason ...
// See https://github.com/bcit-ci/CodeIgniter/issues/5755
if (ctype_digit($str))
{
return FALSE;
}
// PHP 7 accepts IPv6 addresses within square brackets as hostnames,
// but it appears that the PR that came in with https://bugs.php.net/bug.php?id=68039
// was never merged into a PHP 5 branch ... https://3v4l.org/8PsSN
if (preg_match('/^\[([^\]]+)\]/', $str, $matches) && ! is_php('7') && filter_var($matches[1], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== FALSE)
{
$str = 'ipv6.host'.substr($str, strlen($matches[1]) + 2);
}
return (filter_var('http://'.$str, FILTER_VALIDATE_URL) !== FALSE);
}
// --------------------------------------------------------------------
/**
* Valid Email
*
* @param string
* @return bool
*/
public function valid_email($str)
{
if (function_exists('idn_to_ascii') && preg_match('#\A([^@]+)@(.+)\z#', $str, $matches))
{
$domain = defined('INTL_IDNA_VARIANT_UTS46')
? idn_to_ascii($matches[2], 0, INTL_IDNA_VARIANT_UTS46)
: idn_to_ascii($matches[2]);
if ($domain !== FALSE)
{
$str = $matches[1].'@'.$domain;
}
}
return (bool) filter_var($str, FILTER_VALIDATE_EMAIL);
}
// --------------------------------------------------------------------
/**
* Valid Emails
*
* @param string
* @return bool
*/
public function valid_emails($str)
{
if (strpos($str, ',') === FALSE)
{
return $this->valid_email(trim($str));
}
foreach (explode(',', $str) as $email)
{
if (trim($email) !== '' && $this->valid_email(trim($email)) === FALSE)
{
return FALSE;
}
}
return TRUE;
}
// --------------------------------------------------------------------
/**
* Validate IP Address
*
* @param string
* @param string 'ipv4' or 'ipv6' to validate a specific IP format
* @return bool
*/
public function valid_ip($ip, $which = '')
{
return $this->CI->input->valid_ip($ip, $which);
}
// --------------------------------------------------------------------
/**
* Alpha
*
* @param string
* @return bool
*/
public function alpha($str)
{
return ctype_alpha($str);
}
// --------------------------------------------------------------------
/**
* Alpha-numeric
*
* @param string
* @return bool
*/
public function alpha_numeric($str)
{
return ctype_alnum((string) $str);
}
// --------------------------------------------------------------------
/**
* Alpha-numeric w/ spaces
*
* @param string
* @return bool
*/
public function alpha_numeric_spaces($str)
{
return (bool) preg_match('/^[A-Z0-9 ]+$/i', $str);
}
// --------------------------------------------------------------------
/**
* Alpha-numeric with underscores and dashes
*
* @param string
* @return bool
*/
public function alpha_dash($str)
{
return (bool) preg_match('/^[a-z0-9_-]+$/i', $str);
}
// --------------------------------------------------------------------
/**
* Numeric
*
* @param string
* @return bool
*/
public function numeric($str)
{
return (bool) preg_match('/^[\-+]?[0-9]*\.?[0-9]+$/', $str);
}
// --------------------------------------------------------------------
/**
* Integer
*
* @param string
* @return bool
*/
public function integer($str)
{
return (bool) preg_match('/^[\-+]?[0-9]+$/', $str);
}
// --------------------------------------------------------------------
/**
* Decimal number
*
* @param string
* @return bool
*/
public function decimal($str)
{
return (bool) preg_match('/^[\-+]?[0-9]+\.[0-9]+$/', $str);
}
// --------------------------------------------------------------------
/**
* Greater than
*
* @param string
* @param int
* @return bool
*/
public function greater_than($str, $min)
{
return is_numeric($str) ? ($str > $min) : FALSE;
}
// --------------------------------------------------------------------
/**
* Equal to or Greater than
*
* @param string
* @param int
* @return bool
*/
public function greater_than_equal_to($str, $min)
{
return is_numeric($str) ? ($str >= $min) : FALSE;
}
// --------------------------------------------------------------------
/**
* Less than
*
* @param string
* @param int
* @return bool
*/
public function less_than($str, $max)
{
return is_numeric($str) ? ($str < $max) : FALSE;
}
// --------------------------------------------------------------------
/**
* Equal to or Less than
*
* @param string
* @param int
* @return bool
*/
public function less_than_equal_to($str, $max)
{
return is_numeric($str) ? ($str <= $max) : FALSE;
}
// --------------------------------------------------------------------
/**
* Value should be within an array of values
*
* @param string
* @param string
* @return bool
*/
public function in_list($value, $list)
{
return in_array($value, explode(',', $list), TRUE);
}
// --------------------------------------------------------------------
/**
* Is a Natural number (0,1,2,3, etc.)
*
* @param string
* @return bool
*/
public function is_natural($str)
{
return ctype_digit((string) $str);
}
// --------------------------------------------------------------------
/**
* Is a Natural number, but not a zero (1,2,3, etc.)
*
* @param string
* @return bool
*/
public function is_natural_no_zero($str)
{
return ($str != 0 && ctype_digit((string) $str));
}
// --------------------------------------------------------------------
/**
* Valid Base64
*
* Tests a string for characters outside of the Base64 alphabet
* as defined by RFC 2045 http://www.faqs.org/rfcs/rfc2045
*
* @param string
* @return bool
*/
public function valid_base64($str)
{
return (base64_encode(base64_decode($str)) === $str);
}
// --------------------------------------------------------------------
/**
* Prep data for form
*
* This function allows HTML to be safely shown in a form.
* Special characters are converted.
*
* @deprecated 3.0.6 Not used anywhere within the framework and pretty much useless
* @param mixed $data Input data
* @return mixed
*/
public function prep_for_form($data)
{
if ($this->_safe_form_data === FALSE OR empty($data))
{
return $data;
}
if (is_array($data))
{
foreach ($data as $key => $val)
{
$data[$key] = $this->prep_for_form($val);
}
return $data;
}
return str_replace(array("'", '"', '<', '>'), array(''', '"', '<', '>'), stripslashes($data));
}
// --------------------------------------------------------------------
/**
* Prep URL
*
* @param string
* @return string
*/
public function prep_url($str = '')
{
if ($str === 'http://' OR $str === '')
{
return '';
}
if (strpos($str, 'http://') !== 0 && strpos($str, 'https://') !== 0)
{
return 'http://'.$str;
}
return $str;
}
// --------------------------------------------------------------------
/**
* Strip Image Tags
*
* @param string
* @return string
*/
public function strip_image_tags($str)
{
return $this->CI->security->strip_image_tags($str);
}
// --------------------------------------------------------------------
/**
* Convert PHP tags to entities
*
* @param string
* @return string
*/
public function encode_php_tags($str)
{
return str_replace(array('', '?>'), array('<?', '?>'), $str);
}
// --------------------------------------------------------------------
/**
* Reset validation vars
*
* Prevents subsequent validation routines from being affected by the
* results of any previous validation routine due to the CI singleton.
*
* @return CI_Form_validation
*/
public function reset_validation()
{
$this->_field_data = array();
$this->_error_array = array();
$this->_error_messages = array();
$this->error_string = '';
return $this;
}
}
PK ! ~
Image_lib.phpnu [ 0)
{
$this->initialize($props);
}
/**
* A work-around for some improperly formatted, but
* usable JPEGs; known to be produced by Samsung
* smartphones' front-facing cameras.
*
* @see https://github.com/bcit-ci/CodeIgniter/issues/4967
* @see https://bugs.php.net/bug.php?id=72404
*/
ini_set('gd.jpeg_ignore_warning', 1);
log_message('info', 'Image Lib Class Initialized');
}
// --------------------------------------------------------------------
/**
* Initialize image properties
*
* Resets values in case this class is used in a loop
*
* @return void
*/
public function clear()
{
$props = array('thumb_marker', 'library_path', 'source_image', 'new_image', 'width', 'height', 'rotation_angle', 'x_axis', 'y_axis', 'wm_text', 'wm_overlay_path', 'wm_font_path', 'wm_shadow_color', 'source_folder', 'dest_folder', 'mime_type', 'orig_width', 'orig_height', 'image_type', 'size_str', 'full_src_path', 'full_dst_path');
foreach ($props as $val)
{
$this->$val = '';
}
$this->image_library = 'gd2';
$this->dynamic_output = FALSE;
$this->quality = 90;
$this->create_thumb = FALSE;
$this->thumb_marker = '_thumb';
$this->maintain_ratio = TRUE;
$this->master_dim = 'auto';
$this->wm_type = 'text';
$this->wm_x_transp = 4;
$this->wm_y_transp = 4;
$this->wm_font_size = 17;
$this->wm_vrt_alignment = 'B';
$this->wm_hor_alignment = 'C';
$this->wm_padding = 0;
$this->wm_hor_offset = 0;
$this->wm_vrt_offset = 0;
$this->wm_font_color = '#ffffff';
$this->wm_shadow_distance = 2;
$this->wm_opacity = 50;
$this->create_fnc = 'imagecreatetruecolor';
$this->copy_fnc = 'imagecopyresampled';
$this->error_msg = array();
$this->wm_use_drop_shadow = FALSE;
$this->wm_use_truetype = FALSE;
}
// --------------------------------------------------------------------
/**
* initialize image preferences
*
* @param array
* @return bool
*/
public function initialize($props = array())
{
// Convert array elements into class variables
if (count($props) > 0)
{
foreach ($props as $key => $val)
{
if (property_exists($this, $key))
{
if (in_array($key, array('wm_font_color', 'wm_shadow_color'), TRUE))
{
if (preg_match('/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i', $val, $matches))
{
/* $matches[1] contains our hex color value, but it might be
* both in the full 6-length format or the shortened 3-length
* value.
* We'll later need the full version, so we keep it if it's
* already there and if not - we'll convert to it. We can
* access string characters by their index as in an array,
* so we'll do that and use concatenation to form the final
* value:
*/
$val = (strlen($matches[1]) === 6)
? '#'.$matches[1]
: '#'.$matches[1][0].$matches[1][0].$matches[1][1].$matches[1][1].$matches[1][2].$matches[1][2];
}
else
{
continue;
}
}
elseif (in_array($key, array('width', 'height'), TRUE) && ! ctype_digit((string) $val))
{
continue;
}
$this->$key = $val;
}
}
}
// Is there a source image? If not, there's no reason to continue
if ($this->source_image === '')
{
$this->set_error('imglib_source_image_required');
return FALSE;
}
/* Is getimagesize() available?
*
* We use it to determine the image properties (width/height).
* Note: We need to figure out how to determine image
* properties using ImageMagick and NetPBM
*/
if ( ! function_exists('getimagesize'))
{
$this->set_error('imglib_gd_required_for_props');
return FALSE;
}
$this->image_library = strtolower($this->image_library);
/* Set the full server path
*
* The source image may or may not contain a path.
* Either way, we'll try use realpath to generate the
* full server path in order to more reliably read it.
*/
if (($full_source_path = realpath($this->source_image)) !== FALSE)
{
$full_source_path = str_replace('\\', '/', $full_source_path);
}
else
{
$full_source_path = $this->source_image;
}
$x = explode('/', $full_source_path);
$this->source_image = end($x);
$this->source_folder = str_replace($this->source_image, '', $full_source_path);
// Set the Image Properties
if ( ! $this->get_image_properties($this->source_folder.$this->source_image))
{
return FALSE;
}
/*
* Assign the "new" image name/path
*
* If the user has set a "new_image" name it means
* we are making a copy of the source image. If not
* it means we are altering the original. We'll
* set the destination filename and path accordingly.
*/
if ($this->new_image === '')
{
$this->dest_image = $this->source_image;
$this->dest_folder = $this->source_folder;
}
elseif (strpos($this->new_image, '/') === FALSE && strpos($this->new_image, '\\') === FALSE)
{
$this->dest_image = $this->new_image;
$this->dest_folder = $this->source_folder;
}
else
{
// Is there a file name?
if ( ! preg_match('#\.(jpg|jpeg|gif|png)$#i', $this->new_image))
{
$this->dest_image = $this->source_image;
$this->dest_folder = $this->new_image;
}
else
{
$x = explode('/', str_replace('\\', '/', $this->new_image));
$this->dest_image = end($x);
$this->dest_folder = str_replace($this->dest_image, '', $this->new_image);
}
$this->dest_folder = realpath($this->dest_folder).'/';
}
/* Compile the finalized filenames/paths
*
* We'll create two master strings containing the
* full server path to the source image and the
* full server path to the destination image.
* We'll also split the destination image name
* so we can insert the thumbnail marker if needed.
*/
if ($this->create_thumb === FALSE OR $this->thumb_marker === '')
{
$this->thumb_marker = '';
}
$xp = $this->explode_name($this->dest_image);
$filename = $xp['name'];
$file_ext = $xp['ext'];
$this->full_src_path = $this->source_folder.$this->source_image;
$this->full_dst_path = $this->dest_folder.$filename.$this->thumb_marker.$file_ext;
/* Should we maintain image proportions?
*
* When creating thumbs or copies, the target width/height
* might not be in correct proportion with the source
* image's width/height. We'll recalculate it here.
*/
if ($this->maintain_ratio === TRUE && ($this->width !== 0 OR $this->height !== 0))
{
$this->image_reproportion();
}
/* Was a width and height specified?
*
* If the destination width/height was not submitted we
* will use the values from the actual file
*/
if ($this->width === '')
{
$this->width = $this->orig_width;
}
if ($this->height === '')
{
$this->height = $this->orig_height;
}
// Set the quality
$this->quality = trim(str_replace('%', '', $this->quality));
if ($this->quality === '' OR $this->quality === 0 OR ! ctype_digit($this->quality))
{
$this->quality = 90;
}
// Set the x/y coordinates
is_numeric($this->x_axis) OR $this->x_axis = 0;
is_numeric($this->y_axis) OR $this->y_axis = 0;
// Watermark-related Stuff...
if ($this->wm_overlay_path !== '')
{
$this->wm_overlay_path = str_replace('\\', '/', realpath($this->wm_overlay_path));
}
if ($this->wm_shadow_color !== '')
{
$this->wm_use_drop_shadow = TRUE;
}
elseif ($this->wm_use_drop_shadow === TRUE && $this->wm_shadow_color === '')
{
$this->wm_use_drop_shadow = FALSE;
}
if ($this->wm_font_path !== '')
{
$this->wm_use_truetype = TRUE;
}
return TRUE;
}
// --------------------------------------------------------------------
/**
* Image Resize
*
* This is a wrapper function that chooses the proper
* resize function based on the protocol specified
*
* @return bool
*/
public function resize()
{
$protocol = ($this->image_library === 'gd2') ? 'image_process_gd' : 'image_process_'.$this->image_library;
return $this->$protocol('resize');
}
// --------------------------------------------------------------------
/**
* Image Crop
*
* This is a wrapper function that chooses the proper
* cropping function based on the protocol specified
*
* @return bool
*/
public function crop()
{
$protocol = ($this->image_library === 'gd2') ? 'image_process_gd' : 'image_process_'.$this->image_library;
return $this->$protocol('crop');
}
// --------------------------------------------------------------------
/**
* Image Rotate
*
* This is a wrapper function that chooses the proper
* rotation function based on the protocol specified
*
* @return bool
*/
public function rotate()
{
// Allowed rotation values
$degs = array(90, 180, 270, 'vrt', 'hor');
if ($this->rotation_angle === '' OR ! in_array($this->rotation_angle, $degs))
{
$this->set_error('imglib_rotation_angle_required');
return FALSE;
}
// Reassign the width and height
if ($this->rotation_angle === 90 OR $this->rotation_angle === 270)
{
$this->width = $this->orig_height;
$this->height = $this->orig_width;
}
else
{
$this->width = $this->orig_width;
$this->height = $this->orig_height;
}
// Choose resizing function
if ($this->image_library === 'imagemagick' OR $this->image_library === 'netpbm')
{
$protocol = 'image_process_'.$this->image_library;
return $this->$protocol('rotate');
}
return ($this->rotation_angle === 'hor' OR $this->rotation_angle === 'vrt')
? $this->image_mirror_gd()
: $this->image_rotate_gd();
}
// --------------------------------------------------------------------
/**
* Image Process Using GD/GD2
*
* This function will resize or crop
*
* @param string
* @return bool
*/
public function image_process_gd($action = 'resize')
{
$v2_override = FALSE;
// If the target width/height match the source, AND if the new file name is not equal to the old file name
// we'll simply make a copy of the original with the new name... assuming dynamic rendering is off.
if ($this->dynamic_output === FALSE && $this->orig_width === $this->width && $this->orig_height === $this->height)
{
if ($this->source_image !== $this->new_image && @copy($this->full_src_path, $this->full_dst_path))
{
chmod($this->full_dst_path, $this->file_permissions);
}
return TRUE;
}
// Let's set up our values based on the action
if ($action === 'crop')
{
// Reassign the source width/height if cropping
$this->orig_width = $this->width;
$this->orig_height = $this->height;
// GD 2.0 has a cropping bug so we'll test for it
if ($this->gd_version() !== FALSE)
{
$gd_version = str_replace('0', '', $this->gd_version());
$v2_override = ($gd_version == 2);
}
}
else
{
// If resizing the x/y axis must be zero
$this->x_axis = 0;
$this->y_axis = 0;
}
// Create the image handle
if ( ! ($src_img = $this->image_create_gd()))
{
return FALSE;
}
/* Create the image
*
* Old conditional which users report cause problems with shared GD libs who report themselves as "2.0 or greater"
* it appears that this is no longer the issue that it was in 2004, so we've removed it, retaining it in the comment
* below should that ever prove inaccurate.
*
* if ($this->image_library === 'gd2' && function_exists('imagecreatetruecolor') && $v2_override === FALSE)
*/
if ($this->image_library === 'gd2' && function_exists('imagecreatetruecolor'))
{
$create = 'imagecreatetruecolor';
$copy = 'imagecopyresampled';
}
else
{
$create = 'imagecreate';
$copy = 'imagecopyresized';
}
$dst_img = $create($this->width, $this->height);
if ($this->image_type === 3) // png we can actually preserve transparency
{
imagealphablending($dst_img, FALSE);
imagesavealpha($dst_img, TRUE);
}
$copy($dst_img, $src_img, 0, 0, $this->x_axis, $this->y_axis, $this->width, $this->height, $this->orig_width, $this->orig_height);
// Show the image
if ($this->dynamic_output === TRUE)
{
$this->image_display_gd($dst_img);
}
elseif ( ! $this->image_save_gd($dst_img)) // Or save it
{
return FALSE;
}
// Kill the file handles
imagedestroy($dst_img);
imagedestroy($src_img);
if ($this->dynamic_output !== TRUE)
{
chmod($this->full_dst_path, $this->file_permissions);
}
return TRUE;
}
// --------------------------------------------------------------------
/**
* Image Process Using ImageMagick
*
* This function will resize, crop or rotate
*
* @param string
* @return bool
*/
public function image_process_imagemagick($action = 'resize')
{
// Do we have a vaild library path?
if ($this->library_path === '')
{
$this->set_error('imglib_libpath_invalid');
return FALSE;
}
if ( ! preg_match('/convert$/i', $this->library_path))
{
$this->library_path = rtrim($this->library_path, '/').'/convert';
}
// Execute the command
$cmd = $this->library_path.' -quality '.$this->quality;
if ($action === 'crop')
{
$cmd .= ' -crop '.$this->width.'x'.$this->height.'+'.$this->x_axis.'+'.$this->y_axis;
}
elseif ($action === 'rotate')
{
$cmd .= ($this->rotation_angle === 'hor' OR $this->rotation_angle === 'vrt')
? ' -flop'
: ' -rotate '.$this->rotation_angle;
}
else // Resize
{
if($this->maintain_ratio === TRUE)
{
$cmd .= ' -resize '.$this->width.'x'.$this->height;
}
else
{
$cmd .= ' -resize '.$this->width.'x'.$this->height.'\!';
}
}
$cmd .= ' '.escapeshellarg($this->full_src_path).' '.escapeshellarg($this->full_dst_path).' 2>&1';
$retval = 1;
// exec() might be disabled
if (function_usable('exec'))
{
@exec($cmd, $output, $retval);
}
// Did it work?
if ($retval > 0)
{
$this->set_error('imglib_image_process_failed');
return FALSE;
}
chmod($this->full_dst_path, $this->file_permissions);
return TRUE;
}
// --------------------------------------------------------------------
/**
* Image Process Using NetPBM
*
* This function will resize, crop or rotate
*
* @param string
* @return bool
*/
public function image_process_netpbm($action = 'resize')
{
if ($this->library_path === '')
{
$this->set_error('imglib_libpath_invalid');
return FALSE;
}
// Build the resizing command
switch ($this->image_type)
{
case 1 :
$cmd_in = 'giftopnm';
$cmd_out = 'ppmtogif';
break;
case 2 :
$cmd_in = 'jpegtopnm';
$cmd_out = 'ppmtojpeg';
break;
case 3 :
$cmd_in = 'pngtopnm';
$cmd_out = 'ppmtopng';
break;
}
if ($action === 'crop')
{
$cmd_inner = 'pnmcut -left '.$this->x_axis.' -top '.$this->y_axis.' -width '.$this->width.' -height '.$this->height;
}
elseif ($action === 'rotate')
{
switch ($this->rotation_angle)
{
case 90: $angle = 'r270';
break;
case 180: $angle = 'r180';
break;
case 270: $angle = 'r90';
break;
case 'vrt': $angle = 'tb';
break;
case 'hor': $angle = 'lr';
break;
}
$cmd_inner = 'pnmflip -'.$angle.' ';
}
else // Resize
{
$cmd_inner = 'pnmscale -xysize '.$this->width.' '.$this->height;
}
$cmd = $this->library_path.$cmd_in.' '.escapeshellarg($this->full_src_path).' | '.$cmd_inner.' | '.$cmd_out.' > '.$this->dest_folder.'netpbm.tmp';
$retval = 1;
// exec() might be disabled
if (function_usable('exec'))
{
@exec($cmd, $output, $retval);
}
// Did it work?
if ($retval > 0)
{
$this->set_error('imglib_image_process_failed');
return FALSE;
}
// With NetPBM we have to create a temporary image.
// If you try manipulating the original it fails so
// we have to rename the temp file.
copy($this->dest_folder.'netpbm.tmp', $this->full_dst_path);
unlink($this->dest_folder.'netpbm.tmp');
chmod($this->full_dst_path, $this->file_permissions);
return TRUE;
}
// --------------------------------------------------------------------
/**
* Image Rotate Using GD
*
* @return bool
*/
public function image_rotate_gd()
{
// Create the image handle
if ( ! ($src_img = $this->image_create_gd()))
{
return FALSE;
}
// Set the background color
// This won't work with transparent PNG files so we are
// going to have to figure out how to determine the color
// of the alpha channel in a future release.
$white = imagecolorallocate($src_img, 255, 255, 255);
// Rotate it!
$dst_img = imagerotate($src_img, $this->rotation_angle, $white);
// Show the image
if ($this->dynamic_output === TRUE)
{
$this->image_display_gd($dst_img);
}
elseif ( ! $this->image_save_gd($dst_img)) // ... or save it
{
return FALSE;
}
// Kill the file handles
imagedestroy($dst_img);
imagedestroy($src_img);
chmod($this->full_dst_path, $this->file_permissions);
return TRUE;
}
// --------------------------------------------------------------------
/**
* Create Mirror Image using GD
*
* This function will flip horizontal or vertical
*
* @return bool
*/
public function image_mirror_gd()
{
if ( ! $src_img = $this->image_create_gd())
{
return FALSE;
}
$width = $this->orig_width;
$height = $this->orig_height;
if ($this->rotation_angle === 'hor')
{
for ($i = 0; $i < $height; $i++)
{
$left = 0;
$right = $width - 1;
while ($left < $right)
{
$cl = imagecolorat($src_img, $left, $i);
$cr = imagecolorat($src_img, $right, $i);
imagesetpixel($src_img, $left, $i, $cr);
imagesetpixel($src_img, $right, $i, $cl);
$left++;
$right--;
}
}
}
else
{
for ($i = 0; $i < $width; $i++)
{
$top = 0;
$bottom = $height - 1;
while ($top < $bottom)
{
$ct = imagecolorat($src_img, $i, $top);
$cb = imagecolorat($src_img, $i, $bottom);
imagesetpixel($src_img, $i, $top, $cb);
imagesetpixel($src_img, $i, $bottom, $ct);
$top++;
$bottom--;
}
}
}
// Show the image
if ($this->dynamic_output === TRUE)
{
$this->image_display_gd($src_img);
}
elseif ( ! $this->image_save_gd($src_img)) // ... or save it
{
return FALSE;
}
// Kill the file handles
imagedestroy($src_img);
chmod($this->full_dst_path, $this->file_permissions);
return TRUE;
}
// --------------------------------------------------------------------
/**
* Image Watermark
*
* This is a wrapper function that chooses the type
* of watermarking based on the specified preference.
*
* @return bool
*/
public function watermark()
{
return ($this->wm_type === 'overlay') ? $this->overlay_watermark() : $this->text_watermark();
}
// --------------------------------------------------------------------
/**
* Watermark - Graphic Version
*
* @return bool
*/
public function overlay_watermark()
{
if ( ! function_exists('imagecolortransparent'))
{
$this->set_error('imglib_gd_required');
return FALSE;
}
// Fetch source image properties
$this->get_image_properties();
// Fetch watermark image properties
$props = $this->get_image_properties($this->wm_overlay_path, TRUE);
$wm_img_type = $props['image_type'];
$wm_width = $props['width'];
$wm_height = $props['height'];
// Create two image resources
$wm_img = $this->image_create_gd($this->wm_overlay_path, $wm_img_type);
$src_img = $this->image_create_gd($this->full_src_path);
// Reverse the offset if necessary
// When the image is positioned at the bottom
// we don't want the vertical offset to push it
// further down. We want the reverse, so we'll
// invert the offset. Same with the horizontal
// offset when the image is at the right
$this->wm_vrt_alignment = strtoupper($this->wm_vrt_alignment[0]);
$this->wm_hor_alignment = strtoupper($this->wm_hor_alignment[0]);
if ($this->wm_vrt_alignment === 'B')
$this->wm_vrt_offset = $this->wm_vrt_offset * -1;
if ($this->wm_hor_alignment === 'R')
$this->wm_hor_offset = $this->wm_hor_offset * -1;
// Set the base x and y axis values
$x_axis = $this->wm_hor_offset + $this->wm_padding;
$y_axis = $this->wm_vrt_offset + $this->wm_padding;
// Set the vertical position
if ($this->wm_vrt_alignment === 'M')
{
$y_axis += ($this->orig_height / 2) - ($wm_height / 2);
}
elseif ($this->wm_vrt_alignment === 'B')
{
$y_axis += $this->orig_height - $wm_height;
}
// Set the horizontal position
if ($this->wm_hor_alignment === 'C')
{
$x_axis += ($this->orig_width / 2) - ($wm_width / 2);
}
elseif ($this->wm_hor_alignment === 'R')
{
$x_axis += $this->orig_width - $wm_width;
}
// Build the finalized image
if ($wm_img_type === 3 && function_exists('imagealphablending'))
{
@imagealphablending($src_img, TRUE);
}
// Set RGB values for text and shadow
$rgba = imagecolorat($wm_img, $this->wm_x_transp, $this->wm_y_transp);
$alpha = ($rgba & 0x7F000000) >> 24;
// make a best guess as to whether we're dealing with an image with alpha transparency or no/binary transparency
if ($alpha > 0)
{
// copy the image directly, the image's alpha transparency being the sole determinant of blending
imagecopy($src_img, $wm_img, $x_axis, $y_axis, 0, 0, $wm_width, $wm_height);
}
else
{
// set our RGB value from above to be transparent and merge the images with the specified opacity
imagecolortransparent($wm_img, imagecolorat($wm_img, $this->wm_x_transp, $this->wm_y_transp));
imagecopymerge($src_img, $wm_img, $x_axis, $y_axis, 0, 0, $wm_width, $wm_height, $this->wm_opacity);
}
// We can preserve transparency for PNG images
if ($this->image_type === 3)
{
imagealphablending($src_img, FALSE);
imagesavealpha($src_img, TRUE);
}
// Output the image
if ($this->dynamic_output === TRUE)
{
$this->image_display_gd($src_img);
}
elseif ( ! $this->image_save_gd($src_img)) // ... or save it
{
return FALSE;
}
imagedestroy($src_img);
imagedestroy($wm_img);
return TRUE;
}
// --------------------------------------------------------------------
/**
* Watermark - Text Version
*
* @return bool
*/
public function text_watermark()
{
if ( ! ($src_img = $this->image_create_gd()))
{
return FALSE;
}
if ($this->wm_use_truetype === TRUE && ! file_exists($this->wm_font_path))
{
$this->set_error('imglib_missing_font');
return FALSE;
}
// Fetch source image properties
$this->get_image_properties();
// Reverse the vertical offset
// When the image is positioned at the bottom
// we don't want the vertical offset to push it
// further down. We want the reverse, so we'll
// invert the offset. Note: The horizontal
// offset flips itself automatically
if ($this->wm_vrt_alignment === 'B')
{
$this->wm_vrt_offset = $this->wm_vrt_offset * -1;
}
if ($this->wm_hor_alignment === 'R')
{
$this->wm_hor_offset = $this->wm_hor_offset * -1;
}
// Set font width and height
// These are calculated differently depending on
// whether we are using the true type font or not
if ($this->wm_use_truetype === TRUE)
{
if (empty($this->wm_font_size))
{
$this->wm_font_size = 17;
}
if (function_exists('imagettfbbox'))
{
$temp = imagettfbbox($this->wm_font_size, 0, $this->wm_font_path, $this->wm_text);
$temp = $temp[2] - $temp[0];
$fontwidth = $temp / strlen($this->wm_text);
}
else
{
$fontwidth = $this->wm_font_size - ($this->wm_font_size / 4);
}
$fontheight = $this->wm_font_size;
$this->wm_vrt_offset += $this->wm_font_size;
}
else
{
$fontwidth = imagefontwidth($this->wm_font_size);
$fontheight = imagefontheight($this->wm_font_size);
}
// Set base X and Y axis values
$x_axis = $this->wm_hor_offset + $this->wm_padding;
$y_axis = $this->wm_vrt_offset + $this->wm_padding;
if ($this->wm_use_drop_shadow === FALSE)
{
$this->wm_shadow_distance = 0;
}
$this->wm_vrt_alignment = strtoupper($this->wm_vrt_alignment[0]);
$this->wm_hor_alignment = strtoupper($this->wm_hor_alignment[0]);
// Set vertical alignment
if ($this->wm_vrt_alignment === 'M')
{
$y_axis += ($this->orig_height / 2) + ($fontheight / 2);
}
elseif ($this->wm_vrt_alignment === 'B')
{
$y_axis += $this->orig_height - $fontheight - $this->wm_shadow_distance - ($fontheight / 2);
}
// Set horizontal alignment
if ($this->wm_hor_alignment === 'R')
{
$x_axis += $this->orig_width - ($fontwidth * strlen($this->wm_text)) - $this->wm_shadow_distance;
}
elseif ($this->wm_hor_alignment === 'C')
{
$x_axis += floor(($this->orig_width - ($fontwidth * strlen($this->wm_text))) / 2);
}
if ($this->wm_use_drop_shadow)
{
// Offset from text
$x_shad = $x_axis + $this->wm_shadow_distance;
$y_shad = $y_axis + $this->wm_shadow_distance;
/* Set RGB values for shadow
*
* First character is #, so we don't really need it.
* Get the rest of the string and split it into 2-length
* hex values:
*/
$drp_color = str_split(substr($this->wm_shadow_color, 1, 6), 2);
$drp_color = imagecolorclosest($src_img, hexdec($drp_color[0]), hexdec($drp_color[1]), hexdec($drp_color[2]));
// Add the shadow to the source image
if ($this->wm_use_truetype)
{
imagettftext($src_img, $this->wm_font_size, 0, $x_shad, $y_shad, $drp_color, $this->wm_font_path, $this->wm_text);
}
else
{
imagestring($src_img, $this->wm_font_size, $x_shad, $y_shad, $this->wm_text, $drp_color);
}
}
/* Set RGB values for text
*
* First character is #, so we don't really need it.
* Get the rest of the string and split it into 2-length
* hex values:
*/
$txt_color = str_split(substr($this->wm_font_color, 1, 6), 2);
$txt_color = imagecolorclosest($src_img, hexdec($txt_color[0]), hexdec($txt_color[1]), hexdec($txt_color[2]));
// Add the text to the source image
if ($this->wm_use_truetype)
{
imagettftext($src_img, $this->wm_font_size, 0, $x_axis, $y_axis, $txt_color, $this->wm_font_path, $this->wm_text);
}
else
{
imagestring($src_img, $this->wm_font_size, $x_axis, $y_axis, $this->wm_text, $txt_color);
}
// We can preserve transparency for PNG images
if ($this->image_type === 3)
{
imagealphablending($src_img, FALSE);
imagesavealpha($src_img, TRUE);
}
// Output the final image
if ($this->dynamic_output === TRUE)
{
$this->image_display_gd($src_img);
}
else
{
$this->image_save_gd($src_img);
}
imagedestroy($src_img);
return TRUE;
}
// --------------------------------------------------------------------
/**
* Create Image - GD
*
* This simply creates an image resource handle
* based on the type of image being processed
*
* @param string
* @param string
* @return resource
*/
public function image_create_gd($path = '', $image_type = '')
{
if ($path === '')
{
$path = $this->full_src_path;
}
if ($image_type === '')
{
$image_type = $this->image_type;
}
switch ($image_type)
{
case 1:
if ( ! function_exists('imagecreatefromgif'))
{
$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_gif_not_supported'));
return FALSE;
}
return imagecreatefromgif($path);
case 2:
if ( ! function_exists('imagecreatefromjpeg'))
{
$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_jpg_not_supported'));
return FALSE;
}
return imagecreatefromjpeg($path);
case 3:
if ( ! function_exists('imagecreatefrompng'))
{
$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported'));
return FALSE;
}
return imagecreatefrompng($path);
default:
$this->set_error(array('imglib_unsupported_imagecreate'));
return FALSE;
}
}
// --------------------------------------------------------------------
/**
* Write image file to disk - GD
*
* Takes an image resource as input and writes the file
* to the specified destination
*
* @param resource
* @return bool
*/
public function image_save_gd($resource)
{
switch ($this->image_type)
{
case 1:
if ( ! function_exists('imagegif'))
{
$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_gif_not_supported'));
return FALSE;
}
if ( ! @imagegif($resource, $this->full_dst_path))
{
$this->set_error('imglib_save_failed');
return FALSE;
}
break;
case 2:
if ( ! function_exists('imagejpeg'))
{
$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_jpg_not_supported'));
return FALSE;
}
if ( ! @imagejpeg($resource, $this->full_dst_path, $this->quality))
{
$this->set_error('imglib_save_failed');
return FALSE;
}
break;
case 3:
if ( ! function_exists('imagepng'))
{
$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported'));
return FALSE;
}
if ( ! @imagepng($resource, $this->full_dst_path))
{
$this->set_error('imglib_save_failed');
return FALSE;
}
break;
default:
$this->set_error(array('imglib_unsupported_imagecreate'));
return FALSE;
break;
}
return TRUE;
}
// --------------------------------------------------------------------
/**
* Dynamically outputs an image
*
* @param resource
* @return void
*/
public function image_display_gd($resource)
{
header('Content-Disposition: filename='.$this->source_image.';');
header('Content-Type: '.$this->mime_type);
header('Content-Transfer-Encoding: binary');
header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT');
switch ($this->image_type)
{
case 1 : imagegif($resource);
break;
case 2 : imagejpeg($resource, NULL, $this->quality);
break;
case 3 : imagepng($resource);
break;
default: echo 'Unable to display the image';
break;
}
}
// --------------------------------------------------------------------
/**
* Re-proportion Image Width/Height
*
* When creating thumbs, the desired width/height
* can end up warping the image due to an incorrect
* ratio between the full-sized image and the thumb.
*
* This function lets us re-proportion the width/height
* if users choose to maintain the aspect ratio when resizing.
*
* @return void
*/
public function image_reproportion()
{
if (($this->width === 0 && $this->height === 0) OR $this->orig_width === 0 OR $this->orig_height === 0
OR ( ! ctype_digit((string) $this->width) && ! ctype_digit((string) $this->height))
OR ! ctype_digit((string) $this->orig_width) OR ! ctype_digit((string) $this->orig_height))
{
return;
}
// Sanitize
$this->width = (int) $this->width;
$this->height = (int) $this->height;
if ($this->master_dim !== 'width' && $this->master_dim !== 'height')
{
if ($this->width > 0 && $this->height > 0)
{
$this->master_dim = ((($this->orig_height/$this->orig_width) - ($this->height/$this->width)) < 0)
? 'width' : 'height';
}
else
{
$this->master_dim = ($this->height === 0) ? 'width' : 'height';
}
}
elseif (($this->master_dim === 'width' && $this->width === 0)
OR ($this->master_dim === 'height' && $this->height === 0))
{
return;
}
if ($this->master_dim === 'width')
{
$this->height = (int) ceil($this->width*$this->orig_height/$this->orig_width);
}
else
{
$this->width = (int) ceil($this->orig_width*$this->height/$this->orig_height);
}
}
// --------------------------------------------------------------------
/**
* Get image properties
*
* A helper function that gets info about the file
*
* @param string
* @param bool
* @return mixed
*/
public function get_image_properties($path = '', $return = FALSE)
{
// For now we require GD but we should
// find a way to determine this using IM or NetPBM
if ($path === '')
{
$path = $this->full_src_path;
}
if ( ! file_exists($path))
{
$this->set_error('imglib_invalid_path');
return FALSE;
}
$vals = getimagesize($path);
if ($vals === FALSE)
{
$this->set_error('imglib_invalid_image');
return FALSE;
}
$types = array(1 => 'gif', 2 => 'jpeg', 3 => 'png');
$mime = isset($types[$vals[2]]) ? 'image/'.$types[$vals[2]] : 'image/jpg';
if ($return === TRUE)
{
return array(
'width' => $vals[0],
'height' => $vals[1],
'image_type' => $vals[2],
'size_str' => $vals[3],
'mime_type' => $mime
);
}
$this->orig_width = $vals[0];
$this->orig_height = $vals[1];
$this->image_type = $vals[2];
$this->size_str = $vals[3];
$this->mime_type = $mime;
return TRUE;
}
// --------------------------------------------------------------------
/**
* Size calculator
*
* This function takes a known width x height and
* recalculates it to a new size. Only one
* new variable needs to be known
*
* $props = array(
* 'width' => $width,
* 'height' => $height,
* 'new_width' => 40,
* 'new_height' => ''
* );
*
* @param array
* @return array
*/
public function size_calculator($vals)
{
if ( ! is_array($vals))
{
return;
}
$allowed = array('new_width', 'new_height', 'width', 'height');
foreach ($allowed as $item)
{
if (empty($vals[$item]))
{
$vals[$item] = 0;
}
}
if ($vals['width'] === 0 OR $vals['height'] === 0)
{
return $vals;
}
if ($vals['new_width'] === 0)
{
$vals['new_width'] = ceil($vals['width']*$vals['new_height']/$vals['height']);
}
elseif ($vals['new_height'] === 0)
{
$vals['new_height'] = ceil($vals['new_width']*$vals['height']/$vals['width']);
}
return $vals;
}
// --------------------------------------------------------------------
/**
* Explode source_image
*
* This is a helper function that extracts the extension
* from the source_image. This function lets us deal with
* source_images with multiple periods, like: my.cool.jpg
* It returns an associative array with two elements:
* $array['ext'] = '.jpg';
* $array['name'] = 'my.cool';
*
* @param array
* @return array
*/
public function explode_name($source_image)
{
$ext = strrchr($source_image, '.');
$name = ($ext === FALSE) ? $source_image : substr($source_image, 0, -strlen($ext));
return array('ext' => $ext, 'name' => $name);
}
// --------------------------------------------------------------------
/**
* Is GD Installed?
*
* @return bool
*/
public function gd_loaded()
{
if ( ! extension_loaded('gd'))
{
/* As it is stated in the PHP manual, dl() is not always available
* and even if so - it could generate an E_WARNING message on failure
*/
return (function_exists('dl') && @dl('gd.so'));
}
return TRUE;
}
// --------------------------------------------------------------------
/**
* Get GD version
*
* @return mixed
*/
public function gd_version()
{
if (function_exists('gd_info'))
{
$gd_version = @gd_info();
return preg_replace('/\D/', '', $gd_version['GD Version']);
}
return FALSE;
}
// --------------------------------------------------------------------
/**
* Set error message
*
* @param string
* @return void
*/
public function set_error($msg)
{
$CI =& get_instance();
$CI->lang->load('imglib');
if (is_array($msg))
{
foreach ($msg as $val)
{
$msg = ($CI->lang->line($val) === FALSE) ? $val : $CI->lang->line($val);
$this->error_msg[] = $msg;
log_message('error', $msg);
}
}
else
{
$msg = ($CI->lang->line($msg) === FALSE) ? $msg : $CI->lang->line($msg);
$this->error_msg[] = $msg;
log_message('error', $msg);
}
}
// --------------------------------------------------------------------
/**
* Show error messages
*
* @param string
* @param string
* @return string
*/
public function display_errors($open = '', $close = '
')
{
return (count($this->error_msg) > 0) ? $open.implode($close.$open, $this->error_msg).$close : '';
}
}
PK !
! Cache/drivers/Cache_memcached.phpnu [ array(
'host' => '127.0.0.1',
'port' => 11211,
'weight' => 1
)
);
// ------------------------------------------------------------------------
/**
* Class constructor
*
* Setup Memcache(d)
*
* @return void
*/
public function __construct()
{
// Try to load memcached server info from the config file.
$CI =& get_instance();
$defaults = $this->_config['default'];
if ($CI->config->load('memcached', TRUE, TRUE))
{
$this->_config = $CI->config->config['memcached'];
}
if (class_exists('Memcached', FALSE))
{
$this->_memcached = new Memcached();
}
elseif (class_exists('Memcache', FALSE))
{
$this->_memcached = new Memcache();
}
else
{
log_message('error', 'Cache: Failed to create Memcache(d) object; extension not loaded?');
return;
}
foreach ($this->_config as $cache_server)
{
isset($cache_server['hostname']) OR $cache_server['hostname'] = $defaults['host'];
isset($cache_server['port']) OR $cache_server['port'] = $defaults['port'];
isset($cache_server['weight']) OR $cache_server['weight'] = $defaults['weight'];
if ($this->_memcached instanceof Memcache)
{
// Third parameter is persistence and defaults to TRUE.
$this->_memcached->addServer(
$cache_server['hostname'],
$cache_server['port'],
TRUE,
$cache_server['weight']
);
}
elseif ($this->_memcached instanceof Memcached)
{
$this->_memcached->addServer(
$cache_server['hostname'],
$cache_server['port'],
$cache_server['weight']
);
}
}
}
// ------------------------------------------------------------------------
/**
* Fetch from cache
*
* @param string $id Cache ID
* @return mixed Data on success, FALSE on failure
*/
public function get($id)
{
$data = $this->_memcached->get($id);
return is_array($data) ? $data[0] : $data;
}
// ------------------------------------------------------------------------
/**
* Save
*
* @param string $id Cache ID
* @param mixed $data Data being cached
* @param int $ttl Time to live
* @param bool $raw Whether to store the raw value
* @return bool TRUE on success, FALSE on failure
*/
public function save($id, $data, $ttl = 60, $raw = FALSE)
{
if ($raw !== TRUE)
{
$data = array($data, time(), $ttl);
}
if ($this->_memcached instanceof Memcached)
{
return $this->_memcached->set($id, $data, $ttl);
}
elseif ($this->_memcached instanceof Memcache)
{
return $this->_memcached->set($id, $data, 0, $ttl);
}
return FALSE;
}
// ------------------------------------------------------------------------
/**
* Delete from Cache
*
* @param mixed $id key to be deleted.
* @return bool true on success, false on failure
*/
public function delete($id)
{
return $this->_memcached->delete($id);
}
// ------------------------------------------------------------------------
/**
* Increment a raw value
*
* @param string $id Cache ID
* @param int $offset Step/value to add
* @return mixed New value on success or FALSE on failure
*/
public function increment($id, $offset = 1)
{
if (($result = $this->_memcached->increment($id, $offset)) === FALSE)
{
return $this->_memcached->add($id, $offset) ? $offset : FALSE;
}
return $result;
}
// ------------------------------------------------------------------------
/**
* Decrement a raw value
*
* @param string $id Cache ID
* @param int $offset Step/value to reduce by
* @return mixed New value on success or FALSE on failure
*/
public function decrement($id, $offset = 1)
{
if (($result = $this->_memcached->decrement($id, $offset)) === FALSE)
{
return $this->_memcached->add($id, 0) ? 0 : FALSE;
}
return $result;
}
// ------------------------------------------------------------------------
/**
* Clean the Cache
*
* @return bool false on failure/true on success
*/
public function clean()
{
return $this->_memcached->flush();
}
// ------------------------------------------------------------------------
/**
* Cache Info
*
* @return mixed array on success, false on failure
*/
public function cache_info()
{
return $this->_memcached->getStats();
}
// ------------------------------------------------------------------------
/**
* Get Cache Metadata
*
* @param mixed $id key to get cache metadata on
* @return mixed FALSE on failure, array on success.
*/
public function get_metadata($id)
{
$stored = $this->_memcached->get($id);
if (count($stored) !== 3)
{
return FALSE;
}
list($data, $time, $ttl) = $stored;
return array(
'expire' => $time + $ttl,
'mtime' => $time,
'data' => $data
);
}
// ------------------------------------------------------------------------
/**
* Is supported
*
* Returns FALSE if memcached is not supported on the system.
* If it is, we setup the memcached object & return TRUE
*
* @return bool
*/
public function is_supported()
{
return (extension_loaded('memcached') OR extension_loaded('memcache'));
}
// ------------------------------------------------------------------------
/**
* Class destructor
*
* Closes the connection to Memcache(d) if present.
*
* @return void
*/
public function __destruct()
{
if ($this->_memcached instanceof Memcache)
{
$this->_memcached->close();
}
elseif ($this->_memcached instanceof Memcached && method_exists($this->_memcached, 'quit'))
{
$this->_memcached->quit();
}
}
}
PK ! ܰJ' Cache/drivers/Cache_dummy.phpnu [ load->helper('file');
$path = $CI->config->item('cache_path');
$this->_cache_path = ($path === '') ? APPPATH.'cache/' : $path;
}
// ------------------------------------------------------------------------
/**
* Fetch from cache
*
* @param string $id Cache ID
* @return mixed Data on success, FALSE on failure
*/
public function get($id)
{
$data = $this->_get($id);
return is_array($data) ? $data['data'] : FALSE;
}
// ------------------------------------------------------------------------
/**
* Save into cache
*
* @param string $id Cache ID
* @param mixed $data Data to store
* @param int $ttl Time to live in seconds
* @param bool $raw Whether to store the raw value (unused)
* @return bool TRUE on success, FALSE on failure
*/
public function save($id, $data, $ttl = 60, $raw = FALSE)
{
$contents = array(
'time' => time(),
'ttl' => $ttl,
'data' => $data
);
if (write_file($this->_cache_path.$id, serialize($contents)))
{
chmod($this->_cache_path.$id, 0640);
return TRUE;
}
return FALSE;
}
// ------------------------------------------------------------------------
/**
* Delete from Cache
*
* @param mixed unique identifier of item in cache
* @return bool true on success/false on failure
*/
public function delete($id)
{
return is_file($this->_cache_path.$id) ? unlink($this->_cache_path.$id) : FALSE;
}
// ------------------------------------------------------------------------
/**
* Increment a raw value
*
* @param string $id Cache ID
* @param int $offset Step/value to add
* @return New value on success, FALSE on failure
*/
public function increment($id, $offset = 1)
{
$data = $this->_get($id);
if ($data === FALSE)
{
$data = array('data' => 0, 'ttl' => 60);
}
elseif ( ! is_int($data['data']))
{
return FALSE;
}
$new_value = $data['data'] + $offset;
return $this->save($id, $new_value, $data['ttl'])
? $new_value
: FALSE;
}
// ------------------------------------------------------------------------
/**
* Decrement a raw value
*
* @param string $id Cache ID
* @param int $offset Step/value to reduce by
* @return New value on success, FALSE on failure
*/
public function decrement($id, $offset = 1)
{
$data = $this->_get($id);
if ($data === FALSE)
{
$data = array('data' => 0, 'ttl' => 60);
}
elseif ( ! is_int($data['data']))
{
return FALSE;
}
$new_value = $data['data'] - $offset;
return $this->save($id, $new_value, $data['ttl'])
? $new_value
: FALSE;
}
// ------------------------------------------------------------------------
/**
* Clean the Cache
*
* @return bool false on failure/true on success
*/
public function clean()
{
return delete_files($this->_cache_path, FALSE, TRUE);
}
// ------------------------------------------------------------------------
/**
* Cache Info
*
* Not supported by file-based caching
*
* @param string user/filehits
* @return mixed FALSE
*/
public function cache_info($type = NULL)
{
return get_dir_file_info($this->_cache_path);
}
// ------------------------------------------------------------------------
/**
* Get Cache Metadata
*
* @param mixed key to get cache metadata on
* @return mixed FALSE on failure, array on success.
*/
public function get_metadata($id)
{
if ( ! is_file($this->_cache_path.$id))
{
return FALSE;
}
$data = unserialize(file_get_contents($this->_cache_path.$id));
if (is_array($data))
{
$mtime = filemtime($this->_cache_path.$id);
if ( ! isset($data['ttl'], $data['time']))
{
return FALSE;
}
return array(
'expire' => $data['time'] + $data['ttl'],
'mtime' => $mtime
);
}
return FALSE;
}
// ------------------------------------------------------------------------
/**
* Is supported
*
* In the file driver, check to see that the cache directory is indeed writable
*
* @return bool
*/
public function is_supported()
{
return is_really_writable($this->_cache_path);
}
// ------------------------------------------------------------------------
/**
* Get all data
*
* Internal method to get all the relevant data about a cache item
*
* @param string $id Cache ID
* @return mixed Data array on success or FALSE on failure
*/
protected function _get($id)
{
if ( ! is_file($this->_cache_path.$id))
{
return FALSE;
}
$data = unserialize(file_get_contents($this->_cache_path.$id));
if ($data['ttl'] > 0 && time() > $data['time'] + $data['ttl'])
{
file_exists($this->_cache_path.$id) && unlink($this->_cache_path.$id);
return FALSE;
}
return $data;
}
}
PK ! Cache/drivers/Cache_redis.phpnu [
* @link
*/
class CI_Cache_redis extends CI_Driver
{
/**
* Default config
*
* @static
* @var array
*/
protected static $_default_config = array(
'socket_type' => 'tcp',
'host' => '127.0.0.1',
'password' => NULL,
'port' => 6379,
'timeout' => 0
);
/**
* Redis connection
*
* @var Redis
*/
protected $_redis;
/**
* An internal cache for storing keys of serialized values.
*
* @var array
*/
protected $_serialized = array();
/**
* del()/delete() method name depending on phpRedis version
*
* @var string
*/
protected static $_delete_name;
// ------------------------------------------------------------------------
/**
* Class constructor
*
* Setup Redis
*
* Loads Redis config file if present. Will halt execution
* if a Redis connection can't be established.
*
* @return void
* @see Redis::connect()
*/
public function __construct()
{
if ( ! $this->is_supported())
{
log_message('error', 'Cache: Failed to create Redis object; extension not loaded?');
return;
}
isset(static::$_delete_name) OR static::$_delete_name = version_compare(phpversion('phpredis'), '5', '>=')
? 'del'
: 'delete';
$CI =& get_instance();
if ($CI->config->load('redis', TRUE, TRUE))
{
$config = array_merge(self::$_default_config, $CI->config->item('redis'));
}
else
{
$config = self::$_default_config;
}
$this->_redis = new Redis();
try
{
if ($config['socket_type'] === 'unix')
{
$success = $this->_redis->connect($config['socket']);
}
else // tcp socket
{
$success = $this->_redis->connect($config['host'], $config['port'], $config['timeout']);
}
if ( ! $success)
{
log_message('error', 'Cache: Redis connection failed. Check your configuration.');
}
if (isset($config['password']) && ! $this->_redis->auth($config['password']))
{
log_message('error', 'Cache: Redis authentication failed.');
}
}
catch (RedisException $e)
{
log_message('error', 'Cache: Redis connection refused ('.$e->getMessage().')');
}
}
// ------------------------------------------------------------------------
/**
* Get cache
*
* @param string $key Cache ID
* @return mixed
*/
public function get($key)
{
$value = $this->_redis->get($key);
if ($value !== FALSE && $this->_redis->sIsMember('_ci_redis_serialized', $key))
{
return unserialize($value);
}
return $value;
}
// ------------------------------------------------------------------------
/**
* Save cache
*
* @param string $id Cache ID
* @param mixed $data Data to save
* @param int $ttl Time to live in seconds
* @param bool $raw Whether to store the raw value (unused)
* @return bool TRUE on success, FALSE on failure
*/
public function save($id, $data, $ttl = 60, $raw = FALSE)
{
if (is_array($data) OR is_object($data))
{
if ( ! $this->_redis->sIsMember('_ci_redis_serialized', $id) && ! $this->_redis->sAdd('_ci_redis_serialized', $id))
{
return FALSE;
}
isset($this->_serialized[$id]) OR $this->_serialized[$id] = TRUE;
$data = serialize($data);
}
else
{
$this->_redis->sRemove('_ci_redis_serialized', $id);
}
return $this->_redis->set($id, $data, $ttl);
}
// ------------------------------------------------------------------------
/**
* Delete from cache
*
* @param string $key Cache key
* @return bool
*/
public function delete($key)
{
if ($this->_redis->{static::$_delete_name}($key) !== 1)
{
return FALSE;
}
$this->_redis->sRemove('_ci_redis_serialized', $key);
return TRUE;
}
// ------------------------------------------------------------------------
/**
* Increment a raw value
*
* @param string $id Cache ID
* @param int $offset Step/value to add
* @return mixed New value on success or FALSE on failure
*/
public function increment($id, $offset = 1)
{
return $this->_redis->incrBy($id, $offset);
}
// ------------------------------------------------------------------------
/**
* Decrement a raw value
*
* @param string $id Cache ID
* @param int $offset Step/value to reduce by
* @return mixed New value on success or FALSE on failure
*/
public function decrement($id, $offset = 1)
{
return $this->_redis->decrBy($id, $offset);
}
// ------------------------------------------------------------------------
/**
* Clean cache
*
* @return bool
* @see Redis::flushDB()
*/
public function clean()
{
return $this->_redis->flushDB();
}
// ------------------------------------------------------------------------
/**
* Get cache driver info
*
* @param string $type Not supported in Redis.
* Only included in order to offer a
* consistent cache API.
* @return array
* @see Redis::info()
*/
public function cache_info($type = NULL)
{
return $this->_redis->info();
}
// ------------------------------------------------------------------------
/**
* Get cache metadata
*
* @param string $key Cache key
* @return array
*/
public function get_metadata($key)
{
$value = $this->get($key);
if ($value !== FALSE)
{
return array(
'expire' => time() + $this->_redis->ttl($key),
'data' => $value
);
}
return FALSE;
}
// ------------------------------------------------------------------------
/**
* Check if Redis driver is supported
*
* @return bool
*/
public function is_supported()
{
return extension_loaded('redis');
}
// ------------------------------------------------------------------------
/**
* Class destructor
*
* Closes the connection to Redis if present.
*
* @return void
*/
public function __destruct()
{
if ($this->_redis)
{
$this->_redis->close();
}
}
}
PK ! H Cache/drivers/Cache_apc.phpnu [ is_supported())
{
log_message('error', 'Cache: Failed to initialize APC; extension not loaded/enabled?');
}
}
// ------------------------------------------------------------------------
/**
* Get
*
* Look for a value in the cache. If it exists, return the data
* if not, return FALSE
*
* @param string
* @return mixed value that is stored/FALSE on failure
*/
public function get($id)
{
$success = FALSE;
$data = apc_fetch($id, $success);
return ($success === TRUE) ? $data : FALSE;
}
// ------------------------------------------------------------------------
/**
* Cache Save
*
* @param string $id Cache ID
* @param mixed $data Data to store
* @param int $ttl Length of time (in seconds) to cache the data
* @param bool $raw Whether to store the raw value (unused)
* @return bool TRUE on success, FALSE on failure
*/
public function save($id, $data, $ttl = 60, $raw = FALSE)
{
return apc_store($id, $data, (int) $ttl);
}
// ------------------------------------------------------------------------
/**
* Delete from Cache
*
* @param mixed unique identifier of the item in the cache
* @return bool true on success/false on failure
*/
public function delete($id)
{
return apc_delete($id);
}
// ------------------------------------------------------------------------
/**
* Increment a raw value
*
* @param string $id Cache ID
* @param int $offset Step/value to add
* @return mixed New value on success or FALSE on failure
*/
public function increment($id, $offset = 1)
{
return apc_inc($id, $offset);
}
// ------------------------------------------------------------------------
/**
* Decrement a raw value
*
* @param string $id Cache ID
* @param int $offset Step/value to reduce by
* @return mixed New value on success or FALSE on failure
*/
public function decrement($id, $offset = 1)
{
return apc_dec($id, $offset);
}
// ------------------------------------------------------------------------
/**
* Clean the cache
*
* @return bool false on failure/true on success
*/
public function clean()
{
return apc_clear_cache('user');
}
// ------------------------------------------------------------------------
/**
* Cache Info
*
* @param string user/filehits
* @return mixed array on success, false on failure
*/
public function cache_info($type = NULL)
{
return apc_cache_info($type);
}
// ------------------------------------------------------------------------
/**
* Get Cache Metadata
*
* @param mixed key to get cache metadata on
* @return mixed array on success/false on failure
*/
public function get_metadata($id)
{
$cache_info = apc_cache_info('user', FALSE);
if (empty($cache_info) OR empty($cache_info['cache_list']))
{
return FALSE;
}
foreach ($cache_info['cache_list'] as &$entry)
{
if ($entry['info'] !== $id)
{
continue;
}
$success = FALSE;
$metadata = array(
'expire' => ($entry['ttl'] ? $entry['mtime'] + $entry['ttl'] : 0),
'mtime' => $entry['ttl'],
'data' => apc_fetch($id, $success)
);
return ($success === TRUE) ? $metadata : FALSE;
}
return FALSE;
}
// ------------------------------------------------------------------------
/**
* is_supported()
*
* Check to see if APC is available on this system, bail if it isn't.
*
* @return bool
*/
public function is_supported()
{
return (extension_loaded('apc') && ini_get('apc.enabled'));
}
}
PK ! K Cache/drivers/Cache_wincache.phpnu [ is_supported())
{
log_message('error', 'Cache: Failed to initialize Wincache; extension not loaded/enabled?');
}
}
// ------------------------------------------------------------------------
/**
* Get
*
* Look for a value in the cache. If it exists, return the data,
* if not, return FALSE
*
* @param string $id Cache Ide
* @return mixed Value that is stored/FALSE on failure
*/
public function get($id)
{
$success = FALSE;
$data = wincache_ucache_get($id, $success);
// Success returned by reference from wincache_ucache_get()
return ($success) ? $data : FALSE;
}
// ------------------------------------------------------------------------
/**
* Cache Save
*
* @param string $id Cache ID
* @param mixed $data Data to store
* @param int $ttl Time to live (in seconds)
* @param bool $raw Whether to store the raw value (unused)
* @return bool true on success/false on failure
*/
public function save($id, $data, $ttl = 60, $raw = FALSE)
{
return wincache_ucache_set($id, $data, $ttl);
}
// ------------------------------------------------------------------------
/**
* Delete from Cache
*
* @param mixed unique identifier of the item in the cache
* @return bool true on success/false on failure
*/
public function delete($id)
{
return wincache_ucache_delete($id);
}
// ------------------------------------------------------------------------
/**
* Increment a raw value
*
* @param string $id Cache ID
* @param int $offset Step/value to add
* @return mixed New value on success or FALSE on failure
*/
public function increment($id, $offset = 1)
{
$success = FALSE;
$value = wincache_ucache_inc($id, $offset, $success);
return ($success === TRUE) ? $value : FALSE;
}
// ------------------------------------------------------------------------
/**
* Decrement a raw value
*
* @param string $id Cache ID
* @param int $offset Step/value to reduce by
* @return mixed New value on success or FALSE on failure
*/
public function decrement($id, $offset = 1)
{
$success = FALSE;
$value = wincache_ucache_dec($id, $offset, $success);
return ($success === TRUE) ? $value : FALSE;
}
// ------------------------------------------------------------------------
/**
* Clean the cache
*
* @return bool false on failure/true on success
*/
public function clean()
{
return wincache_ucache_clear();
}
// ------------------------------------------------------------------------
/**
* Cache Info
*
* @return mixed array on success, false on failure
*/
public function cache_info()
{
return wincache_ucache_info(TRUE);
}
// ------------------------------------------------------------------------
/**
* Get Cache Metadata
*
* @param mixed key to get cache metadata on
* @return mixed array on success/false on failure
*/
public function get_metadata($id)
{
if ($stored = wincache_ucache_info(FALSE, $id))
{
$age = $stored['ucache_entries'][1]['age_seconds'];
$ttl = $stored['ucache_entries'][1]['ttl_seconds'];
$hitcount = $stored['ucache_entries'][1]['hitcount'];
return array(
'expire' => $ttl - $age,
'hitcount' => $hitcount,
'age' => $age,
'ttl' => $ttl
);
}
return FALSE;
}
// ------------------------------------------------------------------------
/**
* is_supported()
*
* Check to see if WinCache is available on this system, bail if it isn't.
*
* @return bool
*/
public function is_supported()
{
return (extension_loaded('wincache') && ini_get('wincache.ucenabled'));
}
}
PK ! ( Cache/drivers/index.htmlnu [
403 Forbidden
Directory access is forbidden.
PK ! F Cache/Cache.phpnu [ _adapter = $config['adapter'];
isset($config['backup']) && $this->_backup_driver = $config['backup'];
isset($config['key_prefix']) && $this->key_prefix = $config['key_prefix'];
// If the specified adapter isn't available, check the backup.
if ( ! $this->is_supported($this->_adapter))
{
if ( ! $this->is_supported($this->_backup_driver))
{
// Backup isn't supported either. Default to 'Dummy' driver.
log_message('error', 'Cache adapter "'.$this->_adapter.'" and backup "'.$this->_backup_driver.'" are both unavailable. Cache is now using "Dummy" adapter.');
$this->_adapter = 'dummy';
}
else
{
// Backup is supported. Set it to primary.
log_message('debug', 'Cache adapter "'.$this->_adapter.'" is unavailable. Falling back to "'.$this->_backup_driver.'" backup adapter.');
$this->_adapter = $this->_backup_driver;
}
}
}
// ------------------------------------------------------------------------
/**
* Get
*
* Look for a value in the cache. If it exists, return the data
* if not, return FALSE
*
* @param string $id
* @return mixed value matching $id or FALSE on failure
*/
public function get($id)
{
return $this->{$this->_adapter}->get($this->key_prefix.$id);
}
// ------------------------------------------------------------------------
/**
* Cache Save
*
* @param string $id Cache ID
* @param mixed $data Data to store
* @param int $ttl Cache TTL (in seconds)
* @param bool $raw Whether to store the raw value
* @return bool TRUE on success, FALSE on failure
*/
public function save($id, $data, $ttl = 60, $raw = FALSE)
{
return $this->{$this->_adapter}->save($this->key_prefix.$id, $data, $ttl, $raw);
}
// ------------------------------------------------------------------------
/**
* Delete from Cache
*
* @param string $id Cache ID
* @return bool TRUE on success, FALSE on failure
*/
public function delete($id)
{
return $this->{$this->_adapter}->delete($this->key_prefix.$id);
}
// ------------------------------------------------------------------------
/**
* Increment a raw value
*
* @param string $id Cache ID
* @param int $offset Step/value to add
* @return mixed New value on success or FALSE on failure
*/
public function increment($id, $offset = 1)
{
return $this->{$this->_adapter}->increment($this->key_prefix.$id, $offset);
}
// ------------------------------------------------------------------------
/**
* Decrement a raw value
*
* @param string $id Cache ID
* @param int $offset Step/value to reduce by
* @return mixed New value on success or FALSE on failure
*/
public function decrement($id, $offset = 1)
{
return $this->{$this->_adapter}->decrement($this->key_prefix.$id, $offset);
}
// ------------------------------------------------------------------------
/**
* Clean the cache
*
* @return bool TRUE on success, FALSE on failure
*/
public function clean()
{
return $this->{$this->_adapter}->clean();
}
// ------------------------------------------------------------------------
/**
* Cache Info
*
* @param string $type = 'user' user/filehits
* @return mixed array containing cache info on success OR FALSE on failure
*/
public function cache_info($type = 'user')
{
return $this->{$this->_adapter}->cache_info($type);
}
// ------------------------------------------------------------------------
/**
* Get Cache Metadata
*
* @param string $id key to get cache metadata on
* @return mixed cache item metadata
*/
public function get_metadata($id)
{
return $this->{$this->_adapter}->get_metadata($this->key_prefix.$id);
}
// ------------------------------------------------------------------------
/**
* Is the requested driver supported in this environment?
*
* @param string $driver The driver to test
* @return array
*/
public function is_supported($driver)
{
static $support;
if ( ! isset($support, $support[$driver]))
{
$support[$driver] = $this->{$driver}->is_supported();
}
return $support[$driver];
}
}
PK ! ( Cache/index.htmlnu [
403 Forbidden
Directory access is forbidden.
PK ! ⟧9' ' Email.phpnu [ '1 (Highest)',
2 => '2 (High)',
3 => '3 (Normal)',
4 => '4 (Low)',
5 => '5 (Lowest)'
);
/**
* mbstring.func_overload flag
*
* @var bool
*/
protected static $func_overload;
// --------------------------------------------------------------------
/**
* Constructor - Sets Email Preferences
*
* The constructor can be passed an array of config values
*
* @param array $config = array()
* @return void
*/
public function __construct(array $config = array())
{
$this->charset = config_item('charset');
$this->initialize($config);
$this->_safe_mode = ( ! is_php('5.4') && ini_get('safe_mode'));
isset(self::$func_overload) OR self::$func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload'));
log_message('info', 'Email Class Initialized');
}
// --------------------------------------------------------------------
/**
* Initialize preferences
*
* @param array $config
* @return CI_Email
*/
public function initialize(array $config = array())
{
$this->clear();
foreach ($config as $key => $val)
{
if (isset($this->$key))
{
$method = 'set_'.$key;
if (method_exists($this, $method))
{
$this->$method($val);
}
else
{
$this->$key = $val;
}
}
}
$this->charset = strtoupper($this->charset);
$this->_smtp_auth = isset($this->smtp_user[0], $this->smtp_pass[0]);
return $this;
}
// --------------------------------------------------------------------
/**
* Initialize the Email Data
*
* @param bool
* @return CI_Email
*/
public function clear($clear_attachments = FALSE)
{
$this->_subject = '';
$this->_body = '';
$this->_finalbody = '';
$this->_header_str = '';
$this->_replyto_flag = FALSE;
$this->_recipients = array();
$this->_cc_array = array();
$this->_bcc_array = array();
$this->_headers = array();
$this->_debug_msg = array();
$this->set_header('Date', $this->_set_date());
if ($clear_attachments !== FALSE)
{
$this->_attachments = array();
}
return $this;
}
// --------------------------------------------------------------------
/**
* Set FROM
*
* @param string $from
* @param string $name
* @param string $return_path = NULL Return-Path
* @return CI_Email
*/
public function from($from, $name = '', $return_path = NULL)
{
if (preg_match('/\<(.*)\>/', $from, $match))
{
$from = $match[1];
}
if ($this->validate)
{
$this->validate_email($this->_str_to_array($from));
if ($return_path)
{
$this->validate_email($this->_str_to_array($return_path));
}
}
// prepare the display name
if ($name !== '')
{
// only use Q encoding if there are characters that would require it
if ( ! preg_match('/[\200-\377]/', $name))
{
// add slashes for non-printing characters, slashes, and double quotes, and surround it in double quotes
$name = '"'.addcslashes($name, "\0..\37\177'\"\\").'"';
}
else
{
$name = $this->_prep_q_encoding($name);
}
}
$this->set_header('From', $name.' <'.$from.'>');
isset($return_path) OR $return_path = $from;
$this->set_header('Return-Path', '<'.$return_path.'>');
return $this;
}
// --------------------------------------------------------------------
/**
* Set Reply-to
*
* @param string
* @param string
* @return CI_Email
*/
public function reply_to($replyto, $name = '')
{
if (preg_match('/\<(.*)\>/', $replyto, $match))
{
$replyto = $match[1];
}
if ($this->validate)
{
$this->validate_email($this->_str_to_array($replyto));
}
if ($name !== '')
{
// only use Q encoding if there are characters that would require it
if ( ! preg_match('/[\200-\377]/', $name))
{
// add slashes for non-printing characters, slashes, and double quotes, and surround it in double quotes
$name = '"'.addcslashes($name, "\0..\37\177'\"\\").'"';
}
else
{
$name = $this->_prep_q_encoding($name);
}
}
$this->set_header('Reply-To', $name.' <'.$replyto.'>');
$this->_replyto_flag = TRUE;
return $this;
}
// --------------------------------------------------------------------
/**
* Set Recipients
*
* @param string
* @return CI_Email
*/
public function to($to)
{
$to = $this->_str_to_array($to);
$to = $this->clean_email($to);
if ($this->validate)
{
$this->validate_email($to);
}
if ($this->_get_protocol() !== 'mail')
{
$this->set_header('To', implode(', ', $to));
}
$this->_recipients = $to;
return $this;
}
// --------------------------------------------------------------------
/**
* Set CC
*
* @param string
* @return CI_Email
*/
public function cc($cc)
{
$cc = $this->clean_email($this->_str_to_array($cc));
if ($this->validate)
{
$this->validate_email($cc);
}
$this->set_header('Cc', implode(', ', $cc));
if ($this->_get_protocol() === 'smtp')
{
$this->_cc_array = $cc;
}
return $this;
}
// --------------------------------------------------------------------
/**
* Set BCC
*
* @param string
* @param string
* @return CI_Email
*/
public function bcc($bcc, $limit = '')
{
if ($limit !== '' && is_numeric($limit))
{
$this->bcc_batch_mode = TRUE;
$this->bcc_batch_size = $limit;
}
$bcc = $this->clean_email($this->_str_to_array($bcc));
if ($this->validate)
{
$this->validate_email($bcc);
}
if ($this->_get_protocol() === 'smtp' OR ($this->bcc_batch_mode && count($bcc) > $this->bcc_batch_size))
{
$this->_bcc_array = $bcc;
}
else
{
$this->set_header('Bcc', implode(', ', $bcc));
}
return $this;
}
// --------------------------------------------------------------------
/**
* Set Email Subject
*
* @param string
* @return CI_Email
*/
public function subject($subject)
{
$subject = $this->_prep_q_encoding($subject);
$this->set_header('Subject', $subject);
return $this;
}
// --------------------------------------------------------------------
/**
* Set Body
*
* @param string
* @return CI_Email
*/
public function message($body)
{
$this->_body = rtrim(str_replace("\r", '', $body));
/* strip slashes only if magic quotes is ON
if we do it with magic quotes OFF, it strips real, user-inputted chars.
NOTE: In PHP 5.4 get_magic_quotes_gpc() will always return 0 and
it will probably not exist in future versions at all.
*/
if ( ! is_php('5.4') && get_magic_quotes_gpc())
{
$this->_body = stripslashes($this->_body);
}
return $this;
}
// --------------------------------------------------------------------
/**
* Assign file attachments
*
* @param string $file Can be local path, URL or buffered content
* @param string $disposition = 'attachment'
* @param string $newname = NULL
* @param string $mime = ''
* @return CI_Email
*/
public function attach($file, $disposition = '', $newname = NULL, $mime = '')
{
if ($mime === '')
{
if (strpos($file, '://') === FALSE && ! file_exists($file))
{
$this->_set_error_message('lang:email_attachment_missing', $file);
return FALSE;
}
if ( ! $fp = @fopen($file, 'rb'))
{
$this->_set_error_message('lang:email_attachment_unreadable', $file);
return FALSE;
}
$file_content = stream_get_contents($fp);
$mime = $this->_mime_types(pathinfo($file, PATHINFO_EXTENSION));
fclose($fp);
}
else
{
$file_content =& $file; // buffered file
}
$this->_attachments[] = array(
'name' => array($file, $newname),
'disposition' => empty($disposition) ? 'attachment' : $disposition, // Can also be 'inline' Not sure if it matters
'type' => $mime,
'content' => chunk_split(base64_encode($file_content)),
'multipart' => 'mixed'
);
return $this;
}
// --------------------------------------------------------------------
/**
* Set and return attachment Content-ID
*
* Useful for attached inline pictures
*
* @param string $filename
* @return string
*/
public function attachment_cid($filename)
{
for ($i = 0, $c = count($this->_attachments); $i < $c; $i++)
{
if ($this->_attachments[$i]['name'][0] === $filename)
{
$this->_attachments[$i]['multipart'] = 'related';
$this->_attachments[$i]['cid'] = uniqid(basename($this->_attachments[$i]['name'][0]).'@');
return $this->_attachments[$i]['cid'];
}
}
return FALSE;
}
// --------------------------------------------------------------------
/**
* Add a Header Item
*
* @param string
* @param string
* @return CI_Email
*/
public function set_header($header, $value)
{
$this->_headers[$header] = str_replace(array("\n", "\r"), '', $value);
return $this;
}
// --------------------------------------------------------------------
/**
* Convert a String to an Array
*
* @param string
* @return array
*/
protected function _str_to_array($email)
{
if ( ! is_array($email))
{
return (strpos($email, ',') !== FALSE)
? preg_split('/[\s,]/', $email, -1, PREG_SPLIT_NO_EMPTY)
: (array) trim($email);
}
return $email;
}
// --------------------------------------------------------------------
/**
* Set Multipart Value
*
* @param string
* @return CI_Email
*/
public function set_alt_message($str)
{
$this->alt_message = (string) $str;
return $this;
}
// --------------------------------------------------------------------
/**
* Set Mailtype
*
* @param string
* @return CI_Email
*/
public function set_mailtype($type = 'text')
{
$this->mailtype = ($type === 'html') ? 'html' : 'text';
return $this;
}
// --------------------------------------------------------------------
/**
* Set Wordwrap
*
* @param bool
* @return CI_Email
*/
public function set_wordwrap($wordwrap = TRUE)
{
$this->wordwrap = (bool) $wordwrap;
return $this;
}
// --------------------------------------------------------------------
/**
* Set Protocol
*
* @param string
* @return CI_Email
*/
public function set_protocol($protocol = 'mail')
{
$this->protocol = in_array($protocol, $this->_protocols, TRUE) ? strtolower($protocol) : 'mail';
return $this;
}
// --------------------------------------------------------------------
/**
* Set Priority
*
* @param int
* @return CI_Email
*/
public function set_priority($n = 3)
{
$this->priority = preg_match('/^[1-5]$/', $n) ? (int) $n : 3;
return $this;
}
// --------------------------------------------------------------------
/**
* Set Newline Character
*
* @param string
* @return CI_Email
*/
public function set_newline($newline = "\n")
{
$this->newline = in_array($newline, array("\n", "\r\n", "\r")) ? $newline : "\n";
return $this;
}
// --------------------------------------------------------------------
/**
* Set CRLF
*
* @param string
* @return CI_Email
*/
public function set_crlf($crlf = "\n")
{
$this->crlf = ($crlf !== "\n" && $crlf !== "\r\n" && $crlf !== "\r") ? "\n" : $crlf;
return $this;
}
// --------------------------------------------------------------------
/**
* Get the Message ID
*
* @return string
*/
protected function _get_message_id()
{
$from = str_replace(array('>', '<'), '', $this->_headers['Return-Path']);
return '<'.uniqid('').strstr($from, '@').'>';
}
// --------------------------------------------------------------------
/**
* Get Mail Protocol
*
* @return mixed
*/
protected function _get_protocol()
{
$this->protocol = strtolower($this->protocol);
in_array($this->protocol, $this->_protocols, TRUE) OR $this->protocol = 'mail';
return $this->protocol;
}
// --------------------------------------------------------------------
/**
* Get Mail Encoding
*
* @return string
*/
protected function _get_encoding()
{
in_array($this->_encoding, $this->_bit_depths) OR $this->_encoding = '8bit';
foreach ($this->_base_charsets as $charset)
{
if (strpos($this->charset, $charset) === 0)
{
$this->_encoding = '7bit';
}
}
return $this->_encoding;
}
// --------------------------------------------------------------------
/**
* Get content type (text/html/attachment)
*
* @return string
*/
protected function _get_content_type()
{
if ($this->mailtype === 'html')
{
return empty($this->_attachments) ? 'html' : 'html-attach';
}
elseif ($this->mailtype === 'text' && ! empty($this->_attachments))
{
return 'plain-attach';
}
return 'plain';
}
// --------------------------------------------------------------------
/**
* Set RFC 822 Date
*
* @return string
*/
protected function _set_date()
{
$timezone = date('Z');
$operator = ($timezone[0] === '-') ? '-' : '+';
$timezone = abs($timezone);
$timezone = floor($timezone/3600) * 100 + ($timezone % 3600) / 60;
return sprintf('%s %s%04d', date('D, j M Y H:i:s'), $operator, $timezone);
}
// --------------------------------------------------------------------
/**
* Mime message
*
* @return string
*/
protected function _get_mime_message()
{
return 'This is a multi-part message in MIME format.'.$this->newline.'Your email application may not support this format.';
}
// --------------------------------------------------------------------
/**
* Validate Email Address
*
* @param string
* @return bool
*/
public function validate_email($email)
{
if ( ! is_array($email))
{
$this->_set_error_message('lang:email_must_be_array');
return FALSE;
}
foreach ($email as $val)
{
if ( ! $this->valid_email($val))
{
$this->_set_error_message('lang:email_invalid_address', $val);
return FALSE;
}
}
return TRUE;
}
// --------------------------------------------------------------------
/**
* Email Validation
*
* @param string
* @return bool
*/
public function valid_email($email)
{
if (function_exists('idn_to_ascii') && strpos($email, '@'))
{
list($account, $domain) = explode('@', $email, 2);
$domain = defined('INTL_IDNA_VARIANT_UTS46')
? idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46)
: idn_to_ascii($domain);
if ($domain !== FALSE)
{
$email = $account.'@'.$domain;
}
}
return (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
}
// --------------------------------------------------------------------
/**
* Clean Extended Email Address: Joe Smith
*
* @param string
* @return string
*/
public function clean_email($email)
{
if ( ! is_array($email))
{
return preg_match('/\<(.*)\>/', $email, $match) ? $match[1] : $email;
}
$clean_email = array();
foreach ($email as $addy)
{
$clean_email[] = preg_match('/\<(.*)\>/', $addy, $match) ? $match[1] : $addy;
}
return $clean_email;
}
// --------------------------------------------------------------------
/**
* Build alternative plain text message
*
* Provides the raw message for use in plain-text headers of
* HTML-formatted emails.
* If the user hasn't specified his own alternative message
* it creates one by stripping the HTML
*
* @return string
*/
protected function _get_alt_message()
{
if ( ! empty($this->alt_message))
{
return ($this->wordwrap)
? $this->word_wrap($this->alt_message, 76)
: $this->alt_message;
}
$body = preg_match('/\(.*)\<\/body\>/si', $this->_body, $match) ? $match[1] : $this->_body;
$body = str_replace("\t", '', preg_replace('#' . PHP_EOL;
$html .= '' . PHP_EOL;
$html .= ' ' . PHP_EOL;
$html .= ' ' . PHP_EOL;
if ($properties->getTitle() > '')
$html .= ' ' . htmlspecialchars($properties->getTitle()) . '' . PHP_EOL;
if ($properties->getCreator() > '')
$html .= ' ' . PHP_EOL;
if ($properties->getTitle() > '')
$html .= ' ' . PHP_EOL;
if ($properties->getDescription() > '')
$html .= ' ' . PHP_EOL;
if ($properties->getSubject() > '')
$html .= ' ' . PHP_EOL;
if ($properties->getKeywords() > '')
$html .= ' ' . PHP_EOL;
if ($properties->getCategory() > '')
$html .= ' ' . PHP_EOL;
if ($properties->getCompany() > '')
$html .= ' ' . PHP_EOL;
if ($properties->getManager() > '')
$html .= ' ' . PHP_EOL;
if ($pIncludeStyles) {
$html .= $this->generateStyles(true);
}
$html .= ' ' . PHP_EOL;
$html .= '' . PHP_EOL;
$html .= ' ' . PHP_EOL;
// Return
return $html;
}
/**
* Generate sheet data
*
* @return string
* @throws PHPExcel_Writer_Exception
*/
public function generateSheetData() {
// PHPExcel object known?
if (is_null($this->_phpExcel)) {
throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.');
}
// Ensure that Spans have been calculated?
if (!$this->_spansAreCalculated) {
$this->_calculateSpans();
}
// Fetch sheets
$sheets = array();
if (is_null($this->_sheetIndex)) {
$sheets = $this->_phpExcel->getAllSheets();
} else {
$sheets[] = $this->_phpExcel->getSheet($this->_sheetIndex);
}
// Construct HTML
$html = '';
// Loop all sheets
$sheetId = 0;
foreach ($sheets as $sheet) {
// Write table header
$html .= $this->_generateTableHeader($sheet);
// Get worksheet dimension
$dimension = explode(':', $sheet->calculateWorksheetDimension());
$dimension[0] = PHPExcel_Cell::coordinateFromString($dimension[0]);
$dimension[0][0] = PHPExcel_Cell::columnIndexFromString($dimension[0][0]) - 1;
$dimension[1] = PHPExcel_Cell::coordinateFromString($dimension[1]);
$dimension[1][0] = PHPExcel_Cell::columnIndexFromString($dimension[1][0]) - 1;
// row min,max
$rowMin = $dimension[0][1];
$rowMax = $dimension[1][1];
// calculate start of ,
$tbodyStart = $rowMin;
$theadStart = $theadEnd = 0; // default: no no
if ($sheet->getPageSetup()->isRowsToRepeatAtTopSet()) {
$rowsToRepeatAtTop = $sheet->getPageSetup()->getRowsToRepeatAtTop();
// we can only support repeating rows that start at top row
if ($rowsToRepeatAtTop[0] == 1) {
$theadStart = $rowsToRepeatAtTop[0];
$theadEnd = $rowsToRepeatAtTop[1];
$tbodyStart = $rowsToRepeatAtTop[1] + 1;
}
}
// Loop through cells
$row = $rowMin-1;
while($row++ < $rowMax) {
// ?
if ($row == $theadStart) {
$html .= ' ' . PHP_EOL;
}
// ?
if ($row == $tbodyStart) {
$html .= ' ' . PHP_EOL;
}
// Write row if there are HTML table cells in it
if ( !isset($this->_isSpannedRow[$sheet->getParent()->getIndex($sheet)][$row]) ) {
// Start a new rowData
$rowData = array();
// Loop through columns
$column = $dimension[0][0] - 1;
while($column++ < $dimension[1][0]) {
// Cell exists?
if ($sheet->cellExistsByColumnAndRow($column, $row)) {
$rowData[$column] = PHPExcel_Cell::stringFromColumnIndex($column) . $row;
} else {
$rowData[$column] = '';
}
}
$html .= $this->_generateRow($sheet, $rowData, $row - 1);
}
// ?
if ($row == $theadEnd) {
$html .= ' ' . PHP_EOL;
}
}
$html .= $this->_extendRowsForChartsAndImages($sheet, $row);
// Close table body.
$html .= ' ' . PHP_EOL;
// Write table footer
$html .= $this->_generateTableFooter();
// Writing PDF?
if ($this->_isPdf) {
if (is_null($this->_sheetIndex) && $sheetId + 1 < $this->_phpExcel->getSheetCount()) {
$html .= '';
}
}
// Next sheet
++$sheetId;
}
// Return
return $html;
}
/**
* Generate sheet tabs
*
* @return string
* @throws PHPExcel_Writer_Exception
*/
public function generateNavigation()
{
// PHPExcel object known?
if (is_null($this->_phpExcel)) {
throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.');
}
// Fetch sheets
$sheets = array();
if (is_null($this->_sheetIndex)) {
$sheets = $this->_phpExcel->getAllSheets();
} else {
$sheets[] = $this->_phpExcel->getSheet($this->_sheetIndex);
}
// Construct HTML
$html = '';
// Only if there are more than 1 sheets
if (count($sheets) > 1) {
// Loop all sheets
$sheetId = 0;
$html .= '' . PHP_EOL;
}
return $html;
}
private function _extendRowsForChartsAndImages(PHPExcel_Worksheet $pSheet, $row) {
$rowMax = $row;
$colMax = 'A';
if ($this->_includeCharts) {
foreach ($pSheet->getChartCollection() as $chart) {
if ($chart instanceof PHPExcel_Chart) {
$chartCoordinates = $chart->getTopLeftPosition();
$chartTL = PHPExcel_Cell::coordinateFromString($chartCoordinates['cell']);
$chartCol = PHPExcel_Cell::columnIndexFromString($chartTL[0]);
if ($chartTL[1] > $rowMax) {
$rowMax = $chartTL[1];
if ($chartCol > PHPExcel_Cell::columnIndexFromString($colMax)) {
$colMax = $chartTL[0];
}
}
}
}
}
foreach ($pSheet->getDrawingCollection() as $drawing) {
if ($drawing instanceof PHPExcel_Worksheet_Drawing) {
$imageTL = PHPExcel_Cell::coordinateFromString($drawing->getCoordinates());
$imageCol = PHPExcel_Cell::columnIndexFromString($imageTL[0]);
if ($imageTL[1] > $rowMax) {
$rowMax = $imageTL[1];
if ($imageCol > PHPExcel_Cell::columnIndexFromString($colMax)) {
$colMax = $imageTL[0];
}
}
}
}
$html = '';
$colMax++;
while ($row < $rowMax) {
$html .= '';
for ($col = 'A'; $col != $colMax; ++$col) {
$html .= '| ';
$html .= $this->_writeImageInCell($pSheet, $col.$row);
if ($this->_includeCharts) {
$html .= $this->_writeChartInCell($pSheet, $col.$row);
}
$html .= ' | ';
}
++$row;
$html .= '
';
}
return $html;
}
/**
* Generate image tag in cell
*
* @param PHPExcel_Worksheet $pSheet PHPExcel_Worksheet
* @param string $coordinates Cell coordinates
* @return string
* @throws PHPExcel_Writer_Exception
*/
private function _writeImageInCell(PHPExcel_Worksheet $pSheet, $coordinates) {
// Construct HTML
$html = '';
// Write images
foreach ($pSheet->getDrawingCollection() as $drawing) {
if ($drawing instanceof PHPExcel_Worksheet_Drawing) {
if ($drawing->getCoordinates() == $coordinates) {
$filename = $drawing->getPath();
// Strip off eventual '.'
if (substr($filename, 0, 1) == '.') {
$filename = substr($filename, 1);
}
// Prepend images root
$filename = $this->getImagesRoot() . $filename;
// Strip off eventual '.'
if (substr($filename, 0, 1) == '.' && substr($filename, 0, 2) != './') {
$filename = substr($filename, 1);
}
// Convert UTF8 data to PCDATA
$filename = htmlspecialchars($filename);
$html .= PHP_EOL;
if ((!$this->_embedImages) || ($this->_isPdf)) {
$imageData = $filename;
} else {
$imageDetails = getimagesize($filename);
if ($fp = fopen($filename,"rb", 0)) {
$picture = fread($fp,filesize($filename));
fclose($fp);
// base64 encode the binary data, then break it
// into chunks according to RFC 2045 semantics
$base64 = chunk_split(base64_encode($picture));
$imageData = 'data:'.$imageDetails['mime'].';base64,' . $base64;
} else {
$imageData = $filename;
}
}
$html .= '';
$html .= '

';
$html .= '
';
}
}
}
// Return
return $html;
}
/**
* Generate chart tag in cell
*
* @param PHPExcel_Worksheet $pSheet PHPExcel_Worksheet
* @param string $coordinates Cell coordinates
* @return string
* @throws PHPExcel_Writer_Exception
*/
private function _writeChartInCell(PHPExcel_Worksheet $pSheet, $coordinates) {
// Construct HTML
$html = '';
// Write charts
foreach ($pSheet->getChartCollection() as $chart) {
if ($chart instanceof PHPExcel_Chart) {
$chartCoordinates = $chart->getTopLeftPosition();
if ($chartCoordinates['cell'] == $coordinates) {
$chartFileName = PHPExcel_Shared_File::sys_get_temp_dir().'/'.uniqid().'.png';
if (!$chart->render($chartFileName)) {
return;
}
$html .= PHP_EOL;
$imageDetails = getimagesize($chartFileName);
if ($fp = fopen($chartFileName,"rb", 0)) {
$picture = fread($fp,filesize($chartFileName));
fclose($fp);
// base64 encode the binary data, then break it
// into chunks according to RFC 2045 semantics
$base64 = chunk_split(base64_encode($picture));
$imageData = 'data:'.$imageDetails['mime'].';base64,' . $base64;
$html .= '';
$html .= '

' . PHP_EOL;
$html .= '
';
unlink($chartFileName);
}
}
}
}
// Return
return $html;
}
/**
* Generate CSS styles
*
* @param boolean $generateSurroundingHTML Generate surrounding HTML tags? ()
* @return string
* @throws PHPExcel_Writer_Exception
*/
public function generateStyles($generateSurroundingHTML = true) {
// PHPExcel object known?
if (is_null($this->_phpExcel)) {
throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.');
}
// Build CSS
$css = $this->buildCSS($generateSurroundingHTML);
// Construct HTML
$html = '';
// Start styles
if ($generateSurroundingHTML) {
$html .= ' ' . PHP_EOL;
}
// Return
return $html;
}
/**
* Build CSS styles
*
* @param boolean $generateSurroundingHTML Generate surrounding HTML style? (html { })
* @return array
* @throws PHPExcel_Writer_Exception
*/
public function buildCSS($generateSurroundingHTML = true) {
// PHPExcel object known?
if (is_null($this->_phpExcel)) {
throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.');
}
// Cached?
if (!is_null($this->_cssStyles)) {
return $this->_cssStyles;
}
// Ensure that spans have been calculated
if (!$this->_spansAreCalculated) {
$this->_calculateSpans();
}
// Construct CSS
$css = array();
// Start styles
if ($generateSurroundingHTML) {
// html { }
$css['html']['font-family'] = 'Calibri, Arial, Helvetica, sans-serif';
$css['html']['font-size'] = '11pt';
$css['html']['background-color'] = 'white';
}
// table { }
$css['table']['border-collapse'] = 'collapse';
if (!$this->_isPdf) {
$css['table']['page-break-after'] = 'always';
}
// .gridlines td { }
$css['.gridlines td']['border'] = '1px dotted black';
// .b {}
$css['.b']['text-align'] = 'center'; // BOOL
// .e {}
$css['.e']['text-align'] = 'center'; // ERROR
// .f {}
$css['.f']['text-align'] = 'right'; // FORMULA
// .inlineStr {}
$css['.inlineStr']['text-align'] = 'left'; // INLINE
// .n {}
$css['.n']['text-align'] = 'right'; // NUMERIC
// .s {}
$css['.s']['text-align'] = 'left'; // STRING
// Calculate cell style hashes
foreach ($this->_phpExcel->getCellXfCollection() as $index => $style) {
$css['td.style' . $index] = $this->_createCSSStyle( $style );
}
// Fetch sheets
$sheets = array();
if (is_null($this->_sheetIndex)) {
$sheets = $this->_phpExcel->getAllSheets();
} else {
$sheets[] = $this->_phpExcel->getSheet($this->_sheetIndex);
}
// Build styles per sheet
foreach ($sheets as $sheet) {
// Calculate hash code
$sheetIndex = $sheet->getParent()->getIndex($sheet);
// Build styles
// Calculate column widths
$sheet->calculateColumnWidths();
// col elements, initialize
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($sheet->getHighestColumn()) - 1;
$column = -1;
while($column++ < $highestColumnIndex) {
$this->_columnWidths[$sheetIndex][$column] = 42; // approximation
$css['table.sheet' . $sheetIndex . ' col.col' . $column]['width'] = '42pt';
}
// col elements, loop through columnDimensions and set width
foreach ($sheet->getColumnDimensions() as $columnDimension) {
if (($width = PHPExcel_Shared_Drawing::cellDimensionToPixels($columnDimension->getWidth(), $this->_defaultFont)) >= 0) {
$width = PHPExcel_Shared_Drawing::pixelsToPoints($width);
$column = PHPExcel_Cell::columnIndexFromString($columnDimension->getColumnIndex()) - 1;
$this->_columnWidths[$sheetIndex][$column] = $width;
$css['table.sheet' . $sheetIndex . ' col.col' . $column]['width'] = $width . 'pt';
if ($columnDimension->getVisible() === false) {
$css['table.sheet' . $sheetIndex . ' col.col' . $column]['visibility'] = 'collapse';
$css['table.sheet' . $sheetIndex . ' col.col' . $column]['*display'] = 'none'; // target IE6+7
}
}
}
// Default row height
$rowDimension = $sheet->getDefaultRowDimension();
// table.sheetN tr { }
$css['table.sheet' . $sheetIndex . ' tr'] = array();
if ($rowDimension->getRowHeight() == -1) {
$pt_height = PHPExcel_Shared_Font::getDefaultRowHeightByFont($this->_phpExcel->getDefaultStyle()->getFont());
} else {
$pt_height = $rowDimension->getRowHeight();
}
$css['table.sheet' . $sheetIndex . ' tr']['height'] = $pt_height . 'pt';
if ($rowDimension->getVisible() === false) {
$css['table.sheet' . $sheetIndex . ' tr']['display'] = 'none';
$css['table.sheet' . $sheetIndex . ' tr']['visibility'] = 'hidden';
}
// Calculate row heights
foreach ($sheet->getRowDimensions() as $rowDimension) {
$row = $rowDimension->getRowIndex() - 1;
// table.sheetN tr.rowYYYYYY { }
$css['table.sheet' . $sheetIndex . ' tr.row' . $row] = array();
if ($rowDimension->getRowHeight() == -1) {
$pt_height = PHPExcel_Shared_Font::getDefaultRowHeightByFont($this->_phpExcel->getDefaultStyle()->getFont());
} else {
$pt_height = $rowDimension->getRowHeight();
}
$css['table.sheet' . $sheetIndex . ' tr.row' . $row]['height'] = $pt_height . 'pt';
if ($rowDimension->getVisible() === false) {
$css['table.sheet' . $sheetIndex . ' tr.row' . $row]['display'] = 'none';
$css['table.sheet' . $sheetIndex . ' tr.row' . $row]['visibility'] = 'hidden';
}
}
}
// Cache
if (is_null($this->_cssStyles)) {
$this->_cssStyles = $css;
}
// Return
return $css;
}
/**
* Create CSS style
*
* @param PHPExcel_Style $pStyle PHPExcel_Style
* @return array
*/
private function _createCSSStyle(PHPExcel_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;
}
/**
* Create CSS style (PHPExcel_Style_Alignment)
*
* @param PHPExcel_Style_Alignment $pStyle PHPExcel_Style_Alignment
* @return array
*/
private function _createCSSStyleAlignment(PHPExcel_Style_Alignment $pStyle) {
// Construct CSS
$css = array();
// Create CSS
$css['vertical-align'] = $this->_mapVAlign($pStyle->getVertical());
if ($textAlign = $this->_mapHAlign($pStyle->getHorizontal())) {
$css['text-align'] = $textAlign;
if(in_array($textAlign,array('left','right')))
$css['padding-'.$textAlign] = (string)((int)$pStyle->getIndent() * 9).'px';
}
// Return
return $css;
}
/**
* Create CSS style (PHPExcel_Style_Font)
*
* @param PHPExcel_Style_Font $pStyle PHPExcel_Style_Font
* @return array
*/
private function _createCSSStyleFont(PHPExcel_Style_Font $pStyle) {
// Construct CSS
$css = array();
// Create CSS
if ($pStyle->getBold()) {
$css['font-weight'] = 'bold';
}
if ($pStyle->getUnderline() != PHPExcel_Style_Font::UNDERLINE_NONE && $pStyle->getStrikethrough()) {
$css['text-decoration'] = 'underline line-through';
} else if ($pStyle->getUnderline() != PHPExcel_Style_Font::UNDERLINE_NONE) {
$css['text-decoration'] = 'underline';
} else if ($pStyle->getStrikethrough()) {
$css['text-decoration'] = 'line-through';
}
if ($pStyle->getItalic()) {
$css['font-style'] = 'italic';
}
$css['color'] = '#' . $pStyle->getColor()->getRGB();
$css['font-family'] = '\'' . $pStyle->getName() . '\'';
$css['font-size'] = $pStyle->getSize() . 'pt';
// Return
return $css;
}
/**
* Create CSS style (PHPExcel_Style_Borders)
*
* @param PHPExcel_Style_Borders $pStyle PHPExcel_Style_Borders
* @return array
*/
private function _createCSSStyleBorders(PHPExcel_Style_Borders $pStyle) {
// Construct CSS
$css = array();
// Create CSS
$css['border-bottom'] = $this->_createCSSStyleBorder($pStyle->getBottom());
$css['border-top'] = $this->_createCSSStyleBorder($pStyle->getTop());
$css['border-left'] = $this->_createCSSStyleBorder($pStyle->getLeft());
$css['border-right'] = $this->_createCSSStyleBorder($pStyle->getRight());
// Return
return $css;
}
/**
* Create CSS style (PHPExcel_Style_Border)
*
* @param PHPExcel_Style_Border $pStyle PHPExcel_Style_Border
* @return string
*/
private function _createCSSStyleBorder(PHPExcel_Style_Border $pStyle) {
// Create CSS
// $css = $this->_mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB();
// Create CSS - add !important to non-none border styles for merged cells
$borderStyle = $this->_mapBorderStyle($pStyle->getBorderStyle());
$css = $borderStyle . ' #' . $pStyle->getColor()->getRGB() . (($borderStyle == 'none') ? '' : ' !important');
// Return
return $css;
}
/**
* Create CSS style (PHPExcel_Style_Fill)
*
* @param PHPExcel_Style_Fill $pStyle PHPExcel_Style_Fill
* @return array
*/
private function _createCSSStyleFill(PHPExcel_Style_Fill $pStyle) {
// Construct HTML
$css = array();
// Create CSS
$value = $pStyle->getFillType() == PHPExcel_Style_Fill::FILL_NONE ?
'white' : '#' . $pStyle->getStartColor()->getRGB();
$css['background-color'] = $value;
// Return
return $css;
}
/**
* Generate HTML footer
*/
public function generateHTMLFooter() {
// Construct HTML
$html = '';
$html .= ' ' . PHP_EOL;
$html .= '' . PHP_EOL;
// Return
return $html;
}
/**
* Generate table header
*
* @param PHPExcel_Worksheet $pSheet The worksheet for the table we are writing
* @return string
* @throws PHPExcel_Writer_Exception
*/
private function _generateTableHeader($pSheet) {
$sheetIndex = $pSheet->getParent()->getIndex($pSheet);
// Construct HTML
$html = '';
$html .= $this->_setMargins($pSheet);
if (!$this->_useInlineCss) {
$gridlines = $pSheet->getShowGridlines() ? ' gridlines' : '';
$html .= ' ' . PHP_EOL;
} else {
$style = isset($this->_cssStyles['table']) ?
$this->_assembleCSS($this->_cssStyles['table']) : '';
if ($this->_isPdf && $pSheet->getShowGridlines()) {
$html .= ' ' . PHP_EOL;
} else {
$html .= ' ' . PHP_EOL;
}
}
// Write elements
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn()) - 1;
$i = -1;
while($i++ < $highestColumnIndex) {
if (!$this->_isPdf) {
if (!$this->_useInlineCss) {
$html .= ' ' . PHP_EOL;
} else {
$style = isset($this->_cssStyles['table.sheet' . $sheetIndex . ' col.col' . $i]) ?
$this->_assembleCSS($this->_cssStyles['table.sheet' . $sheetIndex . ' col.col' . $i]) : '';
$html .= ' ' . PHP_EOL;
}
}
}
// Return
return $html;
}
/**
* Generate table footer
*
* @throws PHPExcel_Writer_Exception
*/
private function _generateTableFooter() {
// Construct HTML
$html = '';
$html .= '
' . PHP_EOL;
// Return
return $html;
}
/**
* Generate row
*
* @param PHPExcel_Worksheet $pSheet PHPExcel_Worksheet
* @param array $pValues Array containing cells in a row
* @param int $pRow Row number (0-based)
* @return string
* @throws PHPExcel_Writer_Exception
*/
private function _generateRow(PHPExcel_Worksheet $pSheet, $pValues = null, $pRow = 0) {
if (is_array($pValues)) {
// Construct HTML
$html = '';
// Sheet index
$sheetIndex = $pSheet->getParent()->getIndex($pSheet);
// DomPDF and breaks
if ($this->_isPdf && count($pSheet->getBreaks()) > 0) {
$breaks = $pSheet->getBreaks();
// check if a break is needed before this row
if (isset($breaks['A' . $pRow])) {
// close table:
$html .= $this->_generateTableFooter();
// insert page break
$html .= '';
// open table again: + etc.
$html .= $this->_generateTableHeader($pSheet);
}
}
// Write row start
if (!$this->_useInlineCss) {
$html .= ' ' . PHP_EOL;
} else {
$style = isset($this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow])
? $this->_assembleCSS($this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]) : '';
$html .= '
' . PHP_EOL;
}
// Write cells
$colNum = 0;
foreach ($pValues as $cellAddress) {
$cell = ($cellAddress > '') ? $pSheet->getCell($cellAddress) : '';
$coordinate = PHPExcel_Cell::stringFromColumnIndex($colNum) . ($pRow + 1);
if (!$this->_useInlineCss) {
$cssClass = '';
$cssClass = 'column' . $colNum;
} else {
$cssClass = array();
if (isset($this->_cssStyles['table.sheet' . $sheetIndex . ' td.column' . $colNum])) {
$this->_cssStyles['table.sheet' . $sheetIndex . ' td.column' . $colNum];
}
}
$colSpan = 1;
$rowSpan = 1;
// initialize
$cellData = ' ';
// PHPExcel_Cell
if ($cell instanceof PHPExcel_Cell) {
$cellData = '';
if (is_null($cell->getParent())) {
$cell->attach($pSheet);
}
// Value
if ($cell->getValue() instanceof PHPExcel_RichText) {
// Loop through rich text elements
$elements = $cell->getValue()->getRichTextElements();
foreach ($elements as $element) {
// Rich text start?
if ($element instanceof PHPExcel_RichText_Run) {
$cellData .= '';
if ($element->getFont()->getSuperScript()) {
$cellData .= '';
} else if ($element->getFont()->getSubScript()) {
$cellData .= '';
}
}
// Convert UTF8 data to PCDATA
$cellText = $element->getText();
$cellData .= htmlspecialchars($cellText);
if ($element instanceof PHPExcel_RichText_Run) {
if ($element->getFont()->getSuperScript()) {
$cellData .= '';
} else if ($element->getFont()->getSubScript()) {
$cellData .= '';
}
$cellData .= '';
}
}
} else {
if ($this->_preCalculateFormulas) {
$cellData = PHPExcel_Style_NumberFormat::toFormattedString(
$cell->getCalculatedValue(),
$pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() )->getNumberFormat()->getFormatCode(),
array($this, 'formatColor')
);
} else {
$cellData = PHPExcel_Style_NumberFormat::ToFormattedString(
$cell->getValue(),
$pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() )->getNumberFormat()->getFormatCode(),
array($this, 'formatColor')
);
}
$cellData = htmlspecialchars($cellData);
if ($pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() )->getFont()->getSuperScript()) {
$cellData = ''.$cellData.'';
} elseif ($pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() )->getFont()->getSubScript()) {
$cellData = ''.$cellData.'';
}
}
// Converts the cell content so that spaces occuring at beginning of each new line are replaced by
// Example: " Hello\n to the world" is converted to " Hello\n to the world"
$cellData = preg_replace("/(?m)(?:^|\\G) /", ' ', $cellData);
// convert newline "\n" to '
'
$cellData = nl2br($cellData);
// Extend CSS class?
if (!$this->_useInlineCss) {
$cssClass .= ' style' . $cell->getXfIndex();
$cssClass .= ' ' . $cell->getDataType();
} else {
if (isset($this->_cssStyles['td.style' . $cell->getXfIndex()])) {
$cssClass = array_merge($cssClass, $this->_cssStyles['td.style' . $cell->getXfIndex()]);
}
// General horizontal alignment: Actual horizontal alignment depends on dataType
$sharedStyle = $pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() );
if ($sharedStyle->getAlignment()->getHorizontal() == PHPExcel_Style_Alignment::HORIZONTAL_GENERAL
&& isset($this->_cssStyles['.' . $cell->getDataType()]['text-align']))
{
$cssClass['text-align'] = $this->_cssStyles['.' . $cell->getDataType()]['text-align'];
}
}
}
// Hyperlink?
if ($pSheet->hyperlinkExists($coordinate) && !$pSheet->getHyperlink($coordinate)->isInternal()) {
$cellData = '' . $cellData . '';
}
// Should the cell be written or is it swallowed by a rowspan or colspan?
$writeCell = ! ( isset($this->_isSpannedCell[$pSheet->getParent()->getIndex($pSheet)][$pRow + 1][$colNum])
&& $this->_isSpannedCell[$pSheet->getParent()->getIndex($pSheet)][$pRow + 1][$colNum] );
// Colspan and Rowspan
$colspan = 1;
$rowspan = 1;
if (isset($this->_isBaseCell[$pSheet->getParent()->getIndex($pSheet)][$pRow + 1][$colNum])) {
$spans = $this->_isBaseCell[$pSheet->getParent()->getIndex($pSheet)][$pRow + 1][$colNum];
$rowSpan = $spans['rowspan'];
$colSpan = $spans['colspan'];
// Also apply style from last cell in merge to fix borders -
// relies on !important for non-none border declarations in _createCSSStyleBorder
$endCellCoord = PHPExcel_Cell::stringFromColumnIndex($colNum + $colSpan - 1) . ($pRow + $rowSpan);
if (!$this->_useInlineCss) {
$cssClass .= ' style' . $pSheet->getCell($endCellCoord)->getXfIndex();
}
}
// Write
if ($writeCell) {
// Column start
$html .= ' _useInlineCss) {
$html .= ' class="' . $cssClass . '"';
} else {
//** Necessary redundant code for the sake of PHPExcel_Writer_PDF **
// We must explicitly write the width of the | element because TCPDF
// does not recognize e.g.
$width = 0;
$i = $colNum - 1;
$e = $colNum + $colSpan - 1;
while($i++ < $e) {
if (isset($this->_columnWidths[$sheetIndex][$i])) {
$width += $this->_columnWidths[$sheetIndex][$i];
}
}
$cssClass['width'] = $width . 'pt';
// We must also explicitly write the height of the | element because TCPDF
// does not recognize e.g. |
if (isset($this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]['height'])) {
$height = $this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]['height'];
$cssClass['height'] = $height;
}
//** end of redundant code **
$html .= ' style="' . $this->_assembleCSS($cssClass) . '"';
}
if ($colSpan > 1) {
$html .= ' colspan="' . $colSpan . '"';
}
if ($rowSpan > 1) {
$html .= ' rowspan="' . $rowSpan . '"';
}
$html .= '>';
// Image?
$html .= $this->_writeImageInCell($pSheet, $coordinate);
// Chart?
if ($this->_includeCharts) {
$html .= $this->_writeChartInCell($pSheet, $coordinate);
}
// Cell data
$html .= $cellData;
// Column end
$html .= '' . PHP_EOL;
}
// Next column
++$colNum;
}
// Write row end
$html .= '
' . PHP_EOL;
// Return
return $html;
} else {
throw new PHPExcel_Writer_Exception("Invalid parameters passed.");
}
}
/**
* Takes array where of CSS properties / values and converts to CSS string
*
* @param array
* @return string
*/
private function _assembleCSS($pValue = array())
{
$pairs = array();
foreach ($pValue as $property => $value) {
$pairs[] = $property . ':' . $value;
}
$string = implode('; ', $pairs);
return $string;
}
/**
* Get images root
*
* @return string
*/
public function getImagesRoot() {
return $this->_imagesRoot;
}
/**
* Set images root
*
* @param string $pValue
* @return PHPExcel_Writer_HTML
*/
public function setImagesRoot($pValue = '.') {
$this->_imagesRoot = $pValue;
return $this;
}
/**
* Get embed images
*
* @return boolean
*/
public function getEmbedImages() {
return $this->_embedImages;
}
/**
* Set embed images
*
* @param boolean $pValue
* @return PHPExcel_Writer_HTML
*/
public function setEmbedImages($pValue = '.') {
$this->_embedImages = $pValue;
return $this;
}
/**
* Get use inline CSS?
*
* @return boolean
*/
public function getUseInlineCss() {
return $this->_useInlineCss;
}
/**
* Set use inline CSS?
*
* @param boolean $pValue
* @return PHPExcel_Writer_HTML
*/
public function setUseInlineCss($pValue = false) {
$this->_useInlineCss = $pValue;
return $this;
}
/**
* Add color to formatted string as inline style
*
* @param string $pValue Plain formatted value without color
* @param string $pFormat Format code
* @return string
*/
public function formatColor($pValue, $pFormat)
{
// Color information, e.g. [Red] is always at the beginning
$color = null; // initialize
$matches = array();
$color_regex = '/^\\[[a-zA-Z]+\\]/';
if (preg_match($color_regex, $pFormat, $matches)) {
$color = str_replace('[', '', $matches[0]);
$color = str_replace(']', '', $color);
$color = strtolower($color);
}
// convert to PCDATA
$value = htmlspecialchars($pValue);
// color span tag
if ($color !== null) {
$value = '' . $value . '';
}
return $value;
}
/**
* Calculate information about HTML colspan and rowspan which is not always the same as Excel's
*/
private function _calculateSpans()
{
// Identify all cells that should be omitted in HTML due to cell merge.
// In HTML only the upper-left cell should be written and it should have
// appropriate rowspan / colspan attribute
$sheetIndexes = $this->_sheetIndex !== null ?
array($this->_sheetIndex) : range(0, $this->_phpExcel->getSheetCount() - 1);
foreach ($sheetIndexes as $sheetIndex) {
$sheet = $this->_phpExcel->getSheet($sheetIndex);
$candidateSpannedRow = array();
// loop through all Excel merged cells
foreach ($sheet->getMergeCells() as $cells) {
list($cells, ) = PHPExcel_Cell::splitRange($cells);
$first = $cells[0];
$last = $cells[1];
list($fc, $fr) = PHPExcel_Cell::coordinateFromString($first);
$fc = PHPExcel_Cell::columnIndexFromString($fc) - 1;
list($lc, $lr) = PHPExcel_Cell::coordinateFromString($last);
$lc = PHPExcel_Cell::columnIndexFromString($lc) - 1;
// loop through the individual cells in the individual merge
$r = $fr - 1;
while($r++ < $lr) {
// also, flag this row as a HTML row that is candidate to be omitted
$candidateSpannedRow[$r] = $r;
$c = $fc - 1;
while($c++ < $lc) {
if ( !($c == $fc && $r == $fr) ) {
// not the upper-left cell (should not be written in HTML)
$this->_isSpannedCell[$sheetIndex][$r][$c] = array(
'baseCell' => array($fr, $fc),
);
} else {
// upper-left is the base cell that should hold the colspan/rowspan attribute
$this->_isBaseCell[$sheetIndex][$r][$c] = array(
'xlrowspan' => $lr - $fr + 1, // Excel rowspan
'rowspan' => $lr - $fr + 1, // HTML rowspan, value may change
'xlcolspan' => $lc - $fc + 1, // Excel colspan
'colspan' => $lc - $fc + 1, // HTML colspan, value may change
);
}
}
}
}
// Identify which rows should be omitted in HTML. These are the rows where all the cells
// participate in a merge and the where base cells are somewhere above.
$countColumns = PHPExcel_Cell::columnIndexFromString($sheet->getHighestColumn());
foreach ($candidateSpannedRow as $rowIndex) {
if (isset($this->_isSpannedCell[$sheetIndex][$rowIndex])) {
if (count($this->_isSpannedCell[$sheetIndex][$rowIndex]) == $countColumns) {
$this->_isSpannedRow[$sheetIndex][$rowIndex] = $rowIndex;
};
}
}
// For each of the omitted rows we found above, the affected rowspans should be subtracted by 1
if ( isset($this->_isSpannedRow[$sheetIndex]) ) {
foreach ($this->_isSpannedRow[$sheetIndex] as $rowIndex) {
$adjustedBaseCells = array();
$c = -1;
$e = $countColumns - 1;
while($c++ < $e) {
$baseCell = $this->_isSpannedCell[$sheetIndex][$rowIndex][$c]['baseCell'];
if ( !in_array($baseCell, $adjustedBaseCells) ) {
// subtract rowspan by 1
--$this->_isBaseCell[$sheetIndex][ $baseCell[0] ][ $baseCell[1] ]['rowspan'];
$adjustedBaseCells[] = $baseCell;
}
}
}
}
// TODO: Same for columns
}
// We have calculated the spans
$this->_spansAreCalculated = true;
}
private function _setMargins(PHPExcel_Worksheet $pSheet) {
$htmlPage = '@page { ';
$htmlBody = 'body { ';
$left = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getLeft()) . 'in; ';
$htmlPage .= 'left-margin: ' . $left;
$htmlBody .= 'left-margin: ' . $left;
$right = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getRight()) . 'in; ';
$htmlPage .= 'right-margin: ' . $right;
$htmlBody .= 'right-margin: ' . $right;
$top = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getTop()) . 'in; ';
$htmlPage .= 'top-margin: ' . $top;
$htmlBody .= 'top-margin: ' . $top;
$bottom = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getBottom()) . 'in; ';
$htmlPage .= 'bottom-margin: ' . $bottom;
$htmlBody .= 'bottom-margin: ' . $bottom;
$htmlPage .= "}\n";
$htmlBody .= "}\n";
return "\n";
}
}
PK ! F6 PHPExcel/Writer/PDF/mPDF.phpnu [ getSheetIndex())) {
$orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation()
== PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE)
? 'L'
: 'P';
$printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize();
$printMargins = $this->_phpExcel->getSheet(0)->getPageMargins();
} else {
$orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation()
== PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE)
? 'L'
: 'P';
$printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
$printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins();
}
$this->setOrientation($orientation);
// Override Page Orientation
if (!is_null($this->getOrientation())) {
$orientation = ($this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT)
? PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT
: $this->getOrientation();
}
$orientation = strtoupper($orientation);
// Override Paper Size
if (!is_null($this->getPaperSize())) {
$printPaperSize = $this->getPaperSize();
}
if (isset(self::$_paperSizes[$printPaperSize])) {
$paperSize = self::$_paperSizes[$printPaperSize];
}
// Create PDF
$pdf = new mpdf();
$ortmp = $orientation;
$pdf->_setPageSize(strtoupper($paperSize), $ortmp);
$pdf->DefOrientation = $orientation;
$pdf->AddPage($orientation);
// Document info
$pdf->SetTitle($this->_phpExcel->getProperties()->getTitle());
$pdf->SetAuthor($this->_phpExcel->getProperties()->getCreator());
$pdf->SetSubject($this->_phpExcel->getProperties()->getSubject());
$pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords());
$pdf->SetCreator($this->_phpExcel->getProperties()->getCreator());
$pdf->WriteHTML(
$this->generateHTMLHeader(FALSE) .
$this->generateSheetData() .
$this->generateHTMLFooter()
);
// Write to file
fwrite($fileHandle, $pdf->Output('', 'S'));
parent::restoreStateAfterSave($fileHandle);
}
}
PK ! ?+ PHPExcel/Writer/PDF/tcPDF.phpnu [ getSheetIndex())) {
$orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation()
== PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE)
? 'L'
: 'P';
$printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize();
$printMargins = $this->_phpExcel->getSheet(0)->getPageMargins();
} else {
$orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation()
== PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE)
? 'L'
: 'P';
$printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
$printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins();
}
// Override Page Orientation
if (!is_null($this->getOrientation())) {
$orientation = ($this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE)
? 'L'
: 'P';
}
// Override Paper Size
if (!is_null($this->getPaperSize())) {
$printPaperSize = $this->getPaperSize();
}
if (isset(self::$_paperSizes[$printPaperSize])) {
$paperSize = self::$_paperSizes[$printPaperSize];
}
// Create PDF
$pdf = new TCPDF($orientation, 'pt', $paperSize);
$pdf->setFontSubsetting(FALSE);
// Set margins, converting inches to points (using 72 dpi)
$pdf->SetMargins($printMargins->getLeft() * 72, $printMargins->getTop() * 72, $printMargins->getRight() * 72);
$pdf->SetAutoPageBreak(TRUE, $printMargins->getBottom() * 72);
$pdf->setPrintHeader(FALSE);
$pdf->setPrintFooter(FALSE);
$pdf->AddPage();
// Set the appropriate font
$pdf->SetFont($this->getFont());
$pdf->writeHTML(
$this->generateHTMLHeader(FALSE) .
$this->generateSheetData() .
$this->generateHTMLFooter()
);
// Document info
$pdf->SetTitle($this->_phpExcel->getProperties()->getTitle());
$pdf->SetAuthor($this->_phpExcel->getProperties()->getCreator());
$pdf->SetSubject($this->_phpExcel->getProperties()->getSubject());
$pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords());
$pdf->SetCreator($this->_phpExcel->getProperties()->getCreator());
// Write to file
fwrite($fileHandle, $pdf->output($pFilename, 'S'));
parent::restoreStateAfterSave($fileHandle);
}
}
PK ! :y. PHPExcel/Writer/PDF/DomPDF.phpnu [ getSheetIndex())) {
$orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation()
== PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE)
? 'L'
: 'P';
$printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize();
$printMargins = $this->_phpExcel->getSheet(0)->getPageMargins();
} else {
$orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation()
== PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE)
? 'L'
: 'P';
$printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
$printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins();
}
// Override Page Orientation
if (!is_null($this->getOrientation())) {
$orientation = ($this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT)
? PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT
: $this->getOrientation();
}
// Override Paper Size
if (!is_null($this->getPaperSize())) {
$printPaperSize = $this->getPaperSize();
}
if (isset(self::$_paperSizes[$printPaperSize])) {
$paperSize = self::$_paperSizes[$printPaperSize];
}
$orientation = ($orientation == 'L') ? 'landscape' : 'portrait';
// Create PDF
$pdf = new DOMPDF();
$pdf->set_paper(strtolower($paperSize), $orientation);
$pdf->load_html(
$this->generateHTMLHeader(FALSE) .
$this->generateSheetData() .
$this->generateHTMLFooter()
);
$pdf->render();
// Write to file
fwrite($fileHandle, $pdf->output());
parent::restoreStateAfterSave($fileHandle);
}
}
PK ! i#7 #7 PHPExcel/Writer/PDF/Core.phpnu [ 'LETTER', // (8.5 in. by 11 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_SMALL
=> 'LETTER', // (8.5 in. by 11 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_TABLOID
=> array(792.00, 1224.00), // (11 in. by 17 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_LEDGER
=> array(1224.00, 792.00), // (17 in. by 11 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_LEGAL
=> 'LEGAL', // (8.5 in. by 14 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_STATEMENT
=> array(396.00, 612.00), // (5.5 in. by 8.5 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_EXECUTIVE
=> 'EXECUTIVE', // (7.25 in. by 10.5 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3
=> 'A3', // (297 mm by 420 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4
=> 'A4', // (210 mm by 297 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_SMALL
=> 'A4', // (210 mm by 297 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A5
=> 'A5', // (148 mm by 210 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_B4
=> 'B4', // (250 mm by 353 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_B5
=> 'B5', // (176 mm by 250 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_FOLIO
=> 'FOLIO', // (8.5 in. by 13 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_QUARTO
=> array(609.45, 779.53), // (215 mm by 275 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_1
=> array(720.00, 1008.00), // (10 in. by 14 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_2
=> array(792.00, 1224.00), // (11 in. by 17 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_NOTE
=> 'LETTER', // (8.5 in. by 11 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO9_ENVELOPE
=> array(279.00, 639.00), // (3.875 in. by 8.875 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO10_ENVELOPE
=> array(297.00, 684.00), // (4.125 in. by 9.5 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO11_ENVELOPE
=> array(324.00, 747.00), // (4.5 in. by 10.375 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO12_ENVELOPE
=> array(342.00, 792.00), // (4.75 in. by 11 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO14_ENVELOPE
=> array(360.00, 828.00), // (5 in. by 11.5 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_C
=> array(1224.00, 1584.00), // (17 in. by 22 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_D
=> array(1584.00, 2448.00), // (22 in. by 34 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_E
=> array(2448.00, 3168.00), // (34 in. by 44 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_DL_ENVELOPE
=> array(311.81, 623.62), // (110 mm by 220 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_C5_ENVELOPE
=> 'C5', // (162 mm by 229 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_C3_ENVELOPE
=> 'C3', // (324 mm by 458 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_C4_ENVELOPE
=> 'C4', // (229 mm by 324 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_C6_ENVELOPE
=> 'C6', // (114 mm by 162 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_C65_ENVELOPE
=> array(323.15, 649.13), // (114 mm by 229 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_B4_ENVELOPE
=> 'B4', // (250 mm by 353 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_B5_ENVELOPE
=> 'B5', // (176 mm by 250 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_B6_ENVELOPE
=> array(498.90, 354.33), // (176 mm by 125 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_ITALY_ENVELOPE
=> array(311.81, 651.97), // (110 mm by 230 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_MONARCH_ENVELOPE
=> array(279.00, 540.00), // (3.875 in. by 7.5 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_6_3_4_ENVELOPE
=> array(261.00, 468.00), // (3.625 in. by 6.5 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_US_STANDARD_FANFOLD
=> array(1071.00, 792.00), // (14.875 in. by 11 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_GERMAN_STANDARD_FANFOLD
=> array(612.00, 864.00), // (8.5 in. by 12 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_GERMAN_LEGAL_FANFOLD
=> 'FOLIO', // (8.5 in. by 13 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_ISO_B4
=> 'B4', // (250 mm by 353 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_JAPANESE_DOUBLE_POSTCARD
=> array(566.93, 419.53), // (200 mm by 148 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_1
=> array(648.00, 792.00), // (9 in. by 11 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_2
=> array(720.00, 792.00), // (10 in. by 11 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_3
=> array(1080.00, 792.00), // (15 in. by 11 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_INVITE_ENVELOPE
=> array(623.62, 623.62), // (220 mm by 220 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_EXTRA_PAPER
=> array(667.80, 864.00), // (9.275 in. by 12 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_LEGAL_EXTRA_PAPER
=> array(667.80, 1080.00), // (9.275 in. by 15 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_TABLOID_EXTRA_PAPER
=> array(841.68, 1296.00), // (11.69 in. by 18 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_EXTRA_PAPER
=> array(668.98, 912.76), // (236 mm by 322 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_TRANSVERSE_PAPER
=> array(595.80, 792.00), // (8.275 in. by 11 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_TRANSVERSE_PAPER
=> 'A4', // (210 mm by 297 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER
=> array(667.80, 864.00), // (9.275 in. by 12 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_SUPERA_SUPERA_A4_PAPER
=> array(643.46, 1009.13), // (227 mm by 356 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_SUPERB_SUPERB_A3_PAPER
=> array(864.57, 1380.47), // (305 mm by 487 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_PLUS_PAPER
=> array(612.00, 913.68), // (8.5 in. by 12.69 in.)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_PLUS_PAPER
=> array(595.28, 935.43), // (210 mm by 330 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A5_TRANSVERSE_PAPER
=> 'A5', // (148 mm by 210 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_JIS_B5_TRANSVERSE_PAPER
=> array(515.91, 728.50), // (182 mm by 257 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3_EXTRA_PAPER
=> array(912.76, 1261.42), // (322 mm by 445 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A5_EXTRA_PAPER
=> array(493.23, 666.14), // (174 mm by 235 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_ISO_B5_EXTRA_PAPER
=> array(569.76, 782.36), // (201 mm by 276 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A2_PAPER
=> 'A2', // (420 mm by 594 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3_TRANSVERSE_PAPER
=> 'A3', // (297 mm by 420 mm)
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER
=> array(912.76, 1261.42) // (322 mm by 445 mm)
);
/**
* Create a new PHPExcel_Writer_PDF
*
* @param PHPExcel $phpExcel PHPExcel object
*/
public function __construct(PHPExcel $phpExcel)
{
parent::__construct($phpExcel);
$this->setUseInlineCss(TRUE);
$this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir();
}
/**
* Get Font
*
* @return string
*/
public function getFont()
{
return $this->_font;
}
/**
* Set font. Examples:
* 'arialunicid0-chinese-simplified'
* 'arialunicid0-chinese-traditional'
* 'arialunicid0-korean'
* 'arialunicid0-japanese'
*
* @param string $fontName
*/
public function setFont($fontName)
{
$this->_font = $fontName;
return $this;
}
/**
* Get Paper Size
*
* @return int
*/
public function getPaperSize()
{
return $this->_paperSize;
}
/**
* Set Paper Size
*
* @param string $pValue Paper size
* @return PHPExcel_Writer_PDF
*/
public function setPaperSize($pValue = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER)
{
$this->_paperSize = $pValue;
return $this;
}
/**
* Get Orientation
*
* @return string
*/
public function getOrientation()
{
return $this->_orientation;
}
/**
* Set Orientation
*
* @param string $pValue Page orientation
* @return PHPExcel_Writer_PDF
*/
public function setOrientation($pValue = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT)
{
$this->_orientation = $pValue;
return $this;
}
/**
* Get temporary storage directory
*
* @return string
*/
public function getTempDir()
{
return $this->_tempDir;
}
/**
* Set temporary storage directory
*
* @param string $pValue Temporary storage directory
* @throws PHPExcel_Writer_Exception when directory does not exist
* @return PHPExcel_Writer_PDF
*/
public function setTempDir($pValue = '')
{
if (is_dir($pValue)) {
$this->_tempDir = $pValue;
} else {
throw new PHPExcel_Writer_Exception("Directory does not exist: $pValue");
}
return $this;
}
/**
* Save PHPExcel to PDF file, pre-save
*
* @param string $pFilename Name of the file to save as
* @throws PHPExcel_Writer_Exception
*/
protected function prepareForSave($pFilename = NULL)
{
// garbage collect
$this->_phpExcel->garbageCollect();
$this->_saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType();
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
// Open file
$fileHandle = fopen($pFilename, 'w');
if ($fileHandle === FALSE) {
throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing.");
}
// Set PDF
$this->_isPdf = TRUE;
// Build CSS
$this->buildCSS(TRUE);
return $fileHandle;
}
/**
* Save PHPExcel to PDF file, post-save
*
* @param resource $fileHandle
* @throws PHPExcel_Writer_Exception
*/
protected function restoreStateAfterSave($fileHandle)
{
// Close file
fclose($fileHandle);
PHPExcel_Calculation::setArrayReturnType($this->_saveArrayReturnType);
}
}
PK ! 7 PHPExcel/Writer/IWriter.phpnu [ _phpExcel = $phpExcel;
$this->_parser = new PHPExcel_Writer_Excel5_Parser();
}
/**
* Save PHPExcel to file
*
* @param string $pFilename
* @throws PHPExcel_Writer_Exception
*/
public function save($pFilename = null) {
// garbage collect
$this->_phpExcel->garbageCollect();
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog();
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(FALSE);
$saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType();
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// initialize colors array
$this->_colors = array();
// Initialise workbook writer
$this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->_phpExcel,
$this->_str_total, $this->_str_unique, $this->_str_table,
$this->_colors, $this->_parser);
// Initialise worksheet writers
$countSheets = $this->_phpExcel->getSheetCount();
for ($i = 0; $i < $countSheets; ++$i) {
$this->_writerWorksheets[$i] = new PHPExcel_Writer_Excel5_Worksheet($this->_str_total, $this->_str_unique,
$this->_str_table, $this->_colors,
$this->_parser,
$this->_preCalculateFormulas,
$this->_phpExcel->getSheet($i));
}
// build Escher objects. Escher objects for workbooks needs to be build before Escher object for workbook.
$this->_buildWorksheetEschers();
$this->_buildWorkbookEscher();
// add 15 identical cell style Xfs
// for now, we use the first cellXf instead of cellStyleXf
$cellXfCollection = $this->_phpExcel->getCellXfCollection();
for ($i = 0; $i < 15; ++$i) {
$this->_writerWorkbook->addXfWriter($cellXfCollection[0], true);
}
// add all the cell Xfs
foreach ($this->_phpExcel->getCellXfCollection() as $style) {
$this->_writerWorkbook->addXfWriter($style, false);
}
// add fonts from rich text eleemnts
for ($i = 0; $i < $countSheets; ++$i) {
foreach ($this->_writerWorksheets[$i]->_phpSheet->getCellCollection() as $cellID) {
$cell = $this->_writerWorksheets[$i]->_phpSheet->getCell($cellID);
$cVal = $cell->getValue();
if ($cVal instanceof PHPExcel_RichText) {
$elements = $cVal->getRichTextElements();
foreach ($elements as $element) {
if ($element instanceof PHPExcel_RichText_Run) {
$font = $element->getFont();
$this->_writerWorksheets[$i]->_fntHashIndex[$font->getHashCode()] = $this->_writerWorkbook->_addFont($font);
}
}
}
}
}
// initialize OLE file
$workbookStreamName = 'Workbook';
$OLE = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs($workbookStreamName));
// Write the worksheet streams before the global workbook stream,
// because the byte sizes of these are needed in the global workbook stream
$worksheetSizes = array();
for ($i = 0; $i < $countSheets; ++$i) {
$this->_writerWorksheets[$i]->close();
$worksheetSizes[] = $this->_writerWorksheets[$i]->_datasize;
}
// add binary data for global workbook stream
$OLE->append($this->_writerWorkbook->writeWorkbook($worksheetSizes));
// add binary data for sheet streams
for ($i = 0; $i < $countSheets; ++$i) {
$OLE->append($this->_writerWorksheets[$i]->getData());
}
$this->_documentSummaryInformation = $this->_writeDocumentSummaryInformation();
// initialize OLE Document Summary Information
if(isset($this->_documentSummaryInformation) && !empty($this->_documentSummaryInformation)){
$OLE_DocumentSummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'DocumentSummaryInformation'));
$OLE_DocumentSummaryInformation->append($this->_documentSummaryInformation);
}
$this->_summaryInformation = $this->_writeSummaryInformation();
// initialize OLE Summary Information
if(isset($this->_summaryInformation) && !empty($this->_summaryInformation)){
$OLE_SummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'SummaryInformation'));
$OLE_SummaryInformation->append($this->_summaryInformation);
}
// define OLE Parts
$arrRootData = array($OLE);
// initialize OLE Properties file
if(isset($OLE_SummaryInformation)){
$arrRootData[] = $OLE_SummaryInformation;
}
// initialize OLE Extended Properties file
if(isset($OLE_DocumentSummaryInformation)){
$arrRootData[] = $OLE_DocumentSummaryInformation;
}
$root = new PHPExcel_Shared_OLE_PPS_Root(time(), time(), $arrRootData);
// save the OLE file
$res = $root->save($pFilename);
PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType);
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog);
}
/**
* Set temporary storage directory
*
* @deprecated
* @param string $pValue Temporary storage directory
* @throws PHPExcel_Writer_Exception when directory does not exist
* @return PHPExcel_Writer_Excel5
*/
public function setTempDir($pValue = '') {
return $this;
}
/**
* Build the Worksheet Escher objects
*
*/
private function _buildWorksheetEschers()
{
// 1-based index to BstoreContainer
$blipIndex = 0;
$lastReducedSpId = 0;
$lastSpId = 0;
foreach ($this->_phpExcel->getAllsheets() as $sheet) {
// sheet index
$sheetIndex = $sheet->getParent()->getIndex($sheet);
$escher = null;
// check if there are any shapes for this sheet
$filterRange = $sheet->getAutoFilter()->getRange();
if (count($sheet->getDrawingCollection()) == 0 && empty($filterRange)) {
continue;
}
// create intermediate Escher object
$escher = new PHPExcel_Shared_Escher();
// dgContainer
$dgContainer = new PHPExcel_Shared_Escher_DgContainer();
// set the drawing index (we use sheet index + 1)
$dgId = $sheet->getParent()->getIndex($sheet) + 1;
$dgContainer->setDgId($dgId);
$escher->setDgContainer($dgContainer);
// spgrContainer
$spgrContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer();
$dgContainer->setSpgrContainer($spgrContainer);
// add one shape which is the group shape
$spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer();
$spContainer->setSpgr(true);
$spContainer->setSpType(0);
$spContainer->setSpId(($sheet->getParent()->getIndex($sheet) + 1) << 10);
$spgrContainer->addChild($spContainer);
// add the shapes
$countShapes[$sheetIndex] = 0; // count number of shapes (minus group shape), in sheet
foreach ($sheet->getDrawingCollection() as $drawing) {
++$blipIndex;
++$countShapes[$sheetIndex];
// add the shape
$spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer();
// set the shape type
$spContainer->setSpType(0x004B);
// set the shape flag
$spContainer->setSpFlag(0x02);
// set the shape index (we combine 1-based sheet index and $countShapes to create unique shape index)
$reducedSpId = $countShapes[$sheetIndex];
$spId = $reducedSpId
| ($sheet->getParent()->getIndex($sheet) + 1) << 10;
$spContainer->setSpId($spId);
// keep track of last reducedSpId
$lastReducedSpId = $reducedSpId;
// keep track of last spId
$lastSpId = $spId;
// set the BLIP index
$spContainer->setOPT(0x4104, $blipIndex);
// set coordinates and offsets, client anchor
$coordinates = $drawing->getCoordinates();
$offsetX = $drawing->getOffsetX();
$offsetY = $drawing->getOffsetY();
$width = $drawing->getWidth();
$height = $drawing->getHeight();
$twoAnchor = PHPExcel_Shared_Excel5::oneAnchor2twoAnchor($sheet, $coordinates, $offsetX, $offsetY, $width, $height);
$spContainer->setStartCoordinates($twoAnchor['startCoordinates']);
$spContainer->setStartOffsetX($twoAnchor['startOffsetX']);
$spContainer->setStartOffsetY($twoAnchor['startOffsetY']);
$spContainer->setEndCoordinates($twoAnchor['endCoordinates']);
$spContainer->setEndOffsetX($twoAnchor['endOffsetX']);
$spContainer->setEndOffsetY($twoAnchor['endOffsetY']);
$spgrContainer->addChild($spContainer);
}
// AutoFilters
if(!empty($filterRange)){
$rangeBounds = PHPExcel_Cell::rangeBoundaries($filterRange);
$iNumColStart = $rangeBounds[0][0];
$iNumColEnd = $rangeBounds[1][0];
$iInc = $iNumColStart;
while($iInc <= $iNumColEnd){
++$countShapes[$sheetIndex];
// create an Drawing Object for the dropdown
$oDrawing = new PHPExcel_Worksheet_BaseDrawing();
// get the coordinates of drawing
$cDrawing = PHPExcel_Cell::stringFromColumnIndex($iInc - 1) . $rangeBounds[0][1];
$oDrawing->setCoordinates($cDrawing);
$oDrawing->setWorksheet($sheet);
// add the shape
$spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer();
// set the shape type
$spContainer->setSpType(0x00C9);
// set the shape flag
$spContainer->setSpFlag(0x01);
// set the shape index (we combine 1-based sheet index and $countShapes to create unique shape index)
$reducedSpId = $countShapes[$sheetIndex];
$spId = $reducedSpId
| ($sheet->getParent()->getIndex($sheet) + 1) << 10;
$spContainer->setSpId($spId);
// keep track of last reducedSpId
$lastReducedSpId = $reducedSpId;
// keep track of last spId
$lastSpId = $spId;
$spContainer->setOPT(0x007F, 0x01040104); // Protection -> fLockAgainstGrouping
$spContainer->setOPT(0x00BF, 0x00080008); // Text -> fFitTextToShape
$spContainer->setOPT(0x01BF, 0x00010000); // Fill Style -> fNoFillHitTest
$spContainer->setOPT(0x01FF, 0x00080000); // Line Style -> fNoLineDrawDash
$spContainer->setOPT(0x03BF, 0x000A0000); // Group Shape -> fPrint
// set coordinates and offsets, client anchor
$endCoordinates = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::stringFromColumnIndex($iInc - 1));
$endCoordinates .= $rangeBounds[0][1] + 1;
$spContainer->setStartCoordinates($cDrawing);
$spContainer->setStartOffsetX(0);
$spContainer->setStartOffsetY(0);
$spContainer->setEndCoordinates($endCoordinates);
$spContainer->setEndOffsetX(0);
$spContainer->setEndOffsetY(0);
$spgrContainer->addChild($spContainer);
$iInc++;
}
}
// identifier clusters, used for workbook Escher object
$this->_IDCLs[$dgId] = $lastReducedSpId;
// set last shape index
$dgContainer->setLastSpId($lastSpId);
// set the Escher object
$this->_writerWorksheets[$sheetIndex]->setEscher($escher);
}
}
/**
* Build the Escher object corresponding to the MSODRAWINGGROUP record
*/
private function _buildWorkbookEscher()
{
$escher = null;
// any drawings in this workbook?
$found = false;
foreach ($this->_phpExcel->getAllSheets() as $sheet) {
if (count($sheet->getDrawingCollection()) > 0) {
$found = true;
break;
}
}
// nothing to do if there are no drawings
if (!$found) {
return;
}
// if we reach here, then there are drawings in the workbook
$escher = new PHPExcel_Shared_Escher();
// dggContainer
$dggContainer = new PHPExcel_Shared_Escher_DggContainer();
$escher->setDggContainer($dggContainer);
// set IDCLs (identifier clusters)
$dggContainer->setIDCLs($this->_IDCLs);
// this loop is for determining maximum shape identifier of all drawing
$spIdMax = 0;
$totalCountShapes = 0;
$countDrawings = 0;
foreach ($this->_phpExcel->getAllsheets() as $sheet) {
$sheetCountShapes = 0; // count number of shapes (minus group shape), in sheet
if (count($sheet->getDrawingCollection()) > 0) {
++$countDrawings;
foreach ($sheet->getDrawingCollection() as $drawing) {
++$sheetCountShapes;
++$totalCountShapes;
$spId = $sheetCountShapes
| ($this->_phpExcel->getIndex($sheet) + 1) << 10;
$spIdMax = max($spId, $spIdMax);
}
}
}
$dggContainer->setSpIdMax($spIdMax + 1);
$dggContainer->setCDgSaved($countDrawings);
$dggContainer->setCSpSaved($totalCountShapes + $countDrawings); // total number of shapes incl. one group shapes per drawing
// bstoreContainer
$bstoreContainer = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer();
$dggContainer->setBstoreContainer($bstoreContainer);
// the BSE's (all the images)
foreach ($this->_phpExcel->getAllsheets() as $sheet) {
foreach ($sheet->getDrawingCollection() as $drawing) {
if ($drawing instanceof PHPExcel_Worksheet_Drawing) {
$filename = $drawing->getPath();
list($imagesx, $imagesy, $imageFormat) = getimagesize($filename);
switch ($imageFormat) {
case 1: // GIF, not supported by BIFF8, we convert to PNG
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
ob_start();
imagepng(imagecreatefromgif($filename));
$blipData = ob_get_contents();
ob_end_clean();
break;
case 2: // JPEG
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG;
$blipData = file_get_contents($filename);
break;
case 3: // PNG
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
$blipData = file_get_contents($filename);
break;
case 6: // Windows DIB (BMP), we convert to PNG
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
ob_start();
imagepng(PHPExcel_Shared_Drawing::imagecreatefrombmp($filename));
$blipData = ob_get_contents();
ob_end_clean();
break;
default: continue 2;
}
$blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
$blip->setData($blipData);
$BSE = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE();
$BSE->setBlipType($blipType);
$BSE->setBlip($blip);
$bstoreContainer->addBSE($BSE);
} else if ($drawing instanceof PHPExcel_Worksheet_MemoryDrawing) {
switch ($drawing->getRenderingFunction()) {
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG:
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG;
$renderingFunction = 'imagejpeg';
break;
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_GIF:
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG:
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT:
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
$renderingFunction = 'imagepng';
break;
}
ob_start();
call_user_func($renderingFunction, $drawing->getImageResource());
$blipData = ob_get_contents();
ob_end_clean();
$blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
$blip->setData($blipData);
$BSE = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE();
$BSE->setBlipType($blipType);
$BSE->setBlip($blip);
$bstoreContainer->addBSE($BSE);
}
}
}
// Set the Escher object
$this->_writerWorkbook->setEscher($escher);
}
/**
* Build the OLE Part for DocumentSummary Information
* @return string
*/
private function _writeDocumentSummaryInformation(){
// offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark)
$data = pack('v', 0xFFFE);
// offset: 2; size: 2;
$data .= pack('v', 0x0000);
// offset: 4; size: 2; OS version
$data .= pack('v', 0x0106);
// offset: 6; size: 2; OS indicator
$data .= pack('v', 0x0002);
// offset: 8; size: 16
$data .= pack('VVVV', 0x00, 0x00, 0x00, 0x00);
// offset: 24; size: 4; section count
$data .= pack('V', 0x0001);
// offset: 28; size: 16; first section's class id: 02 d5 cd d5 9c 2e 1b 10 93 97 08 00 2b 2c f9 ae
$data .= pack('vvvvvvvv', 0xD502, 0xD5CD, 0x2E9C, 0x101B, 0x9793, 0x0008, 0x2C2B, 0xAEF9);
// offset: 44; size: 4; offset of the start
$data .= pack('V', 0x30);
// SECTION
$dataSection = array();
$dataSection_NumProps = 0;
$dataSection_Summary = '';
$dataSection_Content = '';
// GKPIDDSI_CODEPAGE: CodePage
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x01),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x02), // 2 byte signed integer
'data' => array('data' => 1252));
$dataSection_NumProps++;
// GKPIDDSI_CATEGORY : Category
if($this->_phpExcel->getProperties()->getCategory()){
$dataProp = $this->_phpExcel->getProperties()->getCategory();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E),
'data' => array('data' => $dataProp, 'length' => strlen($dataProp)));
$dataSection_NumProps++;
}
// GKPIDDSI_VERSION :Version of the application that wrote the property storage
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x17),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x03),
'data' => array('pack' => 'V', 'data' => 0x000C0000));
$dataSection_NumProps++;
// GKPIDDSI_SCALE : FALSE
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0B),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x0B),
'data' => array('data' => false));
$dataSection_NumProps++;
// GKPIDDSI_LINKSDIRTY : True if any of the values for the linked properties have changed outside of the application
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x10),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x0B),
'data' => array('data' => false));
$dataSection_NumProps++;
// GKPIDDSI_SHAREDOC : FALSE
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x13),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x0B),
'data' => array('data' => false));
$dataSection_NumProps++;
// GKPIDDSI_HYPERLINKSCHANGED : True if any of the values for the _PID_LINKS (hyperlink text) have changed outside of the application
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x16),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x0B),
'data' => array('data' => false));
$dataSection_NumProps++;
// GKPIDDSI_DOCSPARTS
// MS-OSHARED p75 (2.3.3.2.2.1)
// Structure is VtVecUnalignedLpstrValue (2.3.3.1.9)
// cElements
$dataProp = pack('v', 0x0001);
$dataProp .= pack('v', 0x0000);
// array of UnalignedLpstr
// cch
$dataProp .= pack('v', 0x000A);
$dataProp .= pack('v', 0x0000);
// value
$dataProp .= 'Worksheet'.chr(0);
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0D),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x101E),
'data' => array('data' => $dataProp, 'length' => strlen($dataProp)));
$dataSection_NumProps++;
// GKPIDDSI_HEADINGPAIR
// VtVecHeadingPairValue
// cElements
$dataProp = pack('v', 0x0002);
$dataProp .= pack('v', 0x0000);
// Array of vtHeadingPair
// vtUnalignedString - headingString
// stringType
$dataProp .= pack('v', 0x001E);
// padding
$dataProp .= pack('v', 0x0000);
// UnalignedLpstr
// cch
$dataProp .= pack('v', 0x0013);
$dataProp .= pack('v', 0x0000);
// value
$dataProp .= 'Feuilles de calcul';
// vtUnalignedString - headingParts
// wType : 0x0003 = 32 bit signed integer
$dataProp .= pack('v', 0x0300);
// padding
$dataProp .= pack('v', 0x0000);
// value
$dataProp .= pack('v', 0x0100);
$dataProp .= pack('v', 0x0000);
$dataProp .= pack('v', 0x0000);
$dataProp .= pack('v', 0x0000);
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0C),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x100C),
'data' => array('data' => $dataProp, 'length' => strlen($dataProp)));
$dataSection_NumProps++;
// 4 Section Length
// 4 Property count
// 8 * $dataSection_NumProps (8 = ID (4) + OffSet(4))
$dataSection_Content_Offset = 8 + $dataSection_NumProps * 8;
foreach ($dataSection as $dataProp){
// Summary
$dataSection_Summary .= pack($dataProp['summary']['pack'], $dataProp['summary']['data']);
// Offset
$dataSection_Summary .= pack($dataProp['offset']['pack'], $dataSection_Content_Offset);
// DataType
$dataSection_Content .= pack($dataProp['type']['pack'], $dataProp['type']['data']);
// Data
if($dataProp['type']['data'] == 0x02){ // 2 byte signed integer
$dataSection_Content .= pack('V', $dataProp['data']['data']);
$dataSection_Content_Offset += 4 + 4;
}
elseif($dataProp['type']['data'] == 0x03){ // 4 byte signed integer
$dataSection_Content .= pack('V', $dataProp['data']['data']);
$dataSection_Content_Offset += 4 + 4;
}
elseif($dataProp['type']['data'] == 0x0B){ // Boolean
if($dataProp['data']['data'] == false){
$dataSection_Content .= pack('V', 0x0000);
} else {
$dataSection_Content .= pack('V', 0x0001);
}
$dataSection_Content_Offset += 4 + 4;
}
elseif($dataProp['type']['data'] == 0x1E){ // null-terminated string prepended by dword string length
// Null-terminated string
$dataProp['data']['data'] .= chr(0);
$dataProp['data']['length'] += 1;
// Complete the string with null string for being a %4
$dataProp['data']['length'] = $dataProp['data']['length'] + ((4 - $dataProp['data']['length'] % 4)==4 ? 0 : (4 - $dataProp['data']['length'] % 4));
$dataProp['data']['data'] = str_pad($dataProp['data']['data'], $dataProp['data']['length'], chr(0), STR_PAD_RIGHT);
$dataSection_Content .= pack('V', $dataProp['data']['length']);
$dataSection_Content .= $dataProp['data']['data'];
$dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
}
elseif($dataProp['type']['data'] == 0x40){ // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
$dataSection_Content .= $dataProp['data']['data'];
$dataSection_Content_Offset += 4 + 8;
}
else {
// Data Type Not Used at the moment
$dataSection_Content .= $dataProp['data']['data'];
$dataSection_Content_Offset += 4 + $dataProp['data']['length'];
}
}
// Now $dataSection_Content_Offset contains the size of the content
// section header
// offset: $secOffset; size: 4; section length
// + x Size of the content (summary + content)
$data .= pack('V', $dataSection_Content_Offset);
// offset: $secOffset+4; size: 4; property count
$data .= pack('V', $dataSection_NumProps);
// Section Summary
$data .= $dataSection_Summary;
// Section Content
$data .= $dataSection_Content;
return $data;
}
/**
* Build the OLE Part for Summary Information
* @return string
*/
private function _writeSummaryInformation(){
// offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark)
$data = pack('v', 0xFFFE);
// offset: 2; size: 2;
$data .= pack('v', 0x0000);
// offset: 4; size: 2; OS version
$data .= pack('v', 0x0106);
// offset: 6; size: 2; OS indicator
$data .= pack('v', 0x0002);
// offset: 8; size: 16
$data .= pack('VVVV', 0x00, 0x00, 0x00, 0x00);
// offset: 24; size: 4; section count
$data .= pack('V', 0x0001);
// offset: 28; size: 16; first section's class id: e0 85 9f f2 f9 4f 68 10 ab 91 08 00 2b 27 b3 d9
$data .= pack('vvvvvvvv', 0x85E0, 0xF29F, 0x4FF9, 0x1068, 0x91AB, 0x0008, 0x272B, 0xD9B3);
// offset: 44; size: 4; offset of the start
$data .= pack('V', 0x30);
// SECTION
$dataSection = array();
$dataSection_NumProps = 0;
$dataSection_Summary = '';
$dataSection_Content = '';
// CodePage : CP-1252
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x01),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x02), // 2 byte signed integer
'data' => array('data' => 1252));
$dataSection_NumProps++;
// Title
if($this->_phpExcel->getProperties()->getTitle()){
$dataProp = $this->_phpExcel->getProperties()->getTitle();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
'data' => array('data' => $dataProp, 'length' => strlen($dataProp)));
$dataSection_NumProps++;
}
// Subject
if($this->_phpExcel->getProperties()->getSubject()){
$dataProp = $this->_phpExcel->getProperties()->getSubject();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x03),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
'data' => array('data' => $dataProp, 'length' => strlen($dataProp)));
$dataSection_NumProps++;
}
// Author (Creator)
if($this->_phpExcel->getProperties()->getCreator()){
$dataProp = $this->_phpExcel->getProperties()->getCreator();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x04),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
'data' => array('data' => $dataProp, 'length' => strlen($dataProp)));
$dataSection_NumProps++;
}
// Keywords
if($this->_phpExcel->getProperties()->getKeywords()){
$dataProp = $this->_phpExcel->getProperties()->getKeywords();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x05),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
'data' => array('data' => $dataProp, 'length' => strlen($dataProp)));
$dataSection_NumProps++;
}
// Comments (Description)
if($this->_phpExcel->getProperties()->getDescription()){
$dataProp = $this->_phpExcel->getProperties()->getDescription();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x06),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
'data' => array('data' => $dataProp, 'length' => strlen($dataProp)));
$dataSection_NumProps++;
}
// Last Saved By (LastModifiedBy)
if($this->_phpExcel->getProperties()->getLastModifiedBy()){
$dataProp = $this->_phpExcel->getProperties()->getLastModifiedBy();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x08),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
'data' => array('data' => $dataProp, 'length' => strlen($dataProp)));
$dataSection_NumProps++;
}
// Created Date/Time
if($this->_phpExcel->getProperties()->getCreated()){
$dataProp = $this->_phpExcel->getProperties()->getCreated();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0C),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x40), // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
'data' => array('data' => PHPExcel_Shared_OLE::LocalDate2OLE($dataProp)));
$dataSection_NumProps++;
}
// Modified Date/Time
if($this->_phpExcel->getProperties()->getModified()){
$dataProp = $this->_phpExcel->getProperties()->getModified();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0D),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x40), // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
'data' => array('data' => PHPExcel_Shared_OLE::LocalDate2OLE($dataProp)));
$dataSection_NumProps++;
}
// Security
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x13),
'offset' => array('pack' => 'V'),
'type' => array('pack' => 'V', 'data' => 0x03), // 4 byte signed integer
'data' => array('data' => 0x00));
$dataSection_NumProps++;
// 4 Section Length
// 4 Property count
// 8 * $dataSection_NumProps (8 = ID (4) + OffSet(4))
$dataSection_Content_Offset = 8 + $dataSection_NumProps * 8;
foreach ($dataSection as $dataProp){
// Summary
$dataSection_Summary .= pack($dataProp['summary']['pack'], $dataProp['summary']['data']);
// Offset
$dataSection_Summary .= pack($dataProp['offset']['pack'], $dataSection_Content_Offset);
// DataType
$dataSection_Content .= pack($dataProp['type']['pack'], $dataProp['type']['data']);
// Data
if($dataProp['type']['data'] == 0x02){ // 2 byte signed integer
$dataSection_Content .= pack('V', $dataProp['data']['data']);
$dataSection_Content_Offset += 4 + 4;
}
elseif($dataProp['type']['data'] == 0x03){ // 4 byte signed integer
$dataSection_Content .= pack('V', $dataProp['data']['data']);
$dataSection_Content_Offset += 4 + 4;
}
elseif($dataProp['type']['data'] == 0x1E){ // null-terminated string prepended by dword string length
// Null-terminated string
$dataProp['data']['data'] .= chr(0);
$dataProp['data']['length'] += 1;
// Complete the string with null string for being a %4
$dataProp['data']['length'] = $dataProp['data']['length'] + ((4 - $dataProp['data']['length'] % 4)==4 ? 0 : (4 - $dataProp['data']['length'] % 4));
$dataProp['data']['data'] = str_pad($dataProp['data']['data'], $dataProp['data']['length'], chr(0), STR_PAD_RIGHT);
$dataSection_Content .= pack('V', $dataProp['data']['length']);
$dataSection_Content .= $dataProp['data']['data'];
$dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
}
elseif($dataProp['type']['data'] == 0x40){ // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
$dataSection_Content .= $dataProp['data']['data'];
$dataSection_Content_Offset += 4 + 8;
}
else {
// Data Type Not Used at the moment
}
}
// Now $dataSection_Content_Offset contains the size of the content
// section header
// offset: $secOffset; size: 4; section length
// + x Size of the content (summary + content)
$data .= pack('V', $dataSection_Content_Offset);
// offset: $secOffset+4; size: 4; property count
$data .= pack('V', $dataSection_NumProps);
// Section Summary
$data .= $dataSection_Summary;
// Section Content
$data .= $dataSection_Content;
return $data;
}
}
PK ! "*d d PHPExcel/Writer/Exception.phpnu [ line = $line;
$e->file = $file;
throw $e;
}
}
PK ! ^I I PHPExcel/Writer/Excel2007.phpnu [ setPHPExcel($pPHPExcel);
$writerPartsArray = array( 'stringtable' => 'PHPExcel_Writer_Excel2007_StringTable',
'contenttypes' => 'PHPExcel_Writer_Excel2007_ContentTypes',
'docprops' => 'PHPExcel_Writer_Excel2007_DocProps',
'rels' => 'PHPExcel_Writer_Excel2007_Rels',
'theme' => 'PHPExcel_Writer_Excel2007_Theme',
'style' => 'PHPExcel_Writer_Excel2007_Style',
'workbook' => 'PHPExcel_Writer_Excel2007_Workbook',
'worksheet' => 'PHPExcel_Writer_Excel2007_Worksheet',
'drawing' => 'PHPExcel_Writer_Excel2007_Drawing',
'comments' => 'PHPExcel_Writer_Excel2007_Comments',
'chart' => 'PHPExcel_Writer_Excel2007_Chart',
'relsvba' => 'PHPExcel_Writer_Excel2007_RelsVBA',
'relsribbonobjects' => 'PHPExcel_Writer_Excel2007_RelsRibbon'
);
// Initialise writer parts
// and Assign their parent IWriters
foreach ($writerPartsArray as $writer => $class) {
$this->_writerParts[$writer] = new $class($this);
}
$hashTablesArray = array( '_stylesConditionalHashTable', '_fillHashTable', '_fontHashTable',
'_bordersHashTable', '_numFmtHashTable', '_drawingHashTable',
'_styleHashTable'
);
// Set HashTable variables
foreach ($hashTablesArray as $tableName) {
$this->$tableName = new PHPExcel_HashTable();
}
}
/**
* Get writer part
*
* @param string $pPartName Writer part name
* @return PHPExcel_Writer_Excel2007_WriterPart
*/
public function getWriterPart($pPartName = '') {
if ($pPartName != '' && isset($this->_writerParts[strtolower($pPartName)])) {
return $this->_writerParts[strtolower($pPartName)];
} else {
return null;
}
}
/**
* Save PHPExcel to file
*
* @param string $pFilename
* @throws PHPExcel_Writer_Exception
*/
public function save($pFilename = null)
{
if ($this->_spreadSheet !== NULL) {
// garbage collect
$this->_spreadSheet->garbageCollect();
// If $pFilename is php://output or php://stdout, make it a temporary file...
$originalFilename = $pFilename;
if (strtolower($pFilename) == 'php://output' || strtolower($pFilename) == 'php://stdout') {
$pFilename = @tempnam(PHPExcel_Shared_File::sys_get_temp_dir(), 'phpxltmp');
if ($pFilename == '') {
$pFilename = $originalFilename;
}
}
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_spreadSheet)->getDebugLog()->getWriteDebugLog();
PHPExcel_Calculation::getInstance($this->_spreadSheet)->getDebugLog()->setWriteDebugLog(FALSE);
$saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType();
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// Create string lookup table
$this->_stringTable = array();
for ($i = 0; $i < $this->_spreadSheet->getSheetCount(); ++$i) {
$this->_stringTable = $this->getWriterPart('StringTable')->createStringTable($this->_spreadSheet->getSheet($i), $this->_stringTable);
}
// Create styles dictionaries
$this->_styleHashTable->addFromSource( $this->getWriterPart('Style')->allStyles($this->_spreadSheet) );
$this->_stylesConditionalHashTable->addFromSource( $this->getWriterPart('Style')->allConditionalStyles($this->_spreadSheet) );
$this->_fillHashTable->addFromSource( $this->getWriterPart('Style')->allFills($this->_spreadSheet) );
$this->_fontHashTable->addFromSource( $this->getWriterPart('Style')->allFonts($this->_spreadSheet) );
$this->_bordersHashTable->addFromSource( $this->getWriterPart('Style')->allBorders($this->_spreadSheet) );
$this->_numFmtHashTable->addFromSource( $this->getWriterPart('Style')->allNumberFormats($this->_spreadSheet) );
// Create drawing dictionary
$this->_drawingHashTable->addFromSource( $this->getWriterPart('Drawing')->allDrawings($this->_spreadSheet) );
// Create new ZIP file and open it for writing
$zipClass = PHPExcel_Settings::getZipClass();
$objZip = new $zipClass();
// Retrieve OVERWRITE and CREATE constants from the instantiated zip class
// This method of accessing constant values from a dynamic class should work with all appropriate versions of PHP
$ro = new ReflectionObject($objZip);
$zipOverWrite = $ro->getConstant('OVERWRITE');
$zipCreate = $ro->getConstant('CREATE');
if (file_exists($pFilename)) {
unlink($pFilename);
}
// Try opening the ZIP file
if ($objZip->open($pFilename, $zipOverWrite) !== true) {
if ($objZip->open($pFilename, $zipCreate) !== true) {
throw new PHPExcel_Writer_Exception("Could not open " . $pFilename . " for writing.");
}
}
// Add [Content_Types].xml to ZIP file
$objZip->addFromString('[Content_Types].xml', $this->getWriterPart('ContentTypes')->writeContentTypes($this->_spreadSheet, $this->_includeCharts));
//if hasMacros, add the vbaProject.bin file, Certificate file(if exists)
if($this->_spreadSheet->hasMacros()){
$macrosCode=$this->_spreadSheet->getMacrosCode();
if(!is_null($macrosCode)){// we have the code ?
$objZip->addFromString('xl/vbaProject.bin', $macrosCode);//allways in 'xl', allways named vbaProject.bin
if($this->_spreadSheet->hasMacrosCertificate()){//signed macros ?
// Yes : add the certificate file and the related rels file
$objZip->addFromString('xl/vbaProjectSignature.bin', $this->_spreadSheet->getMacrosCertificate());
$objZip->addFromString('xl/_rels/vbaProject.bin.rels',
$this->getWriterPart('RelsVBA')->writeVBARelationships($this->_spreadSheet));
}
}
}
//a custom UI in this workbook ? add it ("base" xml and additional objects (pictures) and rels)
if($this->_spreadSheet->hasRibbon()){
$tmpRibbonTarget=$this->_spreadSheet->getRibbonXMLData('target');
$objZip->addFromString($tmpRibbonTarget, $this->_spreadSheet->getRibbonXMLData('data'));
if($this->_spreadSheet->hasRibbonBinObjects()){
$tmpRootPath=dirname($tmpRibbonTarget).'/';
$ribbonBinObjects=$this->_spreadSheet->getRibbonBinObjects('data');//the files to write
foreach($ribbonBinObjects as $aPath=>$aContent){
$objZip->addFromString($tmpRootPath.$aPath, $aContent);
}
//the rels for files
$objZip->addFromString($tmpRootPath.'_rels/'.basename($tmpRibbonTarget).'.rels',
$this->getWriterPart('RelsRibbonObjects')->writeRibbonRelationships($this->_spreadSheet));
}
}
// Add relationships to ZIP file
$objZip->addFromString('_rels/.rels', $this->getWriterPart('Rels')->writeRelationships($this->_spreadSheet));
$objZip->addFromString('xl/_rels/workbook.xml.rels', $this->getWriterPart('Rels')->writeWorkbookRelationships($this->_spreadSheet));
// Add document properties to ZIP file
$objZip->addFromString('docProps/app.xml', $this->getWriterPart('DocProps')->writeDocPropsApp($this->_spreadSheet));
$objZip->addFromString('docProps/core.xml', $this->getWriterPart('DocProps')->writeDocPropsCore($this->_spreadSheet));
$customPropertiesPart = $this->getWriterPart('DocProps')->writeDocPropsCustom($this->_spreadSheet);
if ($customPropertiesPart !== NULL) {
$objZip->addFromString('docProps/custom.xml', $customPropertiesPart);
}
// Add theme to ZIP file
$objZip->addFromString('xl/theme/theme1.xml', $this->getWriterPart('Theme')->writeTheme($this->_spreadSheet));
// Add string table to ZIP file
$objZip->addFromString('xl/sharedStrings.xml', $this->getWriterPart('StringTable')->writeStringTable($this->_stringTable));
// Add styles to ZIP file
$objZip->addFromString('xl/styles.xml', $this->getWriterPart('Style')->writeStyles($this->_spreadSheet));
// Add workbook to ZIP file
$objZip->addFromString('xl/workbook.xml', $this->getWriterPart('Workbook')->writeWorkbook($this->_spreadSheet, $this->_preCalculateFormulas));
$chartCount = 0;
// Add worksheets
for ($i = 0; $i < $this->_spreadSheet->getSheetCount(); ++$i) {
$objZip->addFromString('xl/worksheets/sheet' . ($i + 1) . '.xml', $this->getWriterPart('Worksheet')->writeWorksheet($this->_spreadSheet->getSheet($i), $this->_stringTable, $this->_includeCharts));
if ($this->_includeCharts) {
$charts = $this->_spreadSheet->getSheet($i)->getChartCollection();
if (count($charts) > 0) {
foreach($charts as $chart) {
$objZip->addFromString('xl/charts/chart' . ($chartCount + 1) . '.xml', $this->getWriterPart('Chart')->writeChart($chart));
$chartCount++;
}
}
}
}
$chartRef1 = $chartRef2 = 0;
// Add worksheet relationships (drawings, ...)
for ($i = 0; $i < $this->_spreadSheet->getSheetCount(); ++$i) {
// Add relationships
$objZip->addFromString('xl/worksheets/_rels/sheet' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeWorksheetRelationships($this->_spreadSheet->getSheet($i), ($i + 1), $this->_includeCharts));
$drawings = $this->_spreadSheet->getSheet($i)->getDrawingCollection();
$drawingCount = count($drawings);
if ($this->_includeCharts) {
$chartCount = $this->_spreadSheet->getSheet($i)->getChartCount();
}
// Add drawing and image relationship parts
if (($drawingCount > 0) || ($chartCount > 0)) {
// Drawing relationships
$objZip->addFromString('xl/drawings/_rels/drawing' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeDrawingRelationships($this->_spreadSheet->getSheet($i),$chartRef1, $this->_includeCharts));
// Drawings
$objZip->addFromString('xl/drawings/drawing' . ($i + 1) . '.xml', $this->getWriterPart('Drawing')->writeDrawings($this->_spreadSheet->getSheet($i),$chartRef2,$this->_includeCharts));
}
// Add comment relationship parts
if (count($this->_spreadSheet->getSheet($i)->getComments()) > 0) {
// VML Comments
$objZip->addFromString('xl/drawings/vmlDrawing' . ($i + 1) . '.vml', $this->getWriterPart('Comments')->writeVMLComments($this->_spreadSheet->getSheet($i)));
// Comments
$objZip->addFromString('xl/comments' . ($i + 1) . '.xml', $this->getWriterPart('Comments')->writeComments($this->_spreadSheet->getSheet($i)));
}
// Add header/footer relationship parts
if (count($this->_spreadSheet->getSheet($i)->getHeaderFooter()->getImages()) > 0) {
// VML Drawings
$objZip->addFromString('xl/drawings/vmlDrawingHF' . ($i + 1) . '.vml', $this->getWriterPart('Drawing')->writeVMLHeaderFooterImages($this->_spreadSheet->getSheet($i)));
// VML Drawing relationships
$objZip->addFromString('xl/drawings/_rels/vmlDrawingHF' . ($i + 1) . '.vml.rels', $this->getWriterPart('Rels')->writeHeaderFooterDrawingRelationships($this->_spreadSheet->getSheet($i)));
// Media
foreach ($this->_spreadSheet->getSheet($i)->getHeaderFooter()->getImages() as $image) {
$objZip->addFromString('xl/media/' . $image->getIndexedFilename(), file_get_contents($image->getPath()));
}
}
}
// Add media
for ($i = 0; $i < $this->getDrawingHashTable()->count(); ++$i) {
if ($this->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) {
$imageContents = null;
$imagePath = $this->getDrawingHashTable()->getByIndex($i)->getPath();
if (strpos($imagePath, 'zip://') !== false) {
$imagePath = substr($imagePath, 6);
$imagePathSplitted = explode('#', $imagePath);
$imageZip = new ZipArchive();
$imageZip->open($imagePathSplitted[0]);
$imageContents = $imageZip->getFromName($imagePathSplitted[1]);
$imageZip->close();
unset($imageZip);
} else {
$imageContents = file_get_contents($imagePath);
}
$objZip->addFromString('xl/media/' . str_replace(' ', '_', $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename()), $imageContents);
} else if ($this->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) {
ob_start();
call_user_func(
$this->getDrawingHashTable()->getByIndex($i)->getRenderingFunction(),
$this->getDrawingHashTable()->getByIndex($i)->getImageResource()
);
$imageContents = ob_get_contents();
ob_end_clean();
$objZip->addFromString('xl/media/' . str_replace(' ', '_', $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename()), $imageContents);
}
}
PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType);
PHPExcel_Calculation::getInstance($this->_spreadSheet)->getDebugLog()->setWriteDebugLog($saveDebugLog);
// Close file
if ($objZip->close() === false) {
throw new PHPExcel_Writer_Exception("Could not close zip file $pFilename.");
}
// If a temporary file was used, copy it to the correct file stream
if ($originalFilename != $pFilename) {
if (copy($pFilename, $originalFilename) === false) {
throw new PHPExcel_Writer_Exception("Could not copy temporary zip file $pFilename to $originalFilename.");
}
@unlink($pFilename);
}
} else {
throw new PHPExcel_Writer_Exception("PHPExcel object unassigned.");
}
}
/**
* Get PHPExcel object
*
* @return PHPExcel
* @throws PHPExcel_Writer_Exception
*/
public function getPHPExcel() {
if ($this->_spreadSheet !== null) {
return $this->_spreadSheet;
} else {
throw new PHPExcel_Writer_Exception("No PHPExcel assigned.");
}
}
/**
* Set PHPExcel object
*
* @param PHPExcel $pPHPExcel PHPExcel object
* @throws PHPExcel_Writer_Exception
* @return PHPExcel_Writer_Excel2007
*/
public function setPHPExcel(PHPExcel $pPHPExcel = null) {
$this->_spreadSheet = $pPHPExcel;
return $this;
}
/**
* Get string table
*
* @return string[]
*/
public function getStringTable() {
return $this->_stringTable;
}
/**
* Get PHPExcel_Style HashTable
*
* @return PHPExcel_HashTable
*/
public function getStyleHashTable() {
return $this->_styleHashTable;
}
/**
* Get PHPExcel_Style_Conditional HashTable
*
* @return PHPExcel_HashTable
*/
public function getStylesConditionalHashTable() {
return $this->_stylesConditionalHashTable;
}
/**
* Get PHPExcel_Style_Fill HashTable
*
* @return PHPExcel_HashTable
*/
public function getFillHashTable() {
return $this->_fillHashTable;
}
/**
* Get PHPExcel_Style_Font HashTable
*
* @return PHPExcel_HashTable
*/
public function getFontHashTable() {
return $this->_fontHashTable;
}
/**
* Get PHPExcel_Style_Borders HashTable
*
* @return PHPExcel_HashTable
*/
public function getBordersHashTable() {
return $this->_bordersHashTable;
}
/**
* Get PHPExcel_Style_NumberFormat HashTable
*
* @return PHPExcel_HashTable
*/
public function getNumFmtHashTable() {
return $this->_numFmtHashTable;
}
/**
* Get PHPExcel_Worksheet_BaseDrawing HashTable
*
* @return PHPExcel_HashTable
*/
public function getDrawingHashTable() {
return $this->_drawingHashTable;
}
/**
* Get Office2003 compatibility
*
* @return boolean
*/
public function getOffice2003Compatibility() {
return $this->_office2003compatibility;
}
/**
* Set Office2003 compatibility
*
* @param boolean $pValue Office2003 compatibility?
* @return PHPExcel_Writer_Excel2007
*/
public function setOffice2003Compatibility($pValue = false) {
$this->_office2003compatibility = $pValue;
return $this;
}
}
PK ! l 4 4 ! PHPExcel/Writer/Excel5/Escher.phpnu [ _object = $object;
}
/**
* Process the object to be written
*/
public function close()
{
// initialize
$this->_data = '';
switch (get_class($this->_object)) {
case 'PHPExcel_Shared_Escher':
if ($dggContainer = $this->_object->getDggContainer()) {
$writer = new PHPExcel_Writer_Excel5_Escher($dggContainer);
$this->_data = $writer->close();
} else if ($dgContainer = $this->_object->getDgContainer()) {
$writer = new PHPExcel_Writer_Excel5_Escher($dgContainer);
$this->_data = $writer->close();
$this->_spOffsets = $writer->getSpOffsets();
$this->_spTypes = $writer->getSpTypes();
}
break;
case 'PHPExcel_Shared_Escher_DggContainer':
// this is a container record
// initialize
$innerData = '';
// write the dgg
$recVer = 0x0;
$recInstance = 0x0000;
$recType = 0xF006;
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
// dgg data
$dggData =
pack('VVVV'
, $this->_object->getSpIdMax() // maximum shape identifier increased by one
, $this->_object->getCDgSaved() + 1 // number of file identifier clusters increased by one
, $this->_object->getCSpSaved()
, $this->_object->getCDgSaved() // count total number of drawings saved
);
// add file identifier clusters (one per drawing)
$IDCLs = $this->_object->getIDCLs();
foreach ($IDCLs as $dgId => $maxReducedSpId) {
$dggData .= pack('VV', $dgId, $maxReducedSpId + 1);
}
$header = pack('vvV', $recVerInstance, $recType, strlen($dggData));
$innerData .= $header . $dggData;
// write the bstoreContainer
if ($bstoreContainer = $this->_object->getBstoreContainer()) {
$writer = new PHPExcel_Writer_Excel5_Escher($bstoreContainer);
$innerData .= $writer->close();
}
// write the record
$recVer = 0xF;
$recInstance = 0x0000;
$recType = 0xF000;
$length = strlen($innerData);
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$this->_data = $header . $innerData;
break;
case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer':
// this is a container record
// initialize
$innerData = '';
// treat the inner data
if ($BSECollection = $this->_object->getBSECollection()) {
foreach ($BSECollection as $BSE) {
$writer = new PHPExcel_Writer_Excel5_Escher($BSE);
$innerData .= $writer->close();
}
}
// write the record
$recVer = 0xF;
$recInstance = count($this->_object->getBSECollection());
$recType = 0xF001;
$length = strlen($innerData);
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$this->_data = $header . $innerData;
break;
case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE':
// this is a semi-container record
// initialize
$innerData = '';
// here we treat the inner data
if ($blip = $this->_object->getBlip()) {
$writer = new PHPExcel_Writer_Excel5_Escher($blip);
$innerData .= $writer->close();
}
// initialize
$data = '';
$btWin32 = $this->_object->getBlipType();
$btMacOS = $this->_object->getBlipType();
$data .= pack('CC', $btWin32, $btMacOS);
$rgbUid = pack('VVVV', 0,0,0,0); // todo
$data .= $rgbUid;
$tag = 0;
$size = strlen($innerData);
$cRef = 1;
$foDelay = 0; //todo
$unused1 = 0x0;
$cbName = 0x0;
$unused2 = 0x0;
$unused3 = 0x0;
$data .= pack('vVVVCCCC', $tag, $size, $cRef, $foDelay, $unused1, $cbName, $unused2, $unused3);
$data .= $innerData;
// write the record
$recVer = 0x2;
$recInstance = $this->_object->getBlipType();
$recType = 0xF007;
$length = strlen($data);
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$this->_data = $header;
$this->_data .= $data;
break;
case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip':
// this is an atom record
// write the record
switch ($this->_object->getParent()->getBlipType()) {
case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG:
// initialize
$innerData = '';
$rgbUid1 = pack('VVVV', 0,0,0,0); // todo
$innerData .= $rgbUid1;
$tag = 0xFF; // todo
$innerData .= pack('C', $tag);
$innerData .= $this->_object->getData();
$recVer = 0x0;
$recInstance = 0x46A;
$recType = 0xF01D;
$length = strlen($innerData);
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$this->_data = $header;
$this->_data .= $innerData;
break;
case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG:
// initialize
$innerData = '';
$rgbUid1 = pack('VVVV', 0,0,0,0); // todo
$innerData .= $rgbUid1;
$tag = 0xFF; // todo
$innerData .= pack('C', $tag);
$innerData .= $this->_object->getData();
$recVer = 0x0;
$recInstance = 0x6E0;
$recType = 0xF01E;
$length = strlen($innerData);
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$this->_data = $header;
$this->_data .= $innerData;
break;
}
break;
case 'PHPExcel_Shared_Escher_DgContainer':
// this is a container record
// initialize
$innerData = '';
// write the dg
$recVer = 0x0;
$recInstance = $this->_object->getDgId();
$recType = 0xF008;
$length = 8;
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
// number of shapes in this drawing (including group shape)
$countShapes = count($this->_object->getSpgrContainer()->getChildren());
$innerData .= $header . pack('VV', $countShapes, $this->_object->getLastSpId());
//$innerData .= $header . pack('VV', 0, 0);
// write the spgrContainer
if ($spgrContainer = $this->_object->getSpgrContainer()) {
$writer = new PHPExcel_Writer_Excel5_Escher($spgrContainer);
$innerData .= $writer->close();
// get the shape offsets relative to the spgrContainer record
$spOffsets = $writer->getSpOffsets();
$spTypes = $writer->getSpTypes();
// save the shape offsets relative to dgContainer
foreach ($spOffsets as & $spOffset) {
$spOffset += 24; // add length of dgContainer header data (8 bytes) plus dg data (16 bytes)
}
$this->_spOffsets = $spOffsets;
$this->_spTypes = $spTypes;
}
// write the record
$recVer = 0xF;
$recInstance = 0x0000;
$recType = 0xF002;
$length = strlen($innerData);
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$this->_data = $header . $innerData;
break;
case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer':
// this is a container record
// initialize
$innerData = '';
// initialize spape offsets
$totalSize = 8;
$spOffsets = array();
$spTypes = array();
// treat the inner data
foreach ($this->_object->getChildren() as $spContainer) {
$writer = new PHPExcel_Writer_Excel5_Escher($spContainer);
$spData = $writer->close();
$innerData .= $spData;
// save the shape offsets (where new shape records begin)
$totalSize += strlen($spData);
$spOffsets[] = $totalSize;
$spTypes = array_merge($spTypes, $writer->getSpTypes());
}
// write the record
$recVer = 0xF;
$recInstance = 0x0000;
$recType = 0xF003;
$length = strlen($innerData);
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$this->_data = $header . $innerData;
$this->_spOffsets = $spOffsets;
$this->_spTypes = $spTypes;
break;
case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer':
// initialize
$data = '';
// build the data
// write group shape record, if necessary?
if ($this->_object->getSpgr()) {
$recVer = 0x1;
$recInstance = 0x0000;
$recType = 0xF009;
$length = 0x00000010;
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$data .= $header . pack('VVVV', 0,0,0,0);
}
$this->_spTypes[] = ($this->_object->getSpType());
// write the shape record
$recVer = 0x2;
$recInstance = $this->_object->getSpType(); // shape type
$recType = 0xF00A;
$length = 0x00000008;
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$data .= $header . pack('VV', $this->_object->getSpId(), $this->_object->getSpgr() ? 0x0005 : 0x0A00);
// the options
if ($this->_object->getOPTCollection()) {
$optData = '';
$recVer = 0x3;
$recInstance = count($this->_object->getOPTCollection());
$recType = 0xF00B;
foreach ($this->_object->getOPTCollection() as $property => $value) {
$optData .= pack('vV', $property, $value);
}
$length = strlen($optData);
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$data .= $header . $optData;
}
// the client anchor
if ($this->_object->getStartCoordinates()) {
$clientAnchorData = '';
$recVer = 0x0;
$recInstance = 0x0;
$recType = 0xF010;
// start coordinates
list($column, $row) = PHPExcel_Cell::coordinateFromString($this->_object->getStartCoordinates());
$c1 = PHPExcel_Cell::columnIndexFromString($column) - 1;
$r1 = $row - 1;
// start offsetX
$startOffsetX = $this->_object->getStartOffsetX();
// start offsetY
$startOffsetY = $this->_object->getStartOffsetY();
// end coordinates
list($column, $row) = PHPExcel_Cell::coordinateFromString($this->_object->getEndCoordinates());
$c2 = PHPExcel_Cell::columnIndexFromString($column) - 1;
$r2 = $row - 1;
// end offsetX
$endOffsetX = $this->_object->getEndOffsetX();
// end offsetY
$endOffsetY = $this->_object->getEndOffsetY();
$clientAnchorData = pack('vvvvvvvvv', $this->_object->getSpFlag(),
$c1, $startOffsetX, $r1, $startOffsetY,
$c2, $endOffsetX, $r2, $endOffsetY);
$length = strlen($clientAnchorData);
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$data .= $header . $clientAnchorData;
}
// the client data, just empty for now
if (!$this->_object->getSpgr()) {
$clientDataData = '';
$recVer = 0x0;
$recInstance = 0x0;
$recType = 0xF011;
$length = strlen($clientDataData);
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$data .= $header . $clientDataData;
}
// write the record
$recVer = 0xF;
$recInstance = 0x0000;
$recType = 0xF004;
$length = strlen($data);
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
$this->_data = $header . $data;
break;
}
return $this->_data;
}
/**
* Gets the shape offsets
*
* @return array
*/
public function getSpOffsets()
{
return $this->_spOffsets;
}
/**
* Gets the shape types
*
* @return array
*/
public function getSpTypes()
{
return $this->_spTypes;
}
}
PK ! ϝd( ( % PHPExcel/Writer/Excel5/BIFFwriter.phpnu [
// *
// * The majority of this is _NOT_ my code. I simply ported it from the
// * PERL Spreadsheet::WriteExcel module.
// *
// * The author of the Spreadsheet::WriteExcel module is John McNamara
// *
// *
// * I _DO_ maintain this code, and John McNamara has nothing to do with the
// * porting of this code to PHP. Any questions directly related to this
// * class library should be directed to me.
// *
// * License Information:
// *
// * Spreadsheet_Excel_Writer: A library for generating Excel Spreadsheets
// * Copyright (c) 2002-2003 Xavier Noguer xnoguer@rezebra.com
// *
// * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// */
/**
* PHPExcel_Writer_Excel5_BIFFwriter
*
* @category PHPExcel
* @package PHPExcel_Writer_Excel5
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Writer_Excel5_BIFFwriter
{
/**
* The byte order of this architecture. 0 => little endian, 1 => big endian
* @var integer
*/
private static $_byte_order;
/**
* The string containing the data of the BIFF stream
* @var string
*/
public $_data;
/**
* The size of the data in bytes. Should be the same as strlen($this->_data)
* @var integer
*/
public $_datasize;
/**
* The maximum length for a BIFF record (excluding record header and length field). See _addContinue()
* @var integer
* @see _addContinue()
*/
public $_limit = 8224;
/**
* Constructor
*/
public function __construct()
{
$this->_data = '';
$this->_datasize = 0;
// $this->_limit = 8224;
}
/**
* Determine the byte order and store it as class data to avoid
* recalculating it for each call to new().
*
* @return int
*/
public static function getByteOrder()
{
if (!isset(self::$_byte_order)) {
// Check if "pack" gives the required IEEE 64bit float
$teststr = pack("d", 1.2345);
$number = pack("C8", 0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F);
if ($number == $teststr) {
$byte_order = 0; // Little Endian
} elseif ($number == strrev($teststr)){
$byte_order = 1; // Big Endian
} else {
// Give up. I'll fix this in a later version.
throw new PHPExcel_Writer_Exception("Required floating point format not supported on this platform.");
}
self::$_byte_order = $byte_order;
}
return self::$_byte_order;
}
/**
* General storage function
*
* @param string $data binary data to append
* @access private
*/
function _append($data)
{
if (strlen($data) - 4 > $this->_limit) {
$data = $this->_addContinue($data);
}
$this->_data .= $data;
$this->_datasize += strlen($data);
}
/**
* General storage function like _append, but returns string instead of modifying $this->_data
*
* @param string $data binary data to write
* @return string
*/
public function writeData($data)
{
if (strlen($data) - 4 > $this->_limit) {
$data = $this->_addContinue($data);
}
$this->_datasize += strlen($data);
return $data;
}
/**
* Writes Excel BOF record to indicate the beginning of a stream or
* sub-stream in the BIFF file.
*
* @param integer $type Type of BIFF file to write: 0x0005 Workbook,
* 0x0010 Worksheet.
* @access private
*/
function _storeBof($type)
{
$record = 0x0809; // Record identifier (BIFF5-BIFF8)
$length = 0x0010;
// by inspection of real files, MS Office Excel 2007 writes the following
$unknown = pack("VV", 0x000100D1, 0x00000406);
$build = 0x0DBB; // Excel 97
$year = 0x07CC; // Excel 97
$version = 0x0600; // BIFF8
$header = pack("vv", $record, $length);
$data = pack("vvvv", $version, $type, $build, $year);
$this->_append($header . $data . $unknown);
}
/**
* Writes Excel EOF record to indicate the end of a BIFF stream.
*
* @access private
*/
function _storeEof()
{
$record = 0x000A; // Record identifier
$length = 0x0000; // Number of bytes to follow
$header = pack("vv", $record, $length);
$this->_append($header);
}
/**
* Writes Excel EOF record to indicate the end of a BIFF stream.
*
* @access private
*/
public function writeEof()
{
$record = 0x000A; // Record identifier
$length = 0x0000; // Number of bytes to follow
$header = pack("vv", $record, $length);
return $this->writeData($header);
}
/**
* Excel limits the size of BIFF records. In Excel 5 the limit is 2084 bytes. In
* Excel 97 the limit is 8228 bytes. Records that are longer than these limits
* must be split up into CONTINUE blocks.
*
* This function takes a long BIFF record and inserts CONTINUE records as
* necessary.
*
* @param string $data The original binary data to be written
* @return string A very convenient string of continue blocks
* @access private
*/
function _addContinue($data)
{
$limit = $this->_limit;
$record = 0x003C; // Record identifier
// The first 2080/8224 bytes remain intact. However, we have to change
// the length field of the record.
$tmp = substr($data, 0, 2) . pack("v", $limit) . substr($data, 4, $limit);
$header = pack("vv", $record, $limit); // Headers for continue records
// Retrieve chunks of 2080/8224 bytes +4 for the header.
$data_length = strlen($data);
for ($i = $limit + 4; $i < ($data_length - $limit); $i += $limit) {
$tmp .= $header;
$tmp .= substr($data, $i, $limit);
}
// Retrieve the last chunk of data
$header = pack("vv", $record, strlen($data) - $i);
$tmp .= $header;
$tmp .= substr($data, $i, strlen($data) - $i);
return $tmp;
}
}
PK ! Cmmv v $ PHPExcel/Writer/Excel5/Worksheet.phpnu [
// *
// * The majority of this is _NOT_ my code. I simply ported it from the
// * PERL Spreadsheet::WriteExcel module.
// *
// * The author of the Spreadsheet::WriteExcel module is John McNamara
// *
// *
// * I _DO_ maintain this code, and John McNamara has nothing to do with the
// * porting of this code to PHP. Any questions directly related to this
// * class library should be directed to me.
// *
// * License Information:
// *
// * Spreadsheet_Excel_Writer: A library for generating Excel Spreadsheets
// * Copyright (c) 2002-2003 Xavier Noguer xnoguer@rezebra.com
// *
// * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// */
/**
* PHPExcel_Writer_Excel5_Worksheet
*
* @category PHPExcel
* @package PHPExcel_Writer_Excel5
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
{
/**
* Formula parser
*
* @var PHPExcel_Writer_Excel5_Parser
*/
private $_parser;
/**
* Maximum number of characters for a string (LABEL record in BIFF5)
* @var integer
*/
public $_xls_strmax;
/**
* Array containing format information for columns
* @var array
*/
public $_colinfo;
/**
* Array containing the selected area for the worksheet
* @var array
*/
public $_selection;
/**
* The active pane for the worksheet
* @var integer
*/
public $_active_pane;
/**
* Whether to use outline.
* @var integer
*/
public $_outline_on;
/**
* Auto outline styles.
* @var bool
*/
public $_outline_style;
/**
* Whether to have outline summary below.
* @var bool
*/
public $_outline_below;
/**
* Whether to have outline summary at the right.
* @var bool
*/
public $_outline_right;
/**
* Reference to the total number of strings in the workbook
* @var integer
*/
public $_str_total;
/**
* Reference to the number of unique strings in the workbook
* @var integer
*/
public $_str_unique;
/**
* Reference to the array containing all the unique strings in the workbook
* @var array
*/
public $_str_table;
/**
* Color cache
*/
private $_colors;
/**
* Index of first used row (at least 0)
* @var int
*/
private $_firstRowIndex;
/**
* Index of last used row. (no used rows means -1)
* @var int
*/
private $_lastRowIndex;
/**
* Index of first used column (at least 0)
* @var int
*/
private $_firstColumnIndex;
/**
* Index of last used column (no used columns means -1)
* @var int
*/
private $_lastColumnIndex;
/**
* Sheet object
* @var PHPExcel_Worksheet
*/
public $_phpSheet;
/**
* Count cell style Xfs
*
* @var int
*/
private $_countCellStyleXfs;
/**
* Escher object corresponding to MSODRAWING
*
* @var PHPExcel_Shared_Escher
*/
private $_escher;
/**
* Array of font hashes associated to FONT records index
*
* @var array
*/
public $_fntHashIndex;
/**
* Constructor
*
* @param int &$str_total Total number of strings
* @param int &$str_unique Total number of unique strings
* @param array &$str_table String Table
* @param array &$colors Colour Table
* @param mixed $parser The formula parser created for the Workbook
* @param boolean $preCalculateFormulas Flag indicating whether formulas should be calculated or just written
* @param string $phpSheet The worksheet to write
* @param PHPExcel_Worksheet $phpSheet
*/
public function __construct(&$str_total, &$str_unique, &$str_table, &$colors,
$parser, $preCalculateFormulas, $phpSheet)
{
// It needs to call its parent's constructor explicitly
parent::__construct();
// change BIFFwriter limit for CONTINUE records
// $this->_limit = 8224;
$this->_preCalculateFormulas = $preCalculateFormulas;
$this->_str_total = &$str_total;
$this->_str_unique = &$str_unique;
$this->_str_table = &$str_table;
$this->_colors = &$colors;
$this->_parser = $parser;
$this->_phpSheet = $phpSheet;
//$this->ext_sheets = array();
//$this->offset = 0;
$this->_xls_strmax = 255;
$this->_colinfo = array();
$this->_selection = array(0,0,0,0);
$this->_active_pane = 3;
$this->_print_headers = 0;
$this->_outline_style = 0;
$this->_outline_below = 1;
$this->_outline_right = 1;
$this->_outline_on = 1;
$this->_fntHashIndex = array();
// calculate values for DIMENSIONS record
$minR = 1;
$minC = 'A';
$maxR = $this->_phpSheet->getHighestRow();
$maxC = $this->_phpSheet->getHighestColumn();
// Determine lowest and highest column and row
// $this->_firstRowIndex = ($minR > 65535) ? 65535 : $minR;
$this->_lastRowIndex = ($maxR > 65535) ? 65535 : $maxR ;
$this->_firstColumnIndex = PHPExcel_Cell::columnIndexFromString($minC);
$this->_lastColumnIndex = PHPExcel_Cell::columnIndexFromString($maxC);
// if ($this->_firstColumnIndex > 255) $this->_firstColumnIndex = 255;
if ($this->_lastColumnIndex > 255) $this->_lastColumnIndex = 255;
$this->_countCellStyleXfs = count($phpSheet->getParent()->getCellStyleXfCollection());
}
/**
* Add data to the beginning of the workbook (note the reverse order)
* and to the end of the workbook.
*
* @access public
* @see PHPExcel_Writer_Excel5_Workbook::storeWorkbook()
*/
function close()
{
$_phpSheet = $this->_phpSheet;
$num_sheets = $_phpSheet->getParent()->getSheetCount();
// Write BOF record
$this->_storeBof(0x0010);
// Write PRINTHEADERS
$this->_writePrintHeaders();
// Write PRINTGRIDLINES
$this->_writePrintGridlines();
// Write GRIDSET
$this->_writeGridset();
// Calculate column widths
$_phpSheet->calculateColumnWidths();
// Column dimensions
if (($defaultWidth = $_phpSheet->getDefaultColumnDimension()->getWidth()) < 0) {
$defaultWidth = PHPExcel_Shared_Font::getDefaultColumnWidthByFont($_phpSheet->getParent()->getDefaultStyle()->getFont());
}
$columnDimensions = $_phpSheet->getColumnDimensions();
$maxCol = $this->_lastColumnIndex -1;
for ($i = 0; $i <= $maxCol; ++$i) {
$hidden = 0;
$level = 0;
$xfIndex = 15; // there are 15 cell style Xfs
$width = $defaultWidth;
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($i);
if (isset($columnDimensions[$columnLetter])) {
$columnDimension = $columnDimensions[$columnLetter];
if ($columnDimension->getWidth() >= 0) {
$width = $columnDimension->getWidth();
}
$hidden = $columnDimension->getVisible() ? 0 : 1;
$level = $columnDimension->getOutlineLevel();
$xfIndex = $columnDimension->getXfIndex() + 15; // there are 15 cell style Xfs
}
// Components of _colinfo:
// $firstcol first column on the range
// $lastcol last column on the range
// $width width to set
// $xfIndex The optional cell style Xf index to apply to the columns
// $hidden The optional hidden atribute
// $level The optional outline level
$this->_colinfo[] = array($i, $i, $width, $xfIndex, $hidden, $level);
}
// Write GUTS
$this->_writeGuts();
// Write DEFAULTROWHEIGHT
$this->_writeDefaultRowHeight();
// Write WSBOOL
$this->_writeWsbool();
// Write horizontal and vertical page breaks
$this->_writeBreaks();
// Write page header
$this->_writeHeader();
// Write page footer
$this->_writeFooter();
// Write page horizontal centering
$this->_writeHcenter();
// Write page vertical centering
$this->_writeVcenter();
// Write left margin
$this->_writeMarginLeft();
// Write right margin
$this->_writeMarginRight();
// Write top margin
$this->_writeMarginTop();
// Write bottom margin
$this->_writeMarginBottom();
// Write page setup
$this->_writeSetup();
// Write sheet protection
$this->_writeProtect();
// Write SCENPROTECT
$this->_writeScenProtect();
// Write OBJECTPROTECT
$this->_writeObjectProtect();
// Write sheet password
$this->_writePassword();
// Write DEFCOLWIDTH record
$this->_writeDefcol();
// Write the COLINFO records if they exist
if (!empty($this->_colinfo)) {
$colcount = count($this->_colinfo);
for ($i = 0; $i < $colcount; ++$i) {
$this->_writeColinfo($this->_colinfo[$i]);
}
}
$autoFilterRange = $_phpSheet->getAutoFilter()->getRange();
if (!empty($autoFilterRange)) {
// Write AUTOFILTERINFO
$this->_writeAutoFilterInfo();
}
// Write sheet dimensions
$this->_writeDimensions();
// Row dimensions
foreach ($_phpSheet->getRowDimensions() as $rowDimension) {
$xfIndex = $rowDimension->getXfIndex() + 15; // there are 15 cellXfs
$this->_writeRow( $rowDimension->getRowIndex() - 1, $rowDimension->getRowHeight(), $xfIndex, ($rowDimension->getVisible() ? '0' : '1'), $rowDimension->getOutlineLevel() );
}
// Write Cells
foreach ($_phpSheet->getCellCollection() as $cellID) {
$cell = $_phpSheet->getCell($cellID);
$row = $cell->getRow() - 1;
$column = PHPExcel_Cell::columnIndexFromString($cell->getColumn()) - 1;
// Don't break Excel!
// if ($row + 1 > 65536 or $column + 1 > 256) {
if ($row > 65535 || $column > 255) {
break;
}
// Write cell value
$xfIndex = $cell->getXfIndex() + 15; // there are 15 cell style Xfs
$cVal = $cell->getValue();
if ($cVal instanceof PHPExcel_RichText) {
// $this->_writeString($row, $column, $cVal->getPlainText(), $xfIndex);
$arrcRun = array();
$str_len = PHPExcel_Shared_String::CountCharacters($cVal->getPlainText(), 'UTF-8');
$str_pos = 0;
$elements = $cVal->getRichTextElements();
foreach ($elements as $element) {
// FONT Index
if ($element instanceof PHPExcel_RichText_Run) {
$str_fontidx = $this->_fntHashIndex[$element->getFont()->getHashCode()];
}
else {
$str_fontidx = 0;
}
$arrcRun[] = array('strlen' => $str_pos, 'fontidx' => $str_fontidx);
// Position FROM
$str_pos += PHPExcel_Shared_String::CountCharacters($element->getText(), 'UTF-8');
}
$this->_writeRichTextString($row, $column, $cVal->getPlainText(), $xfIndex, $arrcRun);
} else {
switch ($cell->getDatatype()) {
case PHPExcel_Cell_DataType::TYPE_STRING:
case PHPExcel_Cell_DataType::TYPE_NULL:
if ($cVal === '' || $cVal === null) {
$this->_writeBlank($row, $column, $xfIndex);
} else {
$this->_writeString($row, $column, $cVal, $xfIndex);
}
break;
case PHPExcel_Cell_DataType::TYPE_NUMERIC:
$this->_writeNumber($row, $column, $cVal, $xfIndex);
break;
case PHPExcel_Cell_DataType::TYPE_FORMULA:
$calculatedValue = $this->_preCalculateFormulas ?
$cell->getCalculatedValue() : null;
$this->_writeFormula($row, $column, $cVal, $xfIndex, $calculatedValue);
break;
case PHPExcel_Cell_DataType::TYPE_BOOL:
$this->_writeBoolErr($row, $column, $cVal, 0, $xfIndex);
break;
case PHPExcel_Cell_DataType::TYPE_ERROR:
$this->_writeBoolErr($row, $column, self::_mapErrorCode($cVal), 1, $xfIndex);
break;
}
}
}
// Append
$this->_writeMsoDrawing();
// Write WINDOW2 record
$this->_writeWindow2();
// Write PLV record
$this->_writePageLayoutView();
// Write ZOOM record
$this->_writeZoom();
if ($_phpSheet->getFreezePane()) {
$this->_writePanes();
}
// Write SELECTION record
$this->_writeSelection();
// Write MergedCellsTable Record
$this->_writeMergedCells();
// Hyperlinks
foreach ($_phpSheet->getHyperLinkCollection() as $coordinate => $hyperlink) {
list($column, $row) = PHPExcel_Cell::coordinateFromString($coordinate);
$url = $hyperlink->getUrl();
if ( strpos($url, 'sheet://') !== false ) {
// internal to current workbook
$url = str_replace('sheet://', 'internal:', $url);
} else if ( preg_match('/^(http:|https:|ftp:|mailto:)/', $url) ) {
// URL
// $url = $url;
} else {
// external (local file)
$url = 'external:' . $url;
}
$this->_writeUrl($row - 1, PHPExcel_Cell::columnIndexFromString($column) - 1, $url);
}
$this->_writeDataValidity();
$this->_writeSheetLayout();
// Write SHEETPROTECTION record
$this->_writeSheetProtection();
$this->_writeRangeProtection();
$arrConditionalStyles = $_phpSheet->getConditionalStylesCollection();
if(!empty($arrConditionalStyles)){
$arrConditional = array();
// @todo CFRule & CFHeader
// Write CFHEADER record
$this->_writeCFHeader();
// Write ConditionalFormattingTable records
foreach ($arrConditionalStyles as $cellCoordinate => $conditionalStyles) {
foreach ($conditionalStyles as $conditional) {
if($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION
|| $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS){
if(!in_array($conditional->getHashCode(), $arrConditional)){
$arrConditional[] = $conditional->getHashCode();
// Write CFRULE record
$this->_writeCFRule($conditional);
}
}
}
}
}
$this->_storeEof();
}
/**
* Write a cell range address in BIFF8
* always fixed range
* See section 2.5.14 in OpenOffice.org's Documentation of the Microsoft Excel File Format
*
* @param string $range E.g. 'A1' or 'A1:B6'
* @return string Binary data
*/
private function _writeBIFF8CellRangeAddressFixed($range = 'A1')
{
$explodes = explode(':', $range);
// extract first cell, e.g. 'A1'
$firstCell = $explodes[0];
// extract last cell, e.g. 'B6'
if (count($explodes) == 1) {
$lastCell = $firstCell;
} else {
$lastCell = $explodes[1];
}
$firstCellCoordinates = PHPExcel_Cell::coordinateFromString($firstCell); // e.g. array(0, 1)
$lastCellCoordinates = PHPExcel_Cell::coordinateFromString($lastCell); // e.g. array(1, 6)
return(pack('vvvv',
$firstCellCoordinates[1] - 1,
$lastCellCoordinates[1] - 1,
PHPExcel_Cell::columnIndexFromString($firstCellCoordinates[0]) - 1,
PHPExcel_Cell::columnIndexFromString($lastCellCoordinates[0]) - 1
));
}
/**
* Retrieves data from memory in one chunk, or from disk in $buffer
* sized chunks.
*
* @return string The data
*/
function getData()
{
$buffer = 4096;
// Return data stored in memory
if (isset($this->_data)) {
$tmp = $this->_data;
unset($this->_data);
return $tmp;
}
// No data to return
return false;
}
/**
* Set the option to print the row and column headers on the printed page.
*
* @access public
* @param integer $print Whether to print the headers or not. Defaults to 1 (print).
*/
function printRowColHeaders($print = 1)
{
$this->_print_headers = $print;
}
/**
* This method sets the properties for outlining and grouping. The defaults
* correspond to Excel's defaults.
*
* @param bool $visible
* @param bool $symbols_below
* @param bool $symbols_right
* @param bool $auto_style
*/
function setOutline($visible = true, $symbols_below = true, $symbols_right = true, $auto_style = false)
{
$this->_outline_on = $visible;
$this->_outline_below = $symbols_below;
$this->_outline_right = $symbols_right;
$this->_outline_style = $auto_style;
// Ensure this is a boolean vale for Window2
if ($this->_outline_on) {
$this->_outline_on = 1;
}
}
/**
* Write a double to the specified row and column (zero indexed).
* An integer can be written as a double. Excel will display an
* integer. $format is optional.
*
* Returns 0 : normal termination
* -2 : row or column out of range
*
* @param integer $row Zero indexed row
* @param integer $col Zero indexed column
* @param float $num The number to write
* @param mixed $xfIndex The optional XF format
* @return integer
*/
private function _writeNumber($row, $col, $num, $xfIndex)
{
$record = 0x0203; // Record identifier
$length = 0x000E; // Number of bytes to follow
$header = pack("vv", $record, $length);
$data = pack("vvv", $row, $col, $xfIndex);
$xl_double = pack("d", $num);
if (self::getByteOrder()) { // if it's Big Endian
$xl_double = strrev($xl_double);
}
$this->_append($header.$data.$xl_double);
return(0);
}
/**
* Write a LABELSST record or a LABEL record. Which one depends on BIFF version
*
* @param int $row Row index (0-based)
* @param int $col Column index (0-based)
* @param string $str The string
* @param int $xfIndex Index to XF record
*/
private function _writeString($row, $col, $str, $xfIndex)
{
$this->_writeLabelSst($row, $col, $str, $xfIndex);
}
/**
* Write a LABELSST record or a LABEL record. Which one depends on BIFF version
* It differs from _writeString by the writing of rich text strings.
* @param int $row Row index (0-based)
* @param int $col Column index (0-based)
* @param string $str The string
* @param mixed $xfIndex The XF format index for the cell
* @param array $arrcRun Index to Font record and characters beginning
*/
private function _writeRichTextString($row, $col, $str, $xfIndex, $arrcRun){
$record = 0x00FD; // Record identifier
$length = 0x000A; // Bytes to follow
$str = PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($str, $arrcRun);
/* check if string is already present */
if (!isset($this->_str_table[$str])) {
$this->_str_table[$str] = $this->_str_unique++;
}
$this->_str_total++;
$header = pack('vv', $record, $length);
$data = pack('vvvV', $row, $col, $xfIndex, $this->_str_table[$str]);
$this->_append($header.$data);
}
/**
* Write a string to the specified row and column (zero indexed).
* NOTE: there is an Excel 5 defined limit of 255 characters.
* $format is optional.
* Returns 0 : normal termination
* -2 : row or column out of range
* -3 : long string truncated to 255 chars
*
* @access public
* @param integer $row Zero indexed row
* @param integer $col Zero indexed column
* @param string $str The string to write
* @param mixed $xfIndex The XF format index for the cell
* @return integer
*/
private function _writeLabel($row, $col, $str, $xfIndex)
{
$strlen = strlen($str);
$record = 0x0204; // Record identifier
$length = 0x0008 + $strlen; // Bytes to follow
$str_error = 0;
if ($strlen > $this->_xls_strmax) { // LABEL must be < 255 chars
$str = substr($str, 0, $this->_xls_strmax);
$length = 0x0008 + $this->_xls_strmax;
$strlen = $this->_xls_strmax;
$str_error = -3;
}
$header = pack("vv", $record, $length);
$data = pack("vvvv", $row, $col, $xfIndex, $strlen);
$this->_append($header . $data . $str);
return($str_error);
}
/**
* Write a string to the specified row and column (zero indexed).
* This is the BIFF8 version (no 255 chars limit).
* $format is optional.
* Returns 0 : normal termination
* -2 : row or column out of range
* -3 : long string truncated to 255 chars
*
* @access public
* @param integer $row Zero indexed row
* @param integer $col Zero indexed column
* @param string $str The string to write
* @param mixed $xfIndex The XF format index for the cell
* @return integer
*/
private function _writeLabelSst($row, $col, $str, $xfIndex)
{
$record = 0x00FD; // Record identifier
$length = 0x000A; // Bytes to follow
$str = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($str);
/* check if string is already present */
if (!isset($this->_str_table[$str])) {
$this->_str_table[$str] = $this->_str_unique++;
}
$this->_str_total++;
$header = pack('vv', $record, $length);
$data = pack('vvvV', $row, $col, $xfIndex, $this->_str_table[$str]);
$this->_append($header.$data);
}
/**
* Writes a note associated with the cell given by the row and column.
* NOTE records don't have a length limit.
*
* @param integer $row Zero indexed row
* @param integer $col Zero indexed column
* @param string $note The note to write
*/
private function _writeNote($row, $col, $note)
{
$note_length = strlen($note);
$record = 0x001C; // Record identifier
$max_length = 2048; // Maximun length for a NOTE record
// Length for this record is no more than 2048 + 6
$length = 0x0006 + min($note_length, 2048);
$header = pack("vv", $record, $length);
$data = pack("vvv", $row, $col, $note_length);
$this->_append($header . $data . substr($note, 0, 2048));
for ($i = $max_length; $i < $note_length; $i += $max_length) {
$chunk = substr($note, $i, $max_length);
$length = 0x0006 + strlen($chunk);
$header = pack("vv", $record, $length);
$data = pack("vvv", -1, 0, strlen($chunk));
$this->_append($header.$data.$chunk);
}
return(0);
}
/**
* Write a blank cell to the specified row and column (zero indexed).
* A blank cell is used to specify formatting without adding a string
* or a number.
*
* A blank cell without a format serves no purpose. Therefore, we don't write
* a BLANK record unless a format is specified.
*
* Returns 0 : normal termination (including no format)
* -1 : insufficient number of arguments
* -2 : row or column out of range
*
* @param integer $row Zero indexed row
* @param integer $col Zero indexed column
* @param mixed $xfIndex The XF format index
*/
function _writeBlank($row, $col, $xfIndex)
{
$record = 0x0201; // Record identifier
$length = 0x0006; // Number of bytes to follow
$header = pack("vv", $record, $length);
$data = pack("vvv", $row, $col, $xfIndex);
$this->_append($header . $data);
return 0;
}
/**
* Write a boolean or an error type to the specified row and column (zero indexed)
*
* @param int $row Row index (0-based)
* @param int $col Column index (0-based)
* @param int $value
* @param boolean $isError Error or Boolean?
* @param int $xfIndex
*/
private function _writeBoolErr($row, $col, $value, $isError, $xfIndex)
{
$record = 0x0205;
$length = 8;
$header = pack("vv", $record, $length);
$data = pack("vvvCC", $row, $col, $xfIndex, $value, $isError);
$this->_append($header . $data);
return 0;
}
/**
* Write a formula to the specified row and column (zero indexed).
* The textual representation of the formula is passed to the parser in
* Parser.php which returns a packed binary string.
*
* Returns 0 : normal termination
* -1 : formula errors (bad formula)
* -2 : row or column out of range
*
* @param integer $row Zero indexed row
* @param integer $col Zero indexed column
* @param string $formula The formula text string
* @param mixed $xfIndex The XF format index
* @param mixed $calculatedValue Calculated value
* @return integer
*/
private function _writeFormula($row, $col, $formula, $xfIndex, $calculatedValue)
{
$record = 0x0006; // Record identifier
// Initialize possible additional value for STRING record that should be written after the FORMULA record?
$stringValue = null;
// calculated value
if (isset($calculatedValue)) {
// Since we can't yet get the data type of the calculated value,
// we use best effort to determine data type
if (is_bool($calculatedValue)) {
// Boolean value
$num = pack('CCCvCv', 0x01, 0x00, (int)$calculatedValue, 0x00, 0x00, 0xFFFF);
} elseif (is_int($calculatedValue) || is_float($calculatedValue)) {
// Numeric value
$num = pack('d', $calculatedValue);
} elseif (is_string($calculatedValue)) {
if (array_key_exists($calculatedValue, PHPExcel_Cell_DataType::getErrorCodes())) {
// Error value
$num = pack('CCCvCv', 0x02, 0x00, self::_mapErrorCode($calculatedValue), 0x00, 0x00, 0xFFFF);
} elseif ($calculatedValue === '') {
// Empty string (and BIFF8)
$num = pack('CCCvCv', 0x03, 0x00, 0x00, 0x00, 0x00, 0xFFFF);
} else {
// Non-empty string value (or empty string BIFF5)
$stringValue = $calculatedValue;
$num = pack('CCCvCv', 0x00, 0x00, 0x00, 0x00, 0x00, 0xFFFF);
}
} else {
// We are really not supposed to reach here
$num = pack('d', 0x00);
}
} else {
$num = pack('d', 0x00);
}
$grbit = 0x03; // Option flags
$unknown = 0x0000; // Must be zero
// Strip the '=' or '@' sign at the beginning of the formula string
if ($formula{0} == '=') {
$formula = substr($formula,1);
} else {
// Error handling
$this->_writeString($row, $col, 'Unrecognised character for formula');
return -1;
}
// Parse the formula using the parser in Parser.php
try {
$error = $this->_parser->parse($formula);
$formula = $this->_parser->toReversePolish();
$formlen = strlen($formula); // Length of the binary string
$length = 0x16 + $formlen; // Length of the record data
$header = pack("vv", $record, $length);
$data = pack("vvv", $row, $col, $xfIndex)
. $num
. pack("vVv", $grbit, $unknown, $formlen);
$this->_append($header . $data . $formula);
// Append also a STRING record if necessary
if ($stringValue !== null) {
$this->_writeStringRecord($stringValue);
}
return 0;
} catch (PHPExcel_Exception $e) {
// do nothing
}
}
/**
* Write a STRING record. This
*
* @param string $stringValue
*/
private function _writeStringRecord($stringValue)
{
$record = 0x0207; // Record identifier
$data = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($stringValue);
$length = strlen($data);
$header = pack('vv', $record, $length);
$this->_append($header . $data);
}
/**
* Write a hyperlink.
* This is comprised of two elements: the visible label and
* the invisible link. The visible label is the same as the link unless an
* alternative string is specified. The label is written using the
* _writeString() method. Therefore the 255 characters string limit applies.
* $string and $format are optional.
*
* The hyperlink can be to a http, ftp, mail, internal sheet (not yet), or external
* directory url.
*
* Returns 0 : normal termination
* -2 : row or column out of range
* -3 : long string truncated to 255 chars
*
* @param integer $row Row
* @param integer $col Column
* @param string $url URL string
* @return integer
*/
private function _writeUrl($row, $col, $url)
{
// Add start row and col to arg list
return($this->_writeUrlRange($row, $col, $row, $col, $url));
}
/**
* This is the more general form of _writeUrl(). It allows a hyperlink to be
* written to a range of cells. This function also decides the type of hyperlink
* to be written. These are either, Web (http, ftp, mailto), Internal
* (Sheet1!A1) or external ('c:\temp\foo.xls#Sheet1!A1').
*
* @access private
* @see _writeUrl()
* @param integer $row1 Start row
* @param integer $col1 Start column
* @param integer $row2 End row
* @param integer $col2 End column
* @param string $url URL string
* @return integer
*/
function _writeUrlRange($row1, $col1, $row2, $col2, $url)
{
// Check for internal/external sheet links or default to web link
if (preg_match('[^internal:]', $url)) {
return($this->_writeUrlInternal($row1, $col1, $row2, $col2, $url));
}
if (preg_match('[^external:]', $url)) {
return($this->_writeUrlExternal($row1, $col1, $row2, $col2, $url));
}
return($this->_writeUrlWeb($row1, $col1, $row2, $col2, $url));
}
/**
* Used to write http, ftp and mailto hyperlinks.
* The link type ($options) is 0x03 is the same as absolute dir ref without
* sheet. However it is differentiated by the $unknown2 data stream.
*
* @access private
* @see _writeUrl()
* @param integer $row1 Start row
* @param integer $col1 Start column
* @param integer $row2 End row
* @param integer $col2 End column
* @param string $url URL string
* @return integer
*/
function _writeUrlWeb($row1, $col1, $row2, $col2, $url)
{
$record = 0x01B8; // Record identifier
$length = 0x00000; // Bytes to follow
// Pack the undocumented parts of the hyperlink stream
$unknown1 = pack("H*", "D0C9EA79F9BACE118C8200AA004BA90B02000000");
$unknown2 = pack("H*", "E0C9EA79F9BACE118C8200AA004BA90B");
// Pack the option flags
$options = pack("V", 0x03);
// Convert URL to a null terminated wchar string
$url = join("\0", preg_split("''", $url, -1, PREG_SPLIT_NO_EMPTY));
$url = $url . "\0\0\0";
// Pack the length of the URL
$url_len = pack("V", strlen($url));
// Calculate the data length
$length = 0x34 + strlen($url);
// Pack the header data
$header = pack("vv", $record, $length);
$data = pack("vvvv", $row1, $row2, $col1, $col2);
// Write the packed data
$this->_append($header . $data .
$unknown1 . $options .
$unknown2 . $url_len . $url);
return 0;
}
/**
* Used to write internal reference hyperlinks such as "Sheet1!A1".
*
* @access private
* @see _writeUrl()
* @param integer $row1 Start row
* @param integer $col1 Start column
* @param integer $row2 End row
* @param integer $col2 End column
* @param string $url URL string
* @return integer
*/
function _writeUrlInternal($row1, $col1, $row2, $col2, $url)
{
$record = 0x01B8; // Record identifier
$length = 0x00000; // Bytes to follow
// Strip URL type
$url = preg_replace('/^internal:/', '', $url);
// Pack the undocumented parts of the hyperlink stream
$unknown1 = pack("H*", "D0C9EA79F9BACE118C8200AA004BA90B02000000");
// Pack the option flags
$options = pack("V", 0x08);
// Convert the URL type and to a null terminated wchar string
$url .= "\0";
// character count
$url_len = PHPExcel_Shared_String::CountCharacters($url);
$url_len = pack('V', $url_len);
$url = PHPExcel_Shared_String::ConvertEncoding($url, 'UTF-16LE', 'UTF-8');
// Calculate the data length
$length = 0x24 + strlen($url);
// Pack the header data
$header = pack("vv", $record, $length);
$data = pack("vvvv", $row1, $row2, $col1, $col2);
// Write the packed data
$this->_append($header . $data .
$unknown1 . $options .
$url_len . $url);
return 0;
}
/**
* Write links to external directory names such as 'c:\foo.xls',
* c:\foo.xls#Sheet1!A1', '../../foo.xls'. and '../../foo.xls#Sheet1!A1'.
*
* Note: Excel writes some relative links with the $dir_long string. We ignore
* these cases for the sake of simpler code.
*
* @access private
* @see _writeUrl()
* @param integer $row1 Start row
* @param integer $col1 Start column
* @param integer $row2 End row
* @param integer $col2 End column
* @param string $url URL string
* @return integer
*/
function _writeUrlExternal($row1, $col1, $row2, $col2, $url)
{
// Network drives are different. We will handle them separately
// MS/Novell network drives and shares start with \\
if (preg_match('[^external:\\\\]', $url)) {
return; //($this->_writeUrlExternal_net($row1, $col1, $row2, $col2, $url, $str, $format));
}
$record = 0x01B8; // Record identifier
$length = 0x00000; // Bytes to follow
// Strip URL type and change Unix dir separator to Dos style (if needed)
//
$url = preg_replace('/^external:/', '', $url);
$url = preg_replace('/\//', "\\", $url);
// Determine if the link is relative or absolute:
// relative if link contains no dir separator, "somefile.xls"
// relative if link starts with up-dir, "..\..\somefile.xls"
// otherwise, absolute
$absolute = 0x00; // relative path
if ( preg_match('/^[A-Z]:/', $url) ) {
$absolute = 0x02; // absolute path on Windows, e.g. C:\...
}
$link_type = 0x01 | $absolute;
// Determine if the link contains a sheet reference and change some of the
// parameters accordingly.
// Split the dir name and sheet name (if it exists)
$dir_long = $url;
if (preg_match("/\#/", $url)) {
$link_type |= 0x08;
}
// Pack the link type
$link_type = pack("V", $link_type);
// Calculate the up-level dir count e.g.. (..\..\..\ == 3)
$up_count = preg_match_all("/\.\.\\\/", $dir_long, $useless);
$up_count = pack("v", $up_count);
// Store the short dos dir name (null terminated)
$dir_short = preg_replace("/\.\.\\\/", '', $dir_long) . "\0";
// Store the long dir name as a wchar string (non-null terminated)
$dir_long = $dir_long . "\0";
// Pack the lengths of the dir strings
$dir_short_len = pack("V", strlen($dir_short) );
$dir_long_len = pack("V", strlen($dir_long) );
$stream_len = pack("V", 0);//strlen($dir_long) + 0x06);
// Pack the undocumented parts of the hyperlink stream
$unknown1 = pack("H*",'D0C9EA79F9BACE118C8200AA004BA90B02000000' );
$unknown2 = pack("H*",'0303000000000000C000000000000046' );
$unknown3 = pack("H*",'FFFFADDE000000000000000000000000000000000000000');
$unknown4 = pack("v", 0x03 );
// Pack the main data stream
$data = pack("vvvv", $row1, $row2, $col1, $col2) .
$unknown1 .
$link_type .
$unknown2 .
$up_count .
$dir_short_len.
$dir_short .
$unknown3 .
$stream_len ;/*.
$dir_long_len .
$unknown4 .
$dir_long .
$sheet_len .
$sheet ;*/
// Pack the header data
$length = strlen($data);
$header = pack("vv", $record, $length);
// Write the packed data
$this->_append($header. $data);
return 0;
}
/**
* This method is used to set the height and format for a row.
*
* @param integer $row The row to set
* @param integer $height Height we are giving to the row.
* Use null to set XF without setting height
* @param integer $xfIndex The optional cell style Xf index to apply to the columns
* @param bool $hidden The optional hidden attribute
* @param integer $level The optional outline level for row, in range [0,7]
*/
private function _writeRow($row, $height, $xfIndex, $hidden = false, $level = 0)
{
$record = 0x0208; // Record identifier
$length = 0x0010; // Number of bytes to follow
$colMic = 0x0000; // First defined column
$colMac = 0x0000; // Last defined column
$irwMac = 0x0000; // Used by Excel to optimise loading
$reserved = 0x0000; // Reserved
$grbit = 0x0000; // Option flags
$ixfe = $xfIndex;
if ( $height < 0 ){
$height = null;
}
// Use _writeRow($row, null, $XF) to set XF format without setting height
if ($height != null) {
$miyRw = $height * 20; // row height
} else {
$miyRw = 0xff; // default row height is 256
}
// Set the options flags. fUnsynced is used to show that the font and row
// heights are not compatible. This is usually the case for WriteExcel.
// The collapsed flag 0x10 doesn't seem to be used to indicate that a row
// is collapsed. Instead it is used to indicate that the previous row is
// collapsed. The zero height flag, 0x20, is used to collapse a row.
$grbit |= $level;
if ($hidden) {
$grbit |= 0x0020;
}
if ($height !== null) {
$grbit |= 0x0040; // fUnsynced
}
if ($xfIndex !== 0xF) {
$grbit |= 0x0080;
}
$grbit |= 0x0100;
$header = pack("vv", $record, $length);
$data = pack("vvvvvvvv", $row, $colMic, $colMac, $miyRw,
$irwMac,$reserved, $grbit, $ixfe);
$this->_append($header.$data);
}
/**
* Writes Excel DIMENSIONS to define the area in which there is data.
*/
private function _writeDimensions()
{
$record = 0x0200; // Record identifier
$length = 0x000E;
$data = pack('VVvvv'
, $this->_firstRowIndex
, $this->_lastRowIndex + 1
, $this->_firstColumnIndex
, $this->_lastColumnIndex + 1
, 0x0000 // reserved
);
$header = pack("vv", $record, $length);
$this->_append($header.$data);
}
/**
* Write BIFF record Window2.
*/
private function _writeWindow2()
{
$record = 0x023E; // Record identifier
$length = 0x0012;
$grbit = 0x00B6; // Option flags
$rwTop = 0x0000; // Top row visible in window
$colLeft = 0x0000; // Leftmost column visible in window
// The options flags that comprise $grbit
$fDspFmla = 0; // 0 - bit
$fDspGrid = $this->_phpSheet->getShowGridlines() ? 1 : 0; // 1
$fDspRwCol = $this->_phpSheet->getShowRowColHeaders() ? 1 : 0; // 2
$fFrozen = $this->_phpSheet->getFreezePane() ? 1 : 0; // 3
$fDspZeros = 1; // 4
$fDefaultHdr = 1; // 5
$fArabic = $this->_phpSheet->getRightToLeft() ? 1 : 0; // 6
$fDspGuts = $this->_outline_on; // 7
$fFrozenNoSplit = 0; // 0 - bit
// no support in PHPExcel for selected sheet, therefore sheet is only selected if it is the active sheet
$fSelected = ($this->_phpSheet === $this->_phpSheet->getParent()->getActiveSheet()) ? 1 : 0;
$fPaged = 1; // 2
$fPageBreakPreview = $this->_phpSheet->getSheetView()->getView() === PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_BREAK_PREVIEW;
$grbit = $fDspFmla;
$grbit |= $fDspGrid << 1;
$grbit |= $fDspRwCol << 2;
$grbit |= $fFrozen << 3;
$grbit |= $fDspZeros << 4;
$grbit |= $fDefaultHdr << 5;
$grbit |= $fArabic << 6;
$grbit |= $fDspGuts << 7;
$grbit |= $fFrozenNoSplit << 8;
$grbit |= $fSelected << 9;
$grbit |= $fPaged << 10;
$grbit |= $fPageBreakPreview << 11;
$header = pack("vv", $record, $length);
$data = pack("vvv", $grbit, $rwTop, $colLeft);
// FIXME !!!
$rgbHdr = 0x0040; // Row/column heading and gridline color index
$zoom_factor_page_break = ($fPageBreakPreview? $this->_phpSheet->getSheetView()->getZoomScale() : 0x0000);
$zoom_factor_normal = $this->_phpSheet->getSheetView()->getZoomScaleNormal();
$data .= pack("vvvvV", $rgbHdr, 0x0000, $zoom_factor_page_break, $zoom_factor_normal, 0x00000000);
$this->_append($header.$data);
}
/**
* Write BIFF record DEFAULTROWHEIGHT.
*/
private function _writeDefaultRowHeight()
{
$defaultRowHeight = $this->_phpSheet->getDefaultRowDimension()->getRowHeight();
if ($defaultRowHeight < 0) {
return;
}
// convert to twips
$defaultRowHeight = (int) 20 * $defaultRowHeight;
$record = 0x0225; // Record identifier
$length = 0x0004; // Number of bytes to follow
$header = pack("vv", $record, $length);
$data = pack("vv", 1, $defaultRowHeight);
$this->_append($header . $data);
}
/**
* Write BIFF record DEFCOLWIDTH if COLINFO records are in use.
*/
private function _writeDefcol()
{
$defaultColWidth = 8;
$record = 0x0055; // Record identifier
$length = 0x0002; // Number of bytes to follow
$header = pack("vv", $record, $length);
$data = pack("v", $defaultColWidth);
$this->_append($header . $data);
}
/**
* Write BIFF record COLINFO to define column widths
*
* Note: The SDK says the record length is 0x0B but Excel writes a 0x0C
* length record.
*
* @param array $col_array This is the only parameter received and is composed of the following:
* 0 => First formatted column,
* 1 => Last formatted column,
* 2 => Col width (8.43 is Excel default),
* 3 => The optional XF format of the column,
* 4 => Option flags.
* 5 => Optional outline level
*/
private function _writeColinfo($col_array)
{
if (isset($col_array[0])) {
$colFirst = $col_array[0];
}
if (isset($col_array[1])) {
$colLast = $col_array[1];
}
if (isset($col_array[2])) {
$coldx = $col_array[2];
} else {
$coldx = 8.43;
}
if (isset($col_array[3])) {
$xfIndex = $col_array[3];
} else {
$xfIndex = 15;
}
if (isset($col_array[4])) {
$grbit = $col_array[4];
} else {
$grbit = 0;
}
if (isset($col_array[5])) {
$level = $col_array[5];
} else {
$level = 0;
}
$record = 0x007D; // Record identifier
$length = 0x000C; // Number of bytes to follow
$coldx *= 256; // Convert to units of 1/256 of a char
$ixfe = $xfIndex;
$reserved = 0x0000; // Reserved
$level = max(0, min($level, 7));
$grbit |= $level << 8;
$header = pack("vv", $record, $length);
$data = pack("vvvvvv", $colFirst, $colLast, $coldx,
$ixfe, $grbit, $reserved);
$this->_append($header.$data);
}
/**
* Write BIFF record SELECTION.
*/
private function _writeSelection()
{
// look up the selected cell range
$selectedCells = $this->_phpSheet->getSelectedCells();
$selectedCells = PHPExcel_Cell::splitRange($this->_phpSheet->getSelectedCells());
$selectedCells = $selectedCells[0];
if (count($selectedCells) == 2) {
list($first, $last) = $selectedCells;
} else {
$first = $selectedCells[0];
$last = $selectedCells[0];
}
list($colFirst, $rwFirst) = PHPExcel_Cell::coordinateFromString($first);
$colFirst = PHPExcel_Cell::columnIndexFromString($colFirst) - 1; // base 0 column index
--$rwFirst; // base 0 row index
list($colLast, $rwLast) = PHPExcel_Cell::coordinateFromString($last);
$colLast = PHPExcel_Cell::columnIndexFromString($colLast) - 1; // base 0 column index
--$rwLast; // base 0 row index
// make sure we are not out of bounds
$colFirst = min($colFirst, 255);
$colLast = min($colLast, 255);
$rwFirst = min($rwFirst, 65535);
$rwLast = min($rwLast, 65535);
$record = 0x001D; // Record identifier
$length = 0x000F; // Number of bytes to follow
$pnn = $this->_active_pane; // Pane position
$rwAct = $rwFirst; // Active row
$colAct = $colFirst; // Active column
$irefAct = 0; // Active cell ref
$cref = 1; // Number of refs
if (!isset($rwLast)) {
$rwLast = $rwFirst; // Last row in reference
}
if (!isset($colLast)) {
$colLast = $colFirst; // Last col in reference
}
// Swap last row/col for first row/col as necessary
if ($rwFirst > $rwLast) {
list($rwFirst, $rwLast) = array($rwLast, $rwFirst);
}
if ($colFirst > $colLast) {
list($colFirst, $colLast) = array($colLast, $colFirst);
}
$header = pack("vv", $record, $length);
$data = pack("CvvvvvvCC", $pnn, $rwAct, $colAct,
$irefAct, $cref,
$rwFirst, $rwLast,
$colFirst, $colLast);
$this->_append($header . $data);
}
/**
* Store the MERGEDCELLS records for all ranges of merged cells
*/
private function _writeMergedCells()
{
$mergeCells = $this->_phpSheet->getMergeCells();
$countMergeCells = count($mergeCells);
if ($countMergeCells == 0) {
return;
}
// maximum allowed number of merged cells per record
$maxCountMergeCellsPerRecord = 1027;
// record identifier
$record = 0x00E5;
// counter for total number of merged cells treated so far by the writer
$i = 0;
// counter for number of merged cells written in record currently being written
$j = 0;
// initialize record data
$recordData = '';
// loop through the merged cells
foreach ($mergeCells as $mergeCell) {
++$i;
++$j;
// extract the row and column indexes
$range = PHPExcel_Cell::splitRange($mergeCell);
list($first, $last) = $range[0];
list($firstColumn, $firstRow) = PHPExcel_Cell::coordinateFromString($first);
list($lastColumn, $lastRow) = PHPExcel_Cell::coordinateFromString($last);
$recordData .= pack('vvvv', $firstRow - 1, $lastRow - 1, PHPExcel_Cell::columnIndexFromString($firstColumn) - 1, PHPExcel_Cell::columnIndexFromString($lastColumn) - 1);
// flush record if we have reached limit for number of merged cells, or reached final merged cell
if ($j == $maxCountMergeCellsPerRecord or $i == $countMergeCells) {
$recordData = pack('v', $j) . $recordData;
$length = strlen($recordData);
$header = pack('vv', $record, $length);
$this->_append($header . $recordData);
// initialize for next record, if any
$recordData = '';
$j = 0;
}
}
}
/**
* Write SHEETLAYOUT record
*/
private function _writeSheetLayout()
{
if (!$this->_phpSheet->isTabColorSet()) {
return;
}
$recordData = pack(
'vvVVVvv'
, 0x0862
, 0x0000 // unused
, 0x00000000 // unused
, 0x00000000 // unused
, 0x00000014 // size of record data
, $this->_colors[$this->_phpSheet->getTabColor()->getRGB()] // color index
, 0x0000 // unused
);
$length = strlen($recordData);
$record = 0x0862; // Record identifier
$header = pack('vv', $record, $length);
$this->_append($header . $recordData);
}
/**
* Write SHEETPROTECTION
*/
private function _writeSheetProtection()
{
// record identifier
$record = 0x0867;
// prepare options
$options = (int) !$this->_phpSheet->getProtection()->getObjects()
| (int) !$this->_phpSheet->getProtection()->getScenarios() << 1
| (int) !$this->_phpSheet->getProtection()->getFormatCells() << 2
| (int) !$this->_phpSheet->getProtection()->getFormatColumns() << 3
| (int) !$this->_phpSheet->getProtection()->getFormatRows() << 4
| (int) !$this->_phpSheet->getProtection()->getInsertColumns() << 5
| (int) !$this->_phpSheet->getProtection()->getInsertRows() << 6
| (int) !$this->_phpSheet->getProtection()->getInsertHyperlinks() << 7
| (int) !$this->_phpSheet->getProtection()->getDeleteColumns() << 8
| (int) !$this->_phpSheet->getProtection()->getDeleteRows() << 9
| (int) !$this->_phpSheet->getProtection()->getSelectLockedCells() << 10
| (int) !$this->_phpSheet->getProtection()->getSort() << 11
| (int) !$this->_phpSheet->getProtection()->getAutoFilter() << 12
| (int) !$this->_phpSheet->getProtection()->getPivotTables() << 13
| (int) !$this->_phpSheet->getProtection()->getSelectUnlockedCells() << 14 ;
// record data
$recordData = pack(
'vVVCVVvv'
, 0x0867 // repeated record identifier
, 0x0000 // not used
, 0x0000 // not used
, 0x00 // not used
, 0x01000200 // unknown data
, 0xFFFFFFFF // unknown data
, $options // options
, 0x0000 // not used
);
$length = strlen($recordData);
$header = pack('vv', $record, $length);
$this->_append($header . $recordData);
}
/**
* Write BIFF record RANGEPROTECTION
*
* Openoffice.org's Documentaion of the Microsoft Excel File Format uses term RANGEPROTECTION for these records
* Microsoft Office Excel 97-2007 Binary File Format Specification uses term FEAT for these records
*/
private function _writeRangeProtection()
{
foreach ($this->_phpSheet->getProtectedCells() as $range => $password) {
// number of ranges, e.g. 'A1:B3 C20:D25'
$cellRanges = explode(' ', $range);
$cref = count($cellRanges);
$recordData = pack(
'vvVVvCVvVv',
0x0868,
0x00,
0x0000,
0x0000,
0x02,
0x0,
0x0000,
$cref,
0x0000,
0x00
);
foreach ($cellRanges as $cellRange) {
$recordData .= $this->_writeBIFF8CellRangeAddressFixed($cellRange);
}
// the rgbFeat structure
$recordData .= pack(
'VV',
0x0000,
hexdec($password)
);
$recordData .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong('p' . md5($recordData));
$length = strlen($recordData);
$record = 0x0868; // Record identifier
$header = pack("vv", $record, $length);
$this->_append($header . $recordData);
}
}
/**
* Write BIFF record EXTERNCOUNT to indicate the number of external sheet
* references in a worksheet.
*
* Excel only stores references to external sheets that are used in formulas.
* For simplicity we store references to all the sheets in the workbook
* regardless of whether they are used or not. This reduces the overall
* complexity and eliminates the need for a two way dialogue between the formula
* parser the worksheet objects.
*
* @param integer $count The number of external sheet references in this worksheet
*/
private function _writeExterncount($count)
{
$record = 0x0016; // Record identifier
$length = 0x0002; // Number of bytes to follow
$header = pack("vv", $record, $length);
$data = pack("v", $count);
$this->_append($header . $data);
}
/**
* Writes the Excel BIFF EXTERNSHEET record. These references are used by
* formulas. A formula references a sheet name via an index. Since we store a
* reference to all of the external worksheets the EXTERNSHEET index is the same
* as the worksheet index.
*
* @param string $sheetname The name of a external worksheet
*/
private function _writeExternsheet($sheetname)
{
$record = 0x0017; // Record identifier
// References to the current sheet are encoded differently to references to
// external sheets.
//
if ($this->_phpSheet->getTitle() == $sheetname) {
$sheetname = '';
$length = 0x02; // The following 2 bytes
$cch = 1; // The following byte
$rgch = 0x02; // Self reference
} else {
$length = 0x02 + strlen($sheetname);
$cch = strlen($sheetname);
$rgch = 0x03; // Reference to a sheet in the current workbook
}
$header = pack("vv", $record, $length);
$data = pack("CC", $cch, $rgch);
$this->_append($header . $data . $sheetname);
}
/**
* Writes the Excel BIFF PANE record.
* The panes can either be frozen or thawed (unfrozen).
* Frozen panes are specified in terms of an integer number of rows and columns.
* Thawed panes are specified in terms of Excel's units for rows and columns.
*/
private function _writePanes()
{
$panes = array();
if ($freezePane = $this->_phpSheet->getFreezePane()) {
list($column, $row) = PHPExcel_Cell::coordinateFromString($freezePane);
$panes[0] = $row - 1;
$panes[1] = PHPExcel_Cell::columnIndexFromString($column) - 1;
} else {
// thaw panes
return;
}
$y = isset($panes[0]) ? $panes[0] : null;
$x = isset($panes[1]) ? $panes[1] : null;
$rwTop = isset($panes[2]) ? $panes[2] : null;
$colLeft = isset($panes[3]) ? $panes[3] : null;
if (count($panes) > 4) { // if Active pane was received
$pnnAct = $panes[4];
} else {
$pnnAct = null;
}
$record = 0x0041; // Record identifier
$length = 0x000A; // Number of bytes to follow
// Code specific to frozen or thawed panes.
if ($this->_phpSheet->getFreezePane()) {
// Set default values for $rwTop and $colLeft
if (!isset($rwTop)) {
$rwTop = $y;
}
if (!isset($colLeft)) {
$colLeft = $x;
}
} else {
// Set default values for $rwTop and $colLeft
if (!isset($rwTop)) {
$rwTop = 0;
}
if (!isset($colLeft)) {
$colLeft = 0;
}
// Convert Excel's row and column units to the internal units.
// The default row height is 12.75
// The default column width is 8.43
// The following slope and intersection values were interpolated.
//
$y = 20*$y + 255;
$x = 113.879*$x + 390;
}
// Determine which pane should be active. There is also the undocumented
// option to override this should it be necessary: may be removed later.
//
if (!isset($pnnAct)) {
if ($x != 0 && $y != 0) {
$pnnAct = 0; // Bottom right
}
if ($x != 0 && $y == 0) {
$pnnAct = 1; // Top right
}
if ($x == 0 && $y != 0) {
$pnnAct = 2; // Bottom left
}
if ($x == 0 && $y == 0) {
$pnnAct = 3; // Top left
}
}
$this->_active_pane = $pnnAct; // Used in _writeSelection
$header = pack("vv", $record, $length);
$data = pack("vvvvv", $x, $y, $rwTop, $colLeft, $pnnAct);
$this->_append($header . $data);
}
/**
* Store the page setup SETUP BIFF record.
*/
private function _writeSetup()
{
$record = 0x00A1; // Record identifier
$length = 0x0022; // Number of bytes to follow
$iPaperSize = $this->_phpSheet->getPageSetup()->getPaperSize(); // Paper size
$iScale = $this->_phpSheet->getPageSetup()->getScale() ?
$this->_phpSheet->getPageSetup()->getScale() : 100; // Print scaling factor
$iPageStart = 0x01; // Starting page number
$iFitWidth = (int) $this->_phpSheet->getPageSetup()->getFitToWidth(); // Fit to number of pages wide
$iFitHeight = (int) $this->_phpSheet->getPageSetup()->getFitToHeight(); // Fit to number of pages high
$grbit = 0x00; // Option flags
$iRes = 0x0258; // Print resolution
$iVRes = 0x0258; // Vertical print resolution
$numHdr = $this->_phpSheet->getPageMargins()->getHeader(); // Header Margin
$numFtr = $this->_phpSheet->getPageMargins()->getFooter(); // Footer Margin
$iCopies = 0x01; // Number of copies
$fLeftToRight = 0x0; // Print over then down
// Page orientation
$fLandscape = ($this->_phpSheet->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ?
0x0 : 0x1;
$fNoPls = 0x0; // Setup not read from printer
$fNoColor = 0x0; // Print black and white
$fDraft = 0x0; // Print draft quality
$fNotes = 0x0; // Print notes
$fNoOrient = 0x0; // Orientation not set
$fUsePage = 0x0; // Use custom starting page
$grbit = $fLeftToRight;
$grbit |= $fLandscape << 1;
$grbit |= $fNoPls << 2;
$grbit |= $fNoColor << 3;
$grbit |= $fDraft << 4;
$grbit |= $fNotes << 5;
$grbit |= $fNoOrient << 6;
$grbit |= $fUsePage << 7;
$numHdr = pack("d", $numHdr);
$numFtr = pack("d", $numFtr);
if (self::getByteOrder()) { // if it's Big Endian
$numHdr = strrev($numHdr);
$numFtr = strrev($numFtr);
}
$header = pack("vv", $record, $length);
$data1 = pack("vvvvvvvv", $iPaperSize,
$iScale,
$iPageStart,
$iFitWidth,
$iFitHeight,
$grbit,
$iRes,
$iVRes);
$data2 = $numHdr.$numFtr;
$data3 = pack("v", $iCopies);
$this->_append($header . $data1 . $data2 . $data3);
}
/**
* Store the header caption BIFF record.
*/
private function _writeHeader()
{
$record = 0x0014; // Record identifier
/* removing for now
// need to fix character count (multibyte!)
if (strlen($this->_phpSheet->getHeaderFooter()->getOddHeader()) <= 255) {
$str = $this->_phpSheet->getHeaderFooter()->getOddHeader(); // header string
} else {
$str = '';
}
*/
$recordData = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($this->_phpSheet->getHeaderFooter()->getOddHeader());
$length = strlen($recordData);
$header = pack("vv", $record, $length);
$this->_append($header . $recordData);
}
/**
* Store the footer caption BIFF record.
*/
private function _writeFooter()
{
$record = 0x0015; // Record identifier
/* removing for now
// need to fix character count (multibyte!)
if (strlen($this->_phpSheet->getHeaderFooter()->getOddFooter()) <= 255) {
$str = $this->_phpSheet->getHeaderFooter()->getOddFooter();
} else {
$str = '';
}
*/
$recordData = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($this->_phpSheet->getHeaderFooter()->getOddFooter());
$length = strlen($recordData);
$header = pack("vv", $record, $length);
$this->_append($header . $recordData);
}
/**
* Store the horizontal centering HCENTER BIFF record.
*
* @access private
*/
private function _writeHcenter()
{
$record = 0x0083; // Record identifier
$length = 0x0002; // Bytes to follow
$fHCenter = $this->_phpSheet->getPageSetup()->getHorizontalCentered() ? 1 : 0; // Horizontal centering
$header = pack("vv", $record, $length);
$data = pack("v", $fHCenter);
$this->_append($header.$data);
}
/**
* Store the vertical centering VCENTER BIFF record.
*/
private function _writeVcenter()
{
$record = 0x0084; // Record identifier
$length = 0x0002; // Bytes to follow
$fVCenter = $this->_phpSheet->getPageSetup()->getVerticalCentered() ? 1 : 0; // Horizontal centering
$header = pack("vv", $record, $length);
$data = pack("v", $fVCenter);
$this->_append($header . $data);
}
/**
* Store the LEFTMARGIN BIFF record.
*/
private function _writeMarginLeft()
{
$record = 0x0026; // Record identifier
$length = 0x0008; // Bytes to follow
$margin = $this->_phpSheet->getPageMargins()->getLeft(); // Margin in inches
$header = pack("vv", $record, $length);
$data = pack("d", $margin);
if (self::getByteOrder()) { // if it's Big Endian
$data = strrev($data);
}
$this->_append($header . $data);
}
/**
* Store the RIGHTMARGIN BIFF record.
*/
private function _writeMarginRight()
{
$record = 0x0027; // Record identifier
$length = 0x0008; // Bytes to follow
$margin = $this->_phpSheet->getPageMargins()->getRight(); // Margin in inches
$header = pack("vv", $record, $length);
$data = pack("d", $margin);
if (self::getByteOrder()) { // if it's Big Endian
$data = strrev($data);
}
$this->_append($header . $data);
}
/**
* Store the TOPMARGIN BIFF record.
*/
private function _writeMarginTop()
{
$record = 0x0028; // Record identifier
$length = 0x0008; // Bytes to follow
$margin = $this->_phpSheet->getPageMargins()->getTop(); // Margin in inches
$header = pack("vv", $record, $length);
$data = pack("d", $margin);
if (self::getByteOrder()) { // if it's Big Endian
$data = strrev($data);
}
$this->_append($header . $data);
}
/**
* Store the BOTTOMMARGIN BIFF record.
*/
private function _writeMarginBottom()
{
$record = 0x0029; // Record identifier
$length = 0x0008; // Bytes to follow
$margin = $this->_phpSheet->getPageMargins()->getBottom(); // Margin in inches
$header = pack("vv", $record, $length);
$data = pack("d", $margin);
if (self::getByteOrder()) { // if it's Big Endian
$data = strrev($data);
}
$this->_append($header . $data);
}
/**
* Write the PRINTHEADERS BIFF record.
*/
private function _writePrintHeaders()
{
$record = 0x002a; // Record identifier
$length = 0x0002; // Bytes to follow
$fPrintRwCol = $this->_print_headers; // Boolean flag
$header = pack("vv", $record, $length);
$data = pack("v", $fPrintRwCol);
$this->_append($header . $data);
}
/**
* Write the PRINTGRIDLINES BIFF record. Must be used in conjunction with the
* GRIDSET record.
*/
private function _writePrintGridlines()
{
$record = 0x002b; // Record identifier
$length = 0x0002; // Bytes to follow
$fPrintGrid = $this->_phpSheet->getPrintGridlines() ? 1 : 0; // Boolean flag
$header = pack("vv", $record, $length);
$data = pack("v", $fPrintGrid);
$this->_append($header . $data);
}
/**
* Write the GRIDSET BIFF record. Must be used in conjunction with the
* PRINTGRIDLINES record.
*/
private function _writeGridset()
{
$record = 0x0082; // Record identifier
$length = 0x0002; // Bytes to follow
$fGridSet = !$this->_phpSheet->getPrintGridlines(); // Boolean flag
$header = pack("vv", $record, $length);
$data = pack("v", $fGridSet);
$this->_append($header . $data);
}
/**
* Write the AUTOFILTERINFO BIFF record. This is used to configure the number of autofilter select used in the sheet.
*/
private function _writeAutoFilterInfo(){
$record = 0x009D; // Record identifier
$length = 0x0002; // Bytes to follow
$rangeBounds = PHPExcel_Cell::rangeBoundaries($this->_phpSheet->getAutoFilter()->getRange());
$iNumFilters = 1 + $rangeBounds[1][0] - $rangeBounds[0][0];
$header = pack("vv", $record, $length);
$data = pack("v", $iNumFilters);
$this->_append($header . $data);
}
/**
* Write the GUTS BIFF record. This is used to configure the gutter margins
* where Excel outline symbols are displayed. The visibility of the gutters is
* controlled by a flag in WSBOOL.
*
* @see _writeWsbool()
*/
private function _writeGuts()
{
$record = 0x0080; // Record identifier
$length = 0x0008; // Bytes to follow
$dxRwGut = 0x0000; // Size of row gutter
$dxColGut = 0x0000; // Size of col gutter
// determine maximum row outline level
$maxRowOutlineLevel = 0;
foreach ($this->_phpSheet->getRowDimensions() as $rowDimension) {
$maxRowOutlineLevel = max($maxRowOutlineLevel, $rowDimension->getOutlineLevel());
}
$col_level = 0;
// Calculate the maximum column outline level. The equivalent calculation
// for the row outline level is carried out in _writeRow().
$colcount = count($this->_colinfo);
for ($i = 0; $i < $colcount; ++$i) {
$col_level = max($this->_colinfo[$i][5], $col_level);
}
// Set the limits for the outline levels (0 <= x <= 7).
$col_level = max(0, min($col_level, 7));
// The displayed level is one greater than the max outline levels
if ($maxRowOutlineLevel) {
++$maxRowOutlineLevel;
}
if ($col_level) {
++$col_level;
}
$header = pack("vv", $record, $length);
$data = pack("vvvv", $dxRwGut, $dxColGut, $maxRowOutlineLevel, $col_level);
$this->_append($header.$data);
}
/**
* Write the WSBOOL BIFF record, mainly for fit-to-page. Used in conjunction
* with the SETUP record.
*/
private function _writeWsbool()
{
$record = 0x0081; // Record identifier
$length = 0x0002; // Bytes to follow
$grbit = 0x0000;
// The only option that is of interest is the flag for fit to page. So we
// set all the options in one go.
//
// Set the option flags
$grbit |= 0x0001; // Auto page breaks visible
if ($this->_outline_style) {
$grbit |= 0x0020; // Auto outline styles
}
if ($this->_phpSheet->getShowSummaryBelow()) {
$grbit |= 0x0040; // Outline summary below
}
if ($this->_phpSheet->getShowSummaryRight()) {
$grbit |= 0x0080; // Outline summary right
}
if ($this->_phpSheet->getPageSetup()->getFitToPage()) {
$grbit |= 0x0100; // Page setup fit to page
}
if ($this->_outline_on) {
$grbit |= 0x0400; // Outline symbols displayed
}
$header = pack("vv", $record, $length);
$data = pack("v", $grbit);
$this->_append($header . $data);
}
/**
* Write the HORIZONTALPAGEBREAKS and VERTICALPAGEBREAKS BIFF records.
*/
private function _writeBreaks()
{
// initialize
$vbreaks = array();
$hbreaks = array();
foreach ($this->_phpSheet->getBreaks() as $cell => $breakType) {
// Fetch coordinates
$coordinates = PHPExcel_Cell::coordinateFromString($cell);
// Decide what to do by the type of break
switch ($breakType) {
case PHPExcel_Worksheet::BREAK_COLUMN:
// Add to list of vertical breaks
$vbreaks[] = PHPExcel_Cell::columnIndexFromString($coordinates[0]) - 1;
break;
case PHPExcel_Worksheet::BREAK_ROW:
// Add to list of horizontal breaks
$hbreaks[] = $coordinates[1];
break;
case PHPExcel_Worksheet::BREAK_NONE:
default:
// Nothing to do
break;
}
}
//horizontal page breaks
if (!empty($hbreaks)) {
// Sort and filter array of page breaks
sort($hbreaks, SORT_NUMERIC);
if ($hbreaks[0] == 0) { // don't use first break if it's 0
array_shift($hbreaks);
}
$record = 0x001b; // Record identifier
$cbrk = count($hbreaks); // Number of page breaks
$length = 2 + 6 * $cbrk; // Bytes to follow
$header = pack("vv", $record, $length);
$data = pack("v", $cbrk);
// Append each page break
foreach ($hbreaks as $hbreak) {
$data .= pack("vvv", $hbreak, 0x0000, 0x00ff);
}
$this->_append($header . $data);
}
// vertical page breaks
if (!empty($vbreaks)) {
// 1000 vertical pagebreaks appears to be an internal Excel 5 limit.
// It is slightly higher in Excel 97/200, approx. 1026
$vbreaks = array_slice($vbreaks, 0, 1000);
// Sort and filter array of page breaks
sort($vbreaks, SORT_NUMERIC);
if ($vbreaks[0] == 0) { // don't use first break if it's 0
array_shift($vbreaks);
}
$record = 0x001a; // Record identifier
$cbrk = count($vbreaks); // Number of page breaks
$length = 2 + 6 * $cbrk; // Bytes to follow
$header = pack("vv", $record, $length);
$data = pack("v", $cbrk);
// Append each page break
foreach ($vbreaks as $vbreak) {
$data .= pack("vvv", $vbreak, 0x0000, 0xffff);
}
$this->_append($header . $data);
}
}
/**
* Set the Biff PROTECT record to indicate that the worksheet is protected.
*/
private function _writeProtect()
{
// Exit unless sheet protection has been specified
if (!$this->_phpSheet->getProtection()->getSheet()) {
return;
}
$record = 0x0012; // Record identifier
$length = 0x0002; // Bytes to follow
$fLock = 1; // Worksheet is protected
$header = pack("vv", $record, $length);
$data = pack("v", $fLock);
$this->_append($header.$data);
}
/**
* Write SCENPROTECT
*/
private function _writeScenProtect()
{
// Exit if sheet protection is not active
if (!$this->_phpSheet->getProtection()->getSheet()) {
return;
}
// Exit if scenarios are not protected
if (!$this->_phpSheet->getProtection()->getScenarios()) {
return;
}
$record = 0x00DD; // Record identifier
$length = 0x0002; // Bytes to follow
$header = pack('vv', $record, $length);
$data = pack('v', 1);
$this->_append($header . $data);
}
/**
* Write OBJECTPROTECT
*/
private function _writeObjectProtect()
{
// Exit if sheet protection is not active
if (!$this->_phpSheet->getProtection()->getSheet()) {
return;
}
// Exit if objects are not protected
if (!$this->_phpSheet->getProtection()->getObjects()) {
return;
}
$record = 0x0063; // Record identifier
$length = 0x0002; // Bytes to follow
$header = pack('vv', $record, $length);
$data = pack('v', 1);
$this->_append($header . $data);
}
/**
* Write the worksheet PASSWORD record.
*/
private function _writePassword()
{
// Exit unless sheet protection and password have been specified
if (!$this->_phpSheet->getProtection()->getSheet() || !$this->_phpSheet->getProtection()->getPassword()) {
return;
}
$record = 0x0013; // Record identifier
$length = 0x0002; // Bytes to follow
$wPassword = hexdec($this->_phpSheet->getProtection()->getPassword()); // Encoded password
$header = pack("vv", $record, $length);
$data = pack("v", $wPassword);
$this->_append($header . $data);
}
/**
* Insert a 24bit bitmap image in a worksheet.
*
* @access public
* @param integer $row The row we are going to insert the bitmap into
* @param integer $col The column we are going to insert the bitmap into
* @param mixed $bitmap The bitmap filename or GD-image resource
* @param integer $x The horizontal position (offset) of the image inside the cell.
* @param integer $y The vertical position (offset) of the image inside the cell.
* @param float $scale_x The horizontal scale
* @param float $scale_y The vertical scale
*/
function insertBitmap($row, $col, $bitmap, $x = 0, $y = 0, $scale_x = 1, $scale_y = 1)
{
$bitmap_array = (is_resource($bitmap) ? $this->_processBitmapGd($bitmap) : $this->_processBitmap($bitmap));
list($width, $height, $size, $data) = $bitmap_array; //$this->_processBitmap($bitmap);
// Scale the frame of the image.
$width *= $scale_x;
$height *= $scale_y;
// Calculate the vertices of the image and write the OBJ record
$this->_positionImage($col, $row, $x, $y, $width, $height);
// Write the IMDATA record to store the bitmap data
$record = 0x007f;
$length = 8 + $size;
$cf = 0x09;
$env = 0x01;
$lcb = $size;
$header = pack("vvvvV", $record, $length, $cf, $env, $lcb);
$this->_append($header.$data);
}
/**
* Calculate the vertices that define the position of the image as required by
* the OBJ record.
*
* +------------+------------+
* | A | B |
* +-----+------------+------------+
* | |(x1,y1) | |
* | 1 |(A1)._______|______ |
* | | | | |
* | | | | |
* +-----+----| BITMAP |-----+
* | | | | |
* | 2 | |______________. |
* | | | (B2)|
* | | | (x2,y2)|
* +---- +------------+------------+
*
* Example of a bitmap that covers some of the area from cell A1 to cell B2.
*
* Based on the width and height of the bitmap we need to calculate 8 vars:
* $col_start, $row_start, $col_end, $row_end, $x1, $y1, $x2, $y2.
* The width and height of the cells are also variable and have to be taken into
* account.
* The values of $col_start and $row_start are passed in from the calling
* function. The values of $col_end and $row_end are calculated by subtracting
* the width and height of the bitmap from the width and height of the
* underlying cells.
* The vertices are expressed as a percentage of the underlying cell width as
* follows (rhs values are in pixels):
*
* x1 = X / W *1024
* y1 = Y / H *256
* x2 = (X-1) / W *1024
* y2 = (Y-1) / H *256
*
* Where: X is distance from the left side of the underlying cell
* Y is distance from the top of the underlying cell
* W is the width of the cell
* H is the height of the cell
* The SDK incorrectly states that the height should be expressed as a
* percentage of 1024.
*
* @access private
* @param integer $col_start Col containing upper left corner of object
* @param integer $row_start Row containing top left corner of object
* @param integer $x1 Distance to left side of object
* @param integer $y1 Distance to top of object
* @param integer $width Width of image frame
* @param integer $height Height of image frame
*/
function _positionImage($col_start, $row_start, $x1, $y1, $width, $height)
{
// Initialise end cell to the same as the start cell
$col_end = $col_start; // Col containing lower right corner of object
$row_end = $row_start; // Row containing bottom right corner of object
// Zero the specified offset if greater than the cell dimensions
if ($x1 >= PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_start))) {
$x1 = 0;
}
if ($y1 >= PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_start + 1)) {
$y1 = 0;
}
$width = $width + $x1 -1;
$height = $height + $y1 -1;
// Subtract the underlying cell widths to find the end cell of the image
while ($width >= PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end))) {
$width -= PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end));
++$col_end;
}
// Subtract the underlying cell heights to find the end cell of the image
while ($height >= PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_end + 1)) {
$height -= PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_end + 1);
++$row_end;
}
// Bitmap isn't allowed to start or finish in a hidden cell, i.e. a cell
// with zero eight or width.
//
if (PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) == 0) {
return;
}
if (PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) == 0) {
return;
}
if (PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_start + 1) == 0) {
return;
}
if (PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_end + 1) == 0) {
return;
}
// Convert the pixel values to the percentage value expected by Excel
$x1 = $x1 / PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) * 1024;
$y1 = $y1 / PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_start + 1) * 256;
$x2 = $width / PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object
$y2 = $height / PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_end + 1) * 256; // Distance to bottom of object
$this->_writeObjPicture($col_start, $x1,
$row_start, $y1,
$col_end, $x2,
$row_end, $y2);
}
/**
* Store the OBJ record that precedes an IMDATA record. This could be generalise
* to support other Excel objects.
*
* @param integer $colL Column containing upper left corner of object
* @param integer $dxL Distance from left side of cell
* @param integer $rwT Row containing top left corner of object
* @param integer $dyT Distance from top of cell
* @param integer $colR Column containing lower right corner of object
* @param integer $dxR Distance from right of cell
* @param integer $rwB Row containing bottom right corner of object
* @param integer $dyB Distance from bottom of cell
*/
private function _writeObjPicture($colL,$dxL,$rwT,$dyT,$colR,$dxR,$rwB,$dyB)
{
$record = 0x005d; // Record identifier
$length = 0x003c; // Bytes to follow
$cObj = 0x0001; // Count of objects in file (set to 1)
$OT = 0x0008; // Object type. 8 = Picture
$id = 0x0001; // Object ID
$grbit = 0x0614; // Option flags
$cbMacro = 0x0000; // Length of FMLA structure
$Reserved1 = 0x0000; // Reserved
$Reserved2 = 0x0000; // Reserved
$icvBack = 0x09; // Background colour
$icvFore = 0x09; // Foreground colour
$fls = 0x00; // Fill pattern
$fAuto = 0x00; // Automatic fill
$icv = 0x08; // Line colour
$lns = 0xff; // Line style
$lnw = 0x01; // Line weight
$fAutoB = 0x00; // Automatic border
$frs = 0x0000; // Frame style
$cf = 0x0009; // Image format, 9 = bitmap
$Reserved3 = 0x0000; // Reserved
$cbPictFmla = 0x0000; // Length of FMLA structure
$Reserved4 = 0x0000; // Reserved
$grbit2 = 0x0001; // Option flags
$Reserved5 = 0x0000; // Reserved
$header = pack("vv", $record, $length);
$data = pack("V", $cObj);
$data .= pack("v", $OT);
$data .= pack("v", $id);
$data .= pack("v", $grbit);
$data .= pack("v", $colL);
$data .= pack("v", $dxL);
$data .= pack("v", $rwT);
$data .= pack("v", $dyT);
$data .= pack("v", $colR);
$data .= pack("v", $dxR);
$data .= pack("v", $rwB);
$data .= pack("v", $dyB);
$data .= pack("v", $cbMacro);
$data .= pack("V", $Reserved1);
$data .= pack("v", $Reserved2);
$data .= pack("C", $icvBack);
$data .= pack("C", $icvFore);
$data .= pack("C", $fls);
$data .= pack("C", $fAuto);
$data .= pack("C", $icv);
$data .= pack("C", $lns);
$data .= pack("C", $lnw);
$data .= pack("C", $fAutoB);
$data .= pack("v", $frs);
$data .= pack("V", $cf);
$data .= pack("v", $Reserved3);
$data .= pack("v", $cbPictFmla);
$data .= pack("v", $Reserved4);
$data .= pack("v", $grbit2);
$data .= pack("V", $Reserved5);
$this->_append($header . $data);
}
/**
* Convert a GD-image into the internal format.
*
* @access private
* @param resource $image The image to process
* @return array Array with data and properties of the bitmap
*/
function _processBitmapGd($image) {
$width = imagesx($image);
$height = imagesy($image);
$data = pack("Vvvvv", 0x000c, $width, $height, 0x01, 0x18);
for ($j=$height; $j--; ) {
for ($i=0; $i < $width; ++$i) {
$color = imagecolorsforindex($image, imagecolorat($image, $i, $j));
foreach (array("red", "green", "blue") as $key) {
$color[$key] = $color[$key] + round((255 - $color[$key]) * $color["alpha"] / 127);
}
$data .= chr($color["blue"]) . chr($color["green"]) . chr($color["red"]);
}
if (3*$width % 4) {
$data .= str_repeat("\x00", 4 - 3*$width % 4);
}
}
return array($width, $height, strlen($data), $data);
}
/**
* Convert a 24 bit bitmap into the modified internal format used by Windows.
* This is described in BITMAPCOREHEADER and BITMAPCOREINFO structures in the
* MSDN library.
*
* @access private
* @param string $bitmap The bitmap to process
* @return array Array with data and properties of the bitmap
*/
function _processBitmap($bitmap)
{
// Open file.
$bmp_fd = @fopen($bitmap,"rb");
if (!$bmp_fd) {
throw new PHPExcel_Writer_Exception("Couldn't import $bitmap");
}
// Slurp the file into a string.
$data = fread($bmp_fd, filesize($bitmap));
// Check that the file is big enough to be a bitmap.
if (strlen($data) <= 0x36) {
throw new PHPExcel_Writer_Exception("$bitmap doesn't contain enough data.\n");
}
// The first 2 bytes are used to identify the bitmap.
$identity = unpack("A2ident", $data);
if ($identity['ident'] != "BM") {
throw new PHPExcel_Writer_Exception("$bitmap doesn't appear to be a valid bitmap image.\n");
}
// Remove bitmap data: ID.
$data = substr($data, 2);
// Read and remove the bitmap size. This is more reliable than reading
// the data size at offset 0x22.
//
$size_array = unpack("Vsa", substr($data, 0, 4));
$size = $size_array['sa'];
$data = substr($data, 4);
$size -= 0x36; // Subtract size of bitmap header.
$size += 0x0C; // Add size of BIFF header.
// Remove bitmap data: reserved, offset, header length.
$data = substr($data, 12);
// Read and remove the bitmap width and height. Verify the sizes.
$width_and_height = unpack("V2", substr($data, 0, 8));
$width = $width_and_height[1];
$height = $width_and_height[2];
$data = substr($data, 8);
if ($width > 0xFFFF) {
throw new PHPExcel_Writer_Exception("$bitmap: largest image width supported is 65k.\n");
}
if ($height > 0xFFFF) {
throw new PHPExcel_Writer_Exception("$bitmap: largest image height supported is 65k.\n");
}
// Read and remove the bitmap planes and bpp data. Verify them.
$planes_and_bitcount = unpack("v2", substr($data, 0, 4));
$data = substr($data, 4);
if ($planes_and_bitcount[2] != 24) { // Bitcount
throw new PHPExcel_Writer_Exception("$bitmap isn't a 24bit true color bitmap.\n");
}
if ($planes_and_bitcount[1] != 1) {
throw new PHPExcel_Writer_Exception("$bitmap: only 1 plane supported in bitmap image.\n");
}
// Read and remove the bitmap compression. Verify compression.
$compression = unpack("Vcomp", substr($data, 0, 4));
$data = substr($data, 4);
//$compression = 0;
if ($compression['comp'] != 0) {
throw new PHPExcel_Writer_Exception("$bitmap: compression not supported in bitmap image.\n");
}
// Remove bitmap data: data size, hres, vres, colours, imp. colours.
$data = substr($data, 20);
// Add the BITMAPCOREHEADER data
$header = pack("Vvvvv", 0x000c, $width, $height, 0x01, 0x18);
$data = $header . $data;
return (array($width, $height, $size, $data));
}
/**
* Store the window zoom factor. This should be a reduced fraction but for
* simplicity we will store all fractions with a numerator of 100.
*/
private function _writeZoom()
{
// If scale is 100 we don't need to write a record
if ($this->_phpSheet->getSheetView()->getZoomScale() == 100) {
return;
}
$record = 0x00A0; // Record identifier
$length = 0x0004; // Bytes to follow
$header = pack("vv", $record, $length);
$data = pack("vv", $this->_phpSheet->getSheetView()->getZoomScale(), 100);
$this->_append($header . $data);
}
/**
* Get Escher object
*
* @return PHPExcel_Shared_Escher
*/
public function getEscher()
{
return $this->_escher;
}
/**
* Set Escher object
*
* @param PHPExcel_Shared_Escher $pValue
*/
public function setEscher(PHPExcel_Shared_Escher $pValue = null)
{
$this->_escher = $pValue;
}
/**
* Write MSODRAWING record
*/
private function _writeMsoDrawing()
{
// write the Escher stream if necessary
if (isset($this->_escher)) {
$writer = new PHPExcel_Writer_Excel5_Escher($this->_escher);
$data = $writer->close();
$spOffsets = $writer->getSpOffsets();
$spTypes = $writer->getSpTypes();
// write the neccesary MSODRAWING, OBJ records
// split the Escher stream
$spOffsets[0] = 0;
$nm = count($spOffsets) - 1; // number of shapes excluding first shape
for ($i = 1; $i <= $nm; ++$i) {
// MSODRAWING record
$record = 0x00EC; // Record identifier
// chunk of Escher stream for one shape
$dataChunk = substr($data, $spOffsets[$i -1], $spOffsets[$i] - $spOffsets[$i - 1]);
$length = strlen($dataChunk);
$header = pack("vv", $record, $length);
$this->_append($header . $dataChunk);
// OBJ record
$record = 0x005D; // record identifier
$objData = '';
// ftCmo
if($spTypes[$i] == 0x00C9){
// Add ftCmo (common object data) subobject
$objData .=
pack('vvvvvVVV'
, 0x0015 // 0x0015 = ftCmo
, 0x0012 // length of ftCmo data
, 0x0014 // object type, 0x0014 = filter
, $i // object id number, Excel seems to use 1-based index, local for the sheet
, 0x2101 // option flags, 0x2001 is what OpenOffice.org uses
, 0 // reserved
, 0 // reserved
, 0 // reserved
);
// Add ftSbs Scroll bar subobject
$objData .= pack('vv', 0x00C, 0x0014);
$objData .= pack('H*', '0000000000000000640001000A00000010000100');
// Add ftLbsData (List box data) subobject
$objData .= pack('vv', 0x0013, 0x1FEE);
$objData .= pack('H*', '00000000010001030000020008005700');
}
else {
// Add ftCmo (common object data) subobject
$objData .=
pack('vvvvvVVV'
, 0x0015 // 0x0015 = ftCmo
, 0x0012 // length of ftCmo data
, 0x0008 // object type, 0x0008 = picture
, $i // object id number, Excel seems to use 1-based index, local for the sheet
, 0x6011 // option flags, 0x6011 is what OpenOffice.org uses
, 0 // reserved
, 0 // reserved
, 0 // reserved
);
}
// ftEnd
$objData .=
pack('vv'
, 0x0000 // 0x0000 = ftEnd
, 0x0000 // length of ftEnd data
);
$length = strlen($objData);
$header = pack('vv', $record, $length);
$this->_append($header . $objData);
}
}
}
/**
* Store the DATAVALIDATIONS and DATAVALIDATION records.
*/
private function _writeDataValidity()
{
// Datavalidation collection
$dataValidationCollection = $this->_phpSheet->getDataValidationCollection();
// Write data validations?
if (!empty($dataValidationCollection)) {
// DATAVALIDATIONS record
$record = 0x01B2; // Record identifier
$length = 0x0012; // Bytes to follow
$grbit = 0x0000; // Prompt box at cell, no cached validity data at DV records
$horPos = 0x00000000; // Horizontal position of prompt box, if fixed position
$verPos = 0x00000000; // Vertical position of prompt box, if fixed position
$objId = 0xFFFFFFFF; // Object identifier of drop down arrow object, or -1 if not visible
$header = pack('vv', $record, $length);
$data = pack('vVVVV', $grbit, $horPos, $verPos, $objId,
count($dataValidationCollection));
$this->_append($header.$data);
// DATAVALIDATION records
$record = 0x01BE; // Record identifier
foreach ($dataValidationCollection as $cellCoordinate => $dataValidation) {
// initialize record data
$data = '';
// options
$options = 0x00000000;
// data type
$type = $dataValidation->getType();
switch ($type) {
case PHPExcel_Cell_DataValidation::TYPE_NONE: $type = 0x00; break;
case PHPExcel_Cell_DataValidation::TYPE_WHOLE: $type = 0x01; break;
case PHPExcel_Cell_DataValidation::TYPE_DECIMAL: $type = 0x02; break;
case PHPExcel_Cell_DataValidation::TYPE_LIST: $type = 0x03; break;
case PHPExcel_Cell_DataValidation::TYPE_DATE: $type = 0x04; break;
case PHPExcel_Cell_DataValidation::TYPE_TIME: $type = 0x05; break;
case PHPExcel_Cell_DataValidation::TYPE_TEXTLENGTH: $type = 0x06; break;
case PHPExcel_Cell_DataValidation::TYPE_CUSTOM: $type = 0x07; break;
}
$options |= $type << 0;
// error style
$errorStyle = $dataValidation->getType();
switch ($errorStyle) {
case PHPExcel_Cell_DataValidation::STYLE_STOP: $errorStyle = 0x00; break;
case PHPExcel_Cell_DataValidation::STYLE_WARNING: $errorStyle = 0x01; break;
case PHPExcel_Cell_DataValidation::STYLE_INFORMATION: $errorStyle = 0x02; break;
}
$options |= $errorStyle << 4;
// explicit formula?
if ($type == 0x03 && preg_match('/^\".*\"$/', $dataValidation->getFormula1())) {
$options |= 0x01 << 7;
}
// empty cells allowed
$options |= $dataValidation->getAllowBlank() << 8;
// show drop down
$options |= (!$dataValidation->getShowDropDown()) << 9;
// show input message
$options |= $dataValidation->getShowInputMessage() << 18;
// show error message
$options |= $dataValidation->getShowErrorMessage() << 19;
// condition operator
$operator = $dataValidation->getOperator();
switch ($operator) {
case PHPExcel_Cell_DataValidation::OPERATOR_BETWEEN: $operator = 0x00 ; break;
case PHPExcel_Cell_DataValidation::OPERATOR_NOTBETWEEN: $operator = 0x01 ; break;
case PHPExcel_Cell_DataValidation::OPERATOR_EQUAL: $operator = 0x02 ; break;
case PHPExcel_Cell_DataValidation::OPERATOR_NOTEQUAL: $operator = 0x03 ; break;
case PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHAN: $operator = 0x04 ; break;
case PHPExcel_Cell_DataValidation::OPERATOR_LESSTHAN: $operator = 0x05 ; break;
case PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHANOREQUAL: $operator = 0x06; break;
case PHPExcel_Cell_DataValidation::OPERATOR_LESSTHANOREQUAL: $operator = 0x07 ; break;
}
$options |= $operator << 20;
$data = pack('V', $options);
// prompt title
$promptTitle = $dataValidation->getPromptTitle() !== '' ?
$dataValidation->getPromptTitle() : chr(0);
$data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($promptTitle);
// error title
$errorTitle = $dataValidation->getErrorTitle() !== '' ?
$dataValidation->getErrorTitle() : chr(0);
$data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($errorTitle);
// prompt text
$prompt = $dataValidation->getPrompt() !== '' ?
$dataValidation->getPrompt() : chr(0);
$data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($prompt);
// error text
$error = $dataValidation->getError() !== '' ?
$dataValidation->getError() : chr(0);
$data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($error);
// formula 1
try {
$formula1 = $dataValidation->getFormula1();
if ($type == 0x03) { // list type
$formula1 = str_replace(',', chr(0), $formula1);
}
$this->_parser->parse($formula1);
$formula1 = $this->_parser->toReversePolish();
$sz1 = strlen($formula1);
} catch(PHPExcel_Exception $e) {
$sz1 = 0;
$formula1 = '';
}
$data .= pack('vv', $sz1, 0x0000);
$data .= $formula1;
// formula 2
try {
$formula2 = $dataValidation->getFormula2();
if ($formula2 === '') {
throw new PHPExcel_Writer_Exception('No formula2');
}
$this->_parser->parse($formula2);
$formula2 = $this->_parser->toReversePolish();
$sz2 = strlen($formula2);
} catch(PHPExcel_Exception $e) {
$sz2 = 0;
$formula2 = '';
}
$data .= pack('vv', $sz2, 0x0000);
$data .= $formula2;
// cell range address list
$data .= pack('v', 0x0001);
$data .= $this->_writeBIFF8CellRangeAddressFixed($cellCoordinate);
$length = strlen($data);
$header = pack("vv", $record, $length);
$this->_append($header . $data);
}
}
}
/**
* Map Error code
*
* @param string $errorCode
* @return int
*/
private static function _mapErrorCode($errorCode) {
switch ($errorCode) {
case '#NULL!': return 0x00;
case '#DIV/0!': return 0x07;
case '#VALUE!': return 0x0F;
case '#REF!': return 0x17;
case '#NAME?': return 0x1D;
case '#NUM!': return 0x24;
case '#N/A': return 0x2A;
}
return 0;
}
/**
* Write PLV Record
*/
private function _writePageLayoutView(){
$record = 0x088B; // Record identifier
$length = 0x0010; // Bytes to follow
$rt = 0x088B; // 2
$grbitFrt = 0x0000; // 2
$reserved = 0x0000000000000000; // 8
$wScalvePLV = $this->_phpSheet->getSheetView()->getZoomScale(); // 2
// The options flags that comprise $grbit
if($this->_phpSheet->getSheetView()->getView() == PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT){
$fPageLayoutView = 1;
} else {
$fPageLayoutView = 0;
}
$fRulerVisible = 0;
$fWhitespaceHidden = 0;
$grbit = $fPageLayoutView; // 2
$grbit |= $fRulerVisible << 1;
$grbit |= $fWhitespaceHidden << 3;
$header = pack("vv", $record, $length);
$data = pack("vvVVvv", $rt, $grbitFrt, 0x00000000, 0x00000000, $wScalvePLV, $grbit);
$this->_append($header . $data);
}
/**
* Write CFRule Record
* @param PHPExcel_Style_Conditional $conditional
*/
private function _writeCFRule(PHPExcel_Style_Conditional $conditional){
$record = 0x01B1; // Record identifier
// $type : Type of the CF
// $operatorType : Comparison operator
if($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION){
$type = 0x02;
$operatorType = 0x00;
} else if($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS){
$type = 0x01;
switch ($conditional->getOperatorType()){
case PHPExcel_Style_Conditional::OPERATOR_NONE:
$operatorType = 0x00;
break;
case PHPExcel_Style_Conditional::OPERATOR_EQUAL:
$operatorType = 0x03;
break;
case PHPExcel_Style_Conditional::OPERATOR_GREATERTHAN:
$operatorType = 0x05;
break;
case PHPExcel_Style_Conditional::OPERATOR_GREATERTHANOREQUAL:
$operatorType = 0x07;
break;
case PHPExcel_Style_Conditional::OPERATOR_LESSTHAN:
$operatorType = 0x06;
break;
case PHPExcel_Style_Conditional::OPERATOR_LESSTHANOREQUAL:
$operatorType = 0x08;
break;
case PHPExcel_Style_Conditional::OPERATOR_NOTEQUAL:
$operatorType = 0x04;
break;
case PHPExcel_Style_Conditional::OPERATOR_BETWEEN:
$operatorType = 0x01;
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 : 0x0000);
$szValue2 = 0x0000;
$operand1 = pack('Cv', 0x1E, $arrConditions[0]);
$operand2 = null;
} else if($numConditions == 2 && ($conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BETWEEN)){
$szValue1 = ($arrConditions[0] <= 65535 ? 3 : 0x0000);
$szValue2 = ($arrConditions[1] <= 65535 ? 3 : 0x0000);
$operand1 = pack('Cv', 0x1E, $arrConditions[0]);
$operand2 = pack('Cv', 0x1E, $arrConditions[1]);
} else {
$szValue1 = 0x0000;
$szValue2 = 0x0000;
$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);
$bFillColor = ($conditional->getStyle()->getFill()->getStartColor()->getARGB() == null ? 0 : 1);
$bFillColorBg = ($conditional->getStyle()->getFill()->getEndColor()->getARGB() == null ? 0 : 1);
if($bFillStyle == 0 || $bFillColor == 0 || $bFillColorBg == 0){
$bFormatFill = 1;
} else {
$bFormatFill = 0;
}
// Font
if($conditional->getStyle()->getFont()->getName() != null
|| $conditional->getStyle()->getFont()->getSize() != null
|| $conditional->getStyle()->getFont()->getBold() != null
|| $conditional->getStyle()->getFont()->getItalic() != null
|| $conditional->getStyle()->getFont()->getSuperScript() != null
|| $conditional->getStyle()->getFont()->getSubScript() != null
|| $conditional->getStyle()->getFont()->getUnderline() != null
|| $conditional->getStyle()->getFont()->getStrikethrough() != null
|| $conditional->getStyle()->getFont()->getColor()->getARGB() != null){
$bFormatFont = 1;
} else {
$bFormatFont = 0;
}
// Alignment
$flags = 0;
$flags |= (1 == $bAlignHz ? 0x00000001 : 0);
$flags |= (1 == $bAlignVt ? 0x00000002 : 0);
$flags |= (1 == $bAlignWrapTx ? 0x00000004 : 0);
$flags |= (1 == $bTxRotation ? 0x00000008 : 0);
// Justify last line flag
$flags |= (1 == 1 ? 0x00000010 : 0);
$flags |= (1 == $bIndent ? 0x00000020 : 0);
$flags |= (1 == $bShrinkToFit ? 0x00000040 : 0);
// Default
$flags |= (1 == 1 ? 0x00000080 : 0);
// Protection
$flags |= (1 == $bProtLocked ? 0x00000100 : 0);
$flags |= (1 == $bProtHidden ? 0x00000200 : 0);
// Border
$flags |= (1 == $bBorderLeft ? 0x00000400 : 0);
$flags |= (1 == $bBorderRight ? 0x00000800 : 0);
$flags |= (1 == $bBorderTop ? 0x00001000 : 0);
$flags |= (1 == $bBorderBottom ? 0x00002000 : 0);
$flags |= (1 == 1 ? 0x00004000 : 0); // Top left to Bottom right border
$flags |= (1 == 1 ? 0x00008000 : 0); // Bottom left to Top right border
// Pattern
$flags |= (1 == $bFillStyle ? 0x00010000 : 0);
$flags |= (1 == $bFillColor ? 0x00020000 : 0);
$flags |= (1 == $bFillColorBg ? 0x00040000 : 0);
$flags |= (1 == 1 ? 0x00380000 : 0);
// Font
$flags |= (1 == $bFormatFont ? 0x04000000 : 0);
// Alignment :
$flags |= (1 == $bFormatAlign ? 0x08000000 : 0);
// Border
$flags |= (1 == $bFormatBorder ? 0x10000000 : 0);
// Pattern
$flags |= (1 == $bFormatFill ? 0x20000000 : 0);
// Protection
$flags |= (1 == $bFormatProt ? 0x40000000 : 0);
// Text direction
$flags |= (1 == 0 ? 0x80000000 : 0);
// Data Blocks
if($bFormatFont == 1){
// Font Name
if($conditional->getStyle()->getFont()->getName() == null){
$dataBlockFont = pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000);
$dataBlockFont .= pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000);
} else {
$dataBlockFont = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($conditional->getStyle()->getFont()->getName());
}
// Font Size
if($conditional->getStyle()->getFont()->getSize() == null){
$dataBlockFont .= pack('V', 20 * 11);
} else {
$dataBlockFont .= pack('V', 20 * $conditional->getStyle()->getFont()->getSize());
}
// Font Options
$dataBlockFont .= pack('V', 0);
// Font weight
if($conditional->getStyle()->getFont()->getBold() == true){
$dataBlockFont .= pack('v', 0x02BC);
} else {
$dataBlockFont .= pack('v', 0x0190);
}
// Escapement type
if($conditional->getStyle()->getFont()->getSubScript() == true){
$dataBlockFont .= pack('v', 0x02);
$fontEscapement = 0;
} else if($conditional->getStyle()->getFont()->getSuperScript() == true){
$dataBlockFont .= pack('v', 0x01);
$fontEscapement = 0;
} else {
$dataBlockFont .= pack('v', 0x00);
$fontEscapement = 1;
}
// Underline type
switch ($conditional->getStyle()->getFont()->getUnderline()){
case PHPExcel_Style_Font::UNDERLINE_NONE : $dataBlockFont .= pack('C', 0x00); $fontUnderline = 0; break;
case PHPExcel_Style_Font::UNDERLINE_DOUBLE : $dataBlockFont .= pack('C', 0x02); $fontUnderline = 0; break;
case PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING : $dataBlockFont .= pack('C', 0x22); $fontUnderline = 0; break;
case PHPExcel_Style_Font::UNDERLINE_SINGLE : $dataBlockFont .= pack('C', 0x01); $fontUnderline = 0; break;
case PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING : $dataBlockFont .= pack('C', 0x21); $fontUnderline = 0; break;
default : $dataBlockFont .= pack('C', 0x00); $fontUnderline = 1; break;
}
// Not used (3)
$dataBlockFont .= pack('vC', 0x0000, 0x00);
// Font color index
switch ($conditional->getStyle()->getFont()->getColor()->getRGB()) {
case '000000': $colorIdx = 0x08; break;
case 'FFFFFF': $colorIdx = 0x09; break;
case 'FF0000': $colorIdx = 0x0A; break;
case '00FF00': $colorIdx = 0x0B; break;
case '0000FF': $colorIdx = 0x0C; break;
case 'FFFF00': $colorIdx = 0x0D; break;
case 'FF00FF': $colorIdx = 0x0E; break;
case '00FFFF': $colorIdx = 0x0F; break;
case '800000': $colorIdx = 0x10; break;
case '008000': $colorIdx = 0x11; break;
case '000080': $colorIdx = 0x12; break;
case '808000': $colorIdx = 0x13; break;
case '800080': $colorIdx = 0x14; break;
case '008080': $colorIdx = 0x15; break;
case 'C0C0C0': $colorIdx = 0x16; break;
case '808080': $colorIdx = 0x17; break;
case '9999FF': $colorIdx = 0x18; break;
case '993366': $colorIdx = 0x19; break;
case 'FFFFCC': $colorIdx = 0x1A; break;
case 'CCFFFF': $colorIdx = 0x1B; break;
case '660066': $colorIdx = 0x1C; break;
case 'FF8080': $colorIdx = 0x1D; break;
case '0066CC': $colorIdx = 0x1E; break;
case 'CCCCFF': $colorIdx = 0x1F; break;
case '000080': $colorIdx = 0x20; break;
case 'FF00FF': $colorIdx = 0x21; break;
case 'FFFF00': $colorIdx = 0x22; break;
case '00FFFF': $colorIdx = 0x23; break;
case '800080': $colorIdx = 0x24; break;
case '800000': $colorIdx = 0x25; break;
case '008080': $colorIdx = 0x26; break;
case '0000FF': $colorIdx = 0x27; break;
case '00CCFF': $colorIdx = 0x28; break;
case 'CCFFFF': $colorIdx = 0x29; break;
case 'CCFFCC': $colorIdx = 0x2A; break;
case 'FFFF99': $colorIdx = 0x2B; break;
case '99CCFF': $colorIdx = 0x2C; break;
case 'FF99CC': $colorIdx = 0x2D; break;
case 'CC99FF': $colorIdx = 0x2E; break;
case 'FFCC99': $colorIdx = 0x2F; break;
case '3366FF': $colorIdx = 0x30; break;
case '33CCCC': $colorIdx = 0x31; break;
case '99CC00': $colorIdx = 0x32; break;
case 'FFCC00': $colorIdx = 0x33; break;
case 'FF9900': $colorIdx = 0x34; break;
case 'FF6600': $colorIdx = 0x35; break;
case '666699': $colorIdx = 0x36; break;
case '969696': $colorIdx = 0x37; break;
case '003366': $colorIdx = 0x38; break;
case '339966': $colorIdx = 0x39; break;
case '003300': $colorIdx = 0x3A; break;
case '333300': $colorIdx = 0x3B; break;
case '993300': $colorIdx = 0x3C; break;
case '993366': $colorIdx = 0x3D; break;
case '333399': $colorIdx = 0x3E; break;
case '333333': $colorIdx = 0x3F; break;
default: $colorIdx = 0x00; break;
}
$dataBlockFont .= pack('V', $colorIdx);
// Not used (4)
$dataBlockFont .= pack('V', 0x00000000);
// Options flags for modified font attributes
$optionsFlags = 0;
$optionsFlagsBold = ($conditional->getStyle()->getFont()->getBold() == null ? 1 : 0);
$optionsFlags |= (1 == $optionsFlagsBold ? 0x00000002 : 0);
$optionsFlags |= (1 == 1 ? 0x00000008 : 0);
$optionsFlags |= (1 == 1 ? 0x00000010 : 0);
$optionsFlags |= (1 == 0 ? 0x00000020 : 0);
$optionsFlags |= (1 == 1 ? 0x00000080 : 0);
$dataBlockFont .= pack('V', $optionsFlags);
// Escapement type
$dataBlockFont .= pack('V', $fontEscapement);
// Underline type
$dataBlockFont .= pack('V', $fontUnderline);
// Always
$dataBlockFont .= pack('V', 0x00000000);
// Always
$dataBlockFont .= pack('V', 0x00000000);
// Not used (8)
$dataBlockFont .= pack('VV', 0x00000000, 0x00000000);
// Always
$dataBlockFont .= pack('v', 0x0001);
}
if($bFormatAlign == 1){
$blockAlign = 0;
// Alignment and text break
switch ($conditional->getStyle()->getAlignment()->getHorizontal()){
case PHPExcel_Style_Alignment::HORIZONTAL_GENERAL : $blockAlign = 0; break;
case PHPExcel_Style_Alignment::HORIZONTAL_LEFT : $blockAlign = 1; break;
case PHPExcel_Style_Alignment::HORIZONTAL_RIGHT : $blockAlign = 3; break;
case PHPExcel_Style_Alignment::HORIZONTAL_CENTER : $blockAlign = 2; break;
case PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS : $blockAlign = 6; break;
case PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY : $blockAlign = 5; break;
}
if($conditional->getStyle()->getAlignment()->getWrapText() == true){
$blockAlign |= 1 << 3;
} else {
$blockAlign |= 0 << 3;
}
switch ($conditional->getStyle()->getAlignment()->getVertical()){
case PHPExcel_Style_Alignment::VERTICAL_BOTTOM : $blockAlign = 2 << 4; break;
case PHPExcel_Style_Alignment::VERTICAL_TOP : $blockAlign = 0 << 4; break;
case PHPExcel_Style_Alignment::VERTICAL_CENTER : $blockAlign = 1 << 4; break;
case PHPExcel_Style_Alignment::VERTICAL_JUSTIFY : $blockAlign = 3 << 4; break;
}
$blockAlign |= 0 << 7;
// Text rotation angle
$blockRotation = $conditional->getStyle()->getAlignment()->getTextRotation();
// Indentation
$blockIndent = $conditional->getStyle()->getAlignment()->getIndent();
if($conditional->getStyle()->getAlignment()->getShrinkToFit() == true){
$blockIndent |= 1 << 4;
} else {
$blockIndent |= 0 << 4;
}
$blockIndent |= 0 << 6;
// Relative indentation
$blockIndentRelative = 255;
$dataBlockAlign = pack('CCvvv', $blockAlign, $blockRotation, $blockIndent, $blockIndentRelative, 0x0000);
}
if($bFormatBorder == 1){
$blockLineStyle = 0;
switch ($conditional->getStyle()->getBorders()->getLeft()->getBorderStyle()){
case PHPExcel_Style_Border::BORDER_NONE : $blockLineStyle |= 0x00; break;
case PHPExcel_Style_Border::BORDER_THIN : $blockLineStyle |= 0x01; break;
case PHPExcel_Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02; break;
case PHPExcel_Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03; break;
case PHPExcel_Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04; break;
case PHPExcel_Style_Border::BORDER_THICK : $blockLineStyle |= 0x05; break;
case PHPExcel_Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06; break;
case PHPExcel_Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07; break;
case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08; break;
case PHPExcel_Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09; break;
case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A; break;
case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B; break;
case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C; break;
case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D; break;
}
switch ($conditional->getStyle()->getBorders()->getRight()->getBorderStyle()){
case PHPExcel_Style_Border::BORDER_NONE : $blockLineStyle |= 0x00 << 4; break;
case PHPExcel_Style_Border::BORDER_THIN : $blockLineStyle |= 0x01 << 4; break;
case PHPExcel_Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02 << 4; break;
case PHPExcel_Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03 << 4; break;
case PHPExcel_Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04 << 4; break;
case PHPExcel_Style_Border::BORDER_THICK : $blockLineStyle |= 0x05 << 4; break;
case PHPExcel_Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06 << 4; break;
case PHPExcel_Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07 << 4; break;
case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08 << 4; break;
case PHPExcel_Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09 << 4; break;
case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A << 4; break;
case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B << 4; break;
case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C << 4; break;
case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D << 4; break;
}
switch ($conditional->getStyle()->getBorders()->getTop()->getBorderStyle()){
case PHPExcel_Style_Border::BORDER_NONE : $blockLineStyle |= 0x00 << 8; break;
case PHPExcel_Style_Border::BORDER_THIN : $blockLineStyle |= 0x01 << 8; break;
case PHPExcel_Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02 << 8; break;
case PHPExcel_Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03 << 8; break;
case PHPExcel_Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04 << 8; break;
case PHPExcel_Style_Border::BORDER_THICK : $blockLineStyle |= 0x05 << 8; break;
case PHPExcel_Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06 << 8; break;
case PHPExcel_Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07 << 8; break;
case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08 << 8; break;
case PHPExcel_Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09 << 8; break;
case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A << 8; break;
case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B << 8; break;
case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C << 8; break;
case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D << 8; break;
}
switch ($conditional->getStyle()->getBorders()->getBottom()->getBorderStyle()){
case PHPExcel_Style_Border::BORDER_NONE : $blockLineStyle |= 0x00 << 12; break;
case PHPExcel_Style_Border::BORDER_THIN : $blockLineStyle |= 0x01 << 12; break;
case PHPExcel_Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02 << 12; break;
case PHPExcel_Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03 << 12; break;
case PHPExcel_Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04 << 12; break;
case PHPExcel_Style_Border::BORDER_THICK : $blockLineStyle |= 0x05 << 12; break;
case PHPExcel_Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06 << 12; break;
case PHPExcel_Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07 << 12; break;
case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08 << 12; break;
case PHPExcel_Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09 << 12; break;
case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A << 12; break;
case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B << 12; break;
case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C << 12; break;
case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D << 12; break;
}
//@todo _writeCFRule() => $blockLineStyle => Index Color for left line
//@todo _writeCFRule() => $blockLineStyle => Index Color for right line
//@todo _writeCFRule() => $blockLineStyle => Top-left to bottom-right on/off
//@todo _writeCFRule() => $blockLineStyle => Bottom-left to top-right on/off
$blockColor = 0;
//@todo _writeCFRule() => $blockColor => Index Color for top line
//@todo _writeCFRule() => $blockColor => Index Color for bottom line
//@todo _writeCFRule() => $blockColor => Index Color for diagonal line
switch ($conditional->getStyle()->getBorders()->getDiagonal()->getBorderStyle()){
case PHPExcel_Style_Border::BORDER_NONE : $blockColor |= 0x00 << 21; break;
case PHPExcel_Style_Border::BORDER_THIN : $blockColor |= 0x01 << 21; break;
case PHPExcel_Style_Border::BORDER_MEDIUM : $blockColor |= 0x02 << 21; break;
case PHPExcel_Style_Border::BORDER_DASHED : $blockColor |= 0x03 << 21; break;
case PHPExcel_Style_Border::BORDER_DOTTED : $blockColor |= 0x04 << 21; break;
case PHPExcel_Style_Border::BORDER_THICK : $blockColor |= 0x05 << 21; break;
case PHPExcel_Style_Border::BORDER_DOUBLE : $blockColor |= 0x06 << 21; break;
case PHPExcel_Style_Border::BORDER_HAIR : $blockColor |= 0x07 << 21; break;
case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockColor |= 0x08 << 21; break;
case PHPExcel_Style_Border::BORDER_DASHDOT : $blockColor |= 0x09 << 21; break;
case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockColor |= 0x0A << 21; break;
case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockColor |= 0x0B << 21; break;
case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockColor |= 0x0C << 21; break;
case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockColor |= 0x0D << 21; break;
}
$dataBlockBorder = pack('vv', $blockLineStyle, $blockColor);
}
if($bFormatFill == 1){
// Fill Patern Style
$blockFillPatternStyle = 0;
switch ($conditional->getStyle()->getFill()->getFillType()){
case PHPExcel_Style_Fill::FILL_NONE : $blockFillPatternStyle = 0x00; break;
case PHPExcel_Style_Fill::FILL_SOLID : $blockFillPatternStyle = 0x01; break;
case PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY : $blockFillPatternStyle = 0x02; break;
case PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY : $blockFillPatternStyle = 0x03; break;
case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY : $blockFillPatternStyle = 0x04; break;
case PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL : $blockFillPatternStyle = 0x05; break;
case PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL : $blockFillPatternStyle = 0x06; break;
case PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN : $blockFillPatternStyle = 0x07; break;
case PHPExcel_Style_Fill::FILL_PATTERN_DARKUP : $blockFillPatternStyle = 0x08; break;
case PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID : $blockFillPatternStyle = 0x09; break;
case PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS : $blockFillPatternStyle = 0x0A; break;
case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL : $blockFillPatternStyle = 0x0B; break;
case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL : $blockFillPatternStyle = 0x0C; break;
case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN : $blockFillPatternStyle = 0x0D; break;
case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP : $blockFillPatternStyle = 0x0E; break;
case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID : $blockFillPatternStyle = 0x0F; break;
case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS : $blockFillPatternStyle = 0x10; break;
case PHPExcel_Style_Fill::FILL_PATTERN_GRAY125 : $blockFillPatternStyle = 0x11; break;
case PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625 : $blockFillPatternStyle = 0x12; break;
case PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR : $blockFillPatternStyle = 0x00; break; // does not exist in BIFF8
case PHPExcel_Style_Fill::FILL_GRADIENT_PATH : $blockFillPatternStyle = 0x00; break; // does not exist in BIFF8
default : $blockFillPatternStyle = 0x00; break;
}
// Color
switch ($conditional->getStyle()->getFill()->getStartColor()->getRGB()) {
case '000000': $colorIdxBg = 0x08; break;
case 'FFFFFF': $colorIdxBg = 0x09; break;
case 'FF0000': $colorIdxBg = 0x0A; break;
case '00FF00': $colorIdxBg = 0x0B; break;
case '0000FF': $colorIdxBg = 0x0C; break;
case 'FFFF00': $colorIdxBg = 0x0D; break;
case 'FF00FF': $colorIdxBg = 0x0E; break;
case '00FFFF': $colorIdxBg = 0x0F; break;
case '800000': $colorIdxBg = 0x10; break;
case '008000': $colorIdxBg = 0x11; break;
case '000080': $colorIdxBg = 0x12; break;
case '808000': $colorIdxBg = 0x13; break;
case '800080': $colorIdxBg = 0x14; break;
case '008080': $colorIdxBg = 0x15; break;
case 'C0C0C0': $colorIdxBg = 0x16; break;
case '808080': $colorIdxBg = 0x17; break;
case '9999FF': $colorIdxBg = 0x18; break;
case '993366': $colorIdxBg = 0x19; break;
case 'FFFFCC': $colorIdxBg = 0x1A; break;
case 'CCFFFF': $colorIdxBg = 0x1B; break;
case '660066': $colorIdxBg = 0x1C; break;
case 'FF8080': $colorIdxBg = 0x1D; break;
case '0066CC': $colorIdxBg = 0x1E; break;
case 'CCCCFF': $colorIdxBg = 0x1F; break;
case '000080': $colorIdxBg = 0x20; break;
case 'FF00FF': $colorIdxBg = 0x21; break;
case 'FFFF00': $colorIdxBg = 0x22; break;
case '00FFFF': $colorIdxBg = 0x23; break;
case '800080': $colorIdxBg = 0x24; break;
case '800000': $colorIdxBg = 0x25; break;
case '008080': $colorIdxBg = 0x26; break;
case '0000FF': $colorIdxBg = 0x27; break;
case '00CCFF': $colorIdxBg = 0x28; break;
case 'CCFFFF': $colorIdxBg = 0x29; break;
case 'CCFFCC': $colorIdxBg = 0x2A; break;
case 'FFFF99': $colorIdxBg = 0x2B; break;
case '99CCFF': $colorIdxBg = 0x2C; break;
case 'FF99CC': $colorIdxBg = 0x2D; break;
case 'CC99FF': $colorIdxBg = 0x2E; break;
case 'FFCC99': $colorIdxBg = 0x2F; break;
case '3366FF': $colorIdxBg = 0x30; break;
case '33CCCC': $colorIdxBg = 0x31; break;
case '99CC00': $colorIdxBg = 0x32; break;
case 'FFCC00': $colorIdxBg = 0x33; break;
case 'FF9900': $colorIdxBg = 0x34; break;
case 'FF6600': $colorIdxBg = 0x35; break;
case '666699': $colorIdxBg = 0x36; break;
case '969696': $colorIdxBg = 0x37; break;
case '003366': $colorIdxBg = 0x38; break;
case '339966': $colorIdxBg = 0x39; break;
case '003300': $colorIdxBg = 0x3A; break;
case '333300': $colorIdxBg = 0x3B; break;
case '993300': $colorIdxBg = 0x3C; break;
case '993366': $colorIdxBg = 0x3D; break;
case '333399': $colorIdxBg = 0x3E; break;
case '333333': $colorIdxBg = 0x3F; break;
default: $colorIdxBg = 0x41; break;
}
// Fg Color
switch ($conditional->getStyle()->getFill()->getEndColor()->getRGB()) {
case '000000': $colorIdxFg = 0x08; break;
case 'FFFFFF': $colorIdxFg = 0x09; break;
case 'FF0000': $colorIdxFg = 0x0A; break;
case '00FF00': $colorIdxFg = 0x0B; break;
case '0000FF': $colorIdxFg = 0x0C; break;
case 'FFFF00': $colorIdxFg = 0x0D; break;
case 'FF00FF': $colorIdxFg = 0x0E; break;
case '00FFFF': $colorIdxFg = 0x0F; break;
case '800000': $colorIdxFg = 0x10; break;
case '008000': $colorIdxFg = 0x11; break;
case '000080': $colorIdxFg = 0x12; break;
case '808000': $colorIdxFg = 0x13; break;
case '800080': $colorIdxFg = 0x14; break;
case '008080': $colorIdxFg = 0x15; break;
case 'C0C0C0': $colorIdxFg = 0x16; break;
case '808080': $colorIdxFg = 0x17; break;
case '9999FF': $colorIdxFg = 0x18; break;
case '993366': $colorIdxFg = 0x19; break;
case 'FFFFCC': $colorIdxFg = 0x1A; break;
case 'CCFFFF': $colorIdxFg = 0x1B; break;
case '660066': $colorIdxFg = 0x1C; break;
case 'FF8080': $colorIdxFg = 0x1D; break;
case '0066CC': $colorIdxFg = 0x1E; break;
case 'CCCCFF': $colorIdxFg = 0x1F; break;
case '000080': $colorIdxFg = 0x20; break;
case 'FF00FF': $colorIdxFg = 0x21; break;
case 'FFFF00': $colorIdxFg = 0x22; break;
case '00FFFF': $colorIdxFg = 0x23; break;
case '800080': $colorIdxFg = 0x24; break;
case '800000': $colorIdxFg = 0x25; break;
case '008080': $colorIdxFg = 0x26; break;
case '0000FF': $colorIdxFg = 0x27; break;
case '00CCFF': $colorIdxFg = 0x28; break;
case 'CCFFFF': $colorIdxFg = 0x29; break;
case 'CCFFCC': $colorIdxFg = 0x2A; break;
case 'FFFF99': $colorIdxFg = 0x2B; break;
case '99CCFF': $colorIdxFg = 0x2C; break;
case 'FF99CC': $colorIdxFg = 0x2D; break;
case 'CC99FF': $colorIdxFg = 0x2E; break;
case 'FFCC99': $colorIdxFg = 0x2F; break;
case '3366FF': $colorIdxFg = 0x30; break;
case '33CCCC': $colorIdxFg = 0x31; break;
case '99CC00': $colorIdxFg = 0x32; break;
case 'FFCC00': $colorIdxFg = 0x33; break;
case 'FF9900': $colorIdxFg = 0x34; break;
case 'FF6600': $colorIdxFg = 0x35; break;
case '666699': $colorIdxFg = 0x36; break;
case '969696': $colorIdxFg = 0x37; break;
case '003366': $colorIdxFg = 0x38; break;
case '339966': $colorIdxFg = 0x39; break;
case '003300': $colorIdxFg = 0x3A; break;
case '333300': $colorIdxFg = 0x3B; break;
case '993300': $colorIdxFg = 0x3C; break;
case '993366': $colorIdxFg = 0x3D; break;
case '333399': $colorIdxFg = 0x3E; break;
case '333333': $colorIdxFg = 0x3F; break;
default: $colorIdxFg = 0x40; break;
}
$dataBlockFill = pack('v', $blockFillPatternStyle);
$dataBlockFill .= pack('v', $colorIdxFg | ($colorIdxBg << 7));
}
if($bFormatProt == 1){
$dataBlockProtection = 0;
if($conditional->getStyle()->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED){
$dataBlockProtection = 1;
}
if($conditional->getStyle()->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED){
$dataBlockProtection = 1 << 1;
}
}
$data = pack('CCvvVv', $type, $operatorType, $szValue1, $szValue2, $flags, 0x0000);
if($bFormatFont == 1){ // Block Formatting : OK
$data .= $dataBlockFont;
}
if($bFormatAlign == 1){
$data .= $dataBlockAlign;
}
if($bFormatBorder == 1){
$data .= $dataBlockBorder;
}
if($bFormatFill == 1){ // Block Formatting : OK
$data .= $dataBlockFill;
}
if($bFormatProt == 1){
$data .= $dataBlockProtection;
}
if(!is_null($operand1)){
$data .= $operand1;
}
if(!is_null($operand2)){
$data .= $operand2;
}
$header = pack('vv', $record, strlen($data));
$this->_append($header . $data);
}
/**
* Write CFHeader record
*/
private function _writeCFHeader(){
$record = 0x01B0; // Record identifier
$length = 0x0016; // Bytes to follow
$numColumnMin = null;
$numColumnMax = null;
$numRowMin = null;
$numRowMax = null;
$arrConditional = array();
foreach ($this->_phpSheet->getConditionalStylesCollection() as $cellCoordinate => $conditionalStyles) {
foreach ($conditionalStyles as $conditional) {
if($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION
|| $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS){
if(!in_array($conditional->getHashCode(), $arrConditional)){
$arrConditional[] = $conditional->getHashCode();
}
// Cells
$arrCoord = PHPExcel_Cell::coordinateFromString($cellCoordinate);
if(!is_numeric($arrCoord[0])){
$arrCoord[0] = PHPExcel_Cell::columnIndexFromString($arrCoord[0]);
}
if(is_null($numColumnMin) || ($numColumnMin > $arrCoord[0])){
$numColumnMin = $arrCoord[0];
}
if(is_null($numColumnMax) || ($numColumnMax < $arrCoord[0])){
$numColumnMax = $arrCoord[0];
}
if(is_null($numRowMin) || ($numRowMin > $arrCoord[1])){
$numRowMin = $arrCoord[1];
}
if(is_null($numRowMax) || ($numRowMax < $arrCoord[1])){
$numRowMax = $arrCoord[1];
}
}
}
}
$needRedraw = 1;
$cellRange = pack('vvvv', $numRowMin-1, $numRowMax-1, $numColumnMin-1, $numColumnMax-1);
$header = pack('vv', $record, $length);
$data = pack('vv', count($arrConditional), $needRedraw);
$data .= $cellRange;
$data .= pack('v', 0x0001);
$data .= $cellRange;
$this->_append($header . $data);
}
}PK ! 2 PHPExcel/Writer/Excel5/Font.phpnu [ _colorIndex = 0x7FFF;
$this->_font = $font;
}
/**
* Set the color index
*
* @param int $colorIndex
*/
public function setColorIndex($colorIndex)
{
$this->_colorIndex = $colorIndex;
}
/**
* Get font record data
*
* @return string
*/
public function writeFont()
{
$font_outline = 0;
$font_shadow = 0;
$icv = $this->_colorIndex; // Index to color palette
if ($this->_font->getSuperScript()) {
$sss = 1;
} else if ($this->_font->getSubScript()) {
$sss = 2;
} else {
$sss = 0;
}
$bFamily = 0; // Font family
$bCharSet = PHPExcel_Shared_Font::getCharsetFromFontName($this->_font->getName()); // Character set
$record = 0x31; // Record identifier
$reserved = 0x00; // Reserved
$grbit = 0x00; // Font attributes
if ($this->_font->getItalic()) {
$grbit |= 0x02;
}
if ($this->_font->getStrikethrough()) {
$grbit |= 0x08;
}
if ($font_outline) {
$grbit |= 0x10;
}
if ($font_shadow) {
$grbit |= 0x20;
}
$data = pack("vvvvvCCCC",
$this->_font->getSize() * 20, // Fontsize (in twips)
$grbit,
$icv, // Colour
self::_mapBold($this->_font->getBold()), // Font weight
$sss, // Superscript/Subscript
self::_mapUnderline($this->_font->getUnderline()),
$bFamily,
$bCharSet,
$reserved
);
$data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($this->_font->getName());
$length = strlen($data);
$header = pack("vv", $record, $length);
return($header . $data);
}
/**
* Map to BIFF5-BIFF8 codes for bold
*
* @param boolean $bold
* @return int
*/
private static function _mapBold($bold) {
if ($bold) {
return 0x2BC; // 700 = Bold font weight
}
return 0x190; // 400 = Normal font weight
}
/**
* Map of BIFF2-BIFF8 codes for underline styles
* @static array of int
*
*/
private static $_mapUnderline = array( PHPExcel_Style_Font::UNDERLINE_NONE => 0x00,
PHPExcel_Style_Font::UNDERLINE_SINGLE => 0x01,
PHPExcel_Style_Font::UNDERLINE_DOUBLE => 0x02,
PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING => 0x21,
PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING => 0x22,
);
/**
* Map underline
*
* @param string
* @return int
*/
private static function _mapUnderline($underline) {
if (isset(self::$_mapUnderline[$underline]))
return self::$_mapUnderline[$underline];
return 0x00;
}
}
PK ! MOV`sB sB PHPExcel/Writer/Excel5/Xf.phpnu [
// *
// * The majority of this is _NOT_ my code. I simply ported it from the
// * PERL Spreadsheet::WriteExcel module.
// *
// * The author of the Spreadsheet::WriteExcel module is John McNamara
// *
// *
// * I _DO_ maintain this code, and John McNamara has nothing to do with the
// * porting of this code to PHP. Any questions directly related to this
// * class library should be directed to me.
// *
// * License Information:
// *
// * Spreadsheet_Excel_Writer: A library for generating Excel Spreadsheets
// * Copyright (c) 2002-2003 Xavier Noguer xnoguer@rezebra.com
// *
// * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// */
/**
* PHPExcel_Writer_Excel5_Xf
*
* @category PHPExcel
* @package PHPExcel_Writer_Excel5
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Writer_Excel5_Xf
{
/**
* Style XF or a cell XF ?
*
* @var boolean
*/
private $_isStyleXf;
/**
* Index to the FONT record. Index 4 does not exist
* @var integer
*/
private $_fontIndex;
/**
* An index (2 bytes) to a FORMAT record (number format).
* @var integer
*/
public $_numberFormatIndex;
/**
* 1 bit, apparently not used.
* @var integer
*/
public $_text_justlast;
/**
* The cell's foreground color.
* @var integer
*/
public $_fg_color;
/**
* The cell's background color.
* @var integer
*/
public $_bg_color;
/**
* Color of the bottom border of the cell.
* @var integer
*/
public $_bottom_color;
/**
* Color of the top border of the cell.
* @var integer
*/
public $_top_color;
/**
* Color of the left border of the cell.
* @var integer
*/
public $_left_color;
/**
* Color of the right border of the cell.
* @var integer
*/
public $_right_color;
/**
* Constructor
*
* @access public
* @param PHPExcel_Style The XF format
*/
public function __construct(PHPExcel_Style $style = null)
{
$this->_isStyleXf = false;
$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;
}
/**
* Generate an Excel BIFF XF record (style or cell).
*
* @return string The XF record
*/
function writeXf()
{
// Set the type of the XF record and some of the attributes.
if ($this->_isStyleXf) {
$style = 0xFFF5;
} else {
$style = self::_mapLocked($this->_style->getProtection()->getLocked());
$style |= self::_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 = (self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) ||
self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) ||
self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) ||
self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()))?1:0;
$atr_pat = (($this->_fg_color != 0x40) ||
($this->_bg_color != 0x41) ||
self::_mapFillType($this->_style->getFill()->getFillType()))?1:0;
$atr_prot = self::_mapLocked($this->_style->getProtection()->getLocked())
| self::_mapHidden($this->_style->getProtection()->getHidden());
// Zero the default border colour if the border has not been set.
if (self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) == 0) {
$this->_bottom_color = 0;
}
if (self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) == 0) {
$this->_top_color = 0;
}
if (self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) == 0) {
$this->_right_color = 0;
}
if (self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) == 0) {
$this->_left_color = 0;
}
if (self::_mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) == 0) {
$this->_diag_color = 0;
}
$record = 0x00E0; // Record identifier
$length = 0x0014; // Number of bytes to follow
$ifnt = $this->_fontIndex; // Index to FONT record
$ifmt = $this->_numberFormatIndex; // Index to FORMAT record
$align = $this->_mapHAlign($this->_style->getAlignment()->getHorizontal()); // Alignment
$align |= (int) $this->_style->getAlignment()->getWrapText() << 3;
$align |= self::_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 = self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()); // Border line style and color
$border1 |= self::_mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) << 4;
$border1 |= self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) << 8;
$border1 |= self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) << 12;
$border1 |= $this->_left_color << 16;
$border1 |= $this->_right_color << 23;
$diagonalDirection = $this->_style->getBorders()->getDiagonalDirection();
$diag_tl_to_rb = $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_BOTH
|| $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_DOWN;
$diag_tr_to_lb = $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_BOTH
|| $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_UP;
$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 |= self::_mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) << 21;
$border2 |= self::_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"
, self::_mapTextRotation($this->_style->getAlignment()->getTextRotation())
, $biff8_options
, $used_attrib
);
$data .= pack("VVv", $border1, $border2, $icv);
return($header . $data);
}
/**
* Is this a style XF ?
*
* @param boolean $value
*/
public function setIsStyleXf($value)
{
$this->_isStyleXf = $value;
}
/**
* Sets the cell's bottom border color
*
* @access public
* @param int $colorIndex Color index
*/
function setBottomColor($colorIndex)
{
$this->_bottom_color = $colorIndex;
}
/**
* Sets the cell's top border color
*
* @access public
* @param int $colorIndex Color index
*/
function setTopColor($colorIndex)
{
$this->_top_color = $colorIndex;
}
/**
* Sets the cell's left border color
*
* @access public
* @param int $colorIndex Color index
*/
function setLeftColor($colorIndex)
{
$this->_left_color = $colorIndex;
}
/**
* Sets the cell's right border color
*
* @access public
* @param int $colorIndex Color index
*/
function setRightColor($colorIndex)
{
$this->_right_color = $colorIndex;
}
/**
* Sets the cell's diagonal border color
*
* @access public
* @param int $colorIndex Color index
*/
function setDiagColor($colorIndex)
{
$this->_diag_color = $colorIndex;
}
/**
* Sets the cell's foreground color
*
* @access public
* @param int $colorIndex Color index
*/
function setFgColor($colorIndex)
{
$this->_fg_color = $colorIndex;
}
/**
* Sets the cell's background color
*
* @access public
* @param int $colorIndex Color index
*/
function setBgColor($colorIndex)
{
$this->_bg_color = $colorIndex;
}
/**
* Sets the index to the number format record
* It can be date, time, currency, etc...
*
* @access public
* @param integer $numberFormatIndex Index to format record
*/
function setNumberFormatIndex($numberFormatIndex)
{
$this->_numberFormatIndex = $numberFormatIndex;
}
/**
* Set the font index.
*
* @param int $value Font index, note that value 4 does not exist
*/
public function setFontIndex($value)
{
$this->_fontIndex = $value;
}
/**
* Map of BIFF2-BIFF8 codes for border styles
* @static array of int
*
*/
private static $_mapBorderStyle = array ( PHPExcel_Style_Border::BORDER_NONE => 0x00,
PHPExcel_Style_Border::BORDER_THIN => 0x01,
PHPExcel_Style_Border::BORDER_MEDIUM => 0x02,
PHPExcel_Style_Border::BORDER_DASHED => 0x03,
PHPExcel_Style_Border::BORDER_DOTTED => 0x04,
PHPExcel_Style_Border::BORDER_THICK => 0x05,
PHPExcel_Style_Border::BORDER_DOUBLE => 0x06,
PHPExcel_Style_Border::BORDER_HAIR => 0x07,
PHPExcel_Style_Border::BORDER_MEDIUMDASHED => 0x08,
PHPExcel_Style_Border::BORDER_DASHDOT => 0x09,
PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT => 0x0A,
PHPExcel_Style_Border::BORDER_DASHDOTDOT => 0x0B,
PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT => 0x0C,
PHPExcel_Style_Border::BORDER_SLANTDASHDOT => 0x0D,
);
/**
* Map border style
*
* @param string $borderStyle
* @return int
*/
private static function _mapBorderStyle($borderStyle) {
if (isset(self::$_mapBorderStyle[$borderStyle]))
return self::$_mapBorderStyle[$borderStyle];
return 0x00;
}
/**
* Map of BIFF2-BIFF8 codes for fill types
* @static array of int
*
*/
private static $_mapFillType = array( PHPExcel_Style_Fill::FILL_NONE => 0x00,
PHPExcel_Style_Fill::FILL_SOLID => 0x01,
PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY => 0x02,
PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY => 0x03,
PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY => 0x04,
PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL => 0x05,
PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL => 0x06,
PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN => 0x07,
PHPExcel_Style_Fill::FILL_PATTERN_DARKUP => 0x08,
PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID => 0x09,
PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS => 0x0A,
PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL => 0x0B,
PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL => 0x0C,
PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN => 0x0D,
PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP => 0x0E,
PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID => 0x0F,
PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS => 0x10,
PHPExcel_Style_Fill::FILL_PATTERN_GRAY125 => 0x11,
PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625 => 0x12,
PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR => 0x00, // does not exist in BIFF8
PHPExcel_Style_Fill::FILL_GRADIENT_PATH => 0x00, // does not exist in BIFF8
);
/**
* Map fill type
*
* @param string $fillType
* @return int
*/
private static function _mapFillType($fillType) {
if (isset(self::$_mapFillType[$fillType]))
return self::$_mapFillType[$fillType];
return 0x00;
}
/**
* Map of BIFF2-BIFF8 codes for horizontal alignment
* @static array of int
*
*/
private static $_mapHAlign = array( PHPExcel_Style_Alignment::HORIZONTAL_GENERAL => 0,
PHPExcel_Style_Alignment::HORIZONTAL_LEFT => 1,
PHPExcel_Style_Alignment::HORIZONTAL_CENTER => 2,
PHPExcel_Style_Alignment::HORIZONTAL_RIGHT => 3,
PHPExcel_Style_Alignment::HORIZONTAL_FILL => 4,
PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY => 5,
PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS => 6,
);
/**
* Map to BIFF2-BIFF8 codes for horizontal alignment
*
* @param string $hAlign
* @return int
*/
private function _mapHAlign($hAlign)
{
if (isset(self::$_mapHAlign[$hAlign]))
return self::$_mapHAlign[$hAlign];
return 0;
}
/**
* Map of BIFF2-BIFF8 codes for vertical alignment
* @static array of int
*
*/
private static $_mapVAlign = array( PHPExcel_Style_Alignment::VERTICAL_TOP => 0,
PHPExcel_Style_Alignment::VERTICAL_CENTER => 1,
PHPExcel_Style_Alignment::VERTICAL_BOTTOM => 2,
PHPExcel_Style_Alignment::VERTICAL_JUSTIFY => 3,
);
/**
* Map to BIFF2-BIFF8 codes for vertical alignment
*
* @param string $vAlign
* @return int
*/
private static function _mapVAlign($vAlign) {
if (isset(self::$_mapVAlign[$vAlign]))
return self::$_mapVAlign[$vAlign];
return 2;
}
/**
* Map to BIFF8 codes for text rotation angle
*
* @param int $textRotation
* @return int
*/
private static function _mapTextRotation($textRotation) {
if ($textRotation >= 0) {
return $textRotation;
}
if ($textRotation == -165) {
return 255;
}
if ($textRotation < 0) {
return 90 - $textRotation;
}
}
/**
* Map locked
*
* @param string
* @return int
*/
private static function _mapLocked($locked) {
switch ($locked) {
case PHPExcel_Style_Protection::PROTECTION_INHERIT: return 1;
case PHPExcel_Style_Protection::PROTECTION_PROTECTED: return 1;
case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: return 0;
default: return 1;
}
}
/**
* Map hidden
*
* @param string
* @return int
*/
private static function _mapHidden($hidden) {
switch ($hidden) {
case PHPExcel_Style_Protection::PROTECTION_INHERIT: return 0;
case PHPExcel_Style_Protection::PROTECTION_PROTECTED: return 1;
case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: return 0;
default: return 0;
}
}
}
PK ! ) ) # PHPExcel/Writer/Excel5/Workbook.phpnu [
// *
// * The majority of this is _NOT_ my code. I simply ported it from the
// * PERL Spreadsheet::WriteExcel module.
// *
// * The author of the Spreadsheet::WriteExcel module is John McNamara
// *
// *
// * I _DO_ maintain this code, and John McNamara has nothing to do with the
// * porting of this code to PHP. Any questions directly related to this
// * class library should be directed to me.
// *
// * License Information:
// *
// * Spreadsheet_Excel_Writer: A library for generating Excel Spreadsheets
// * Copyright (c) 2002-2003 Xavier Noguer xnoguer@rezebra.com
// *
// * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// */
/**
* PHPExcel_Writer_Excel5_Workbook
*
* @category PHPExcel
* @package PHPExcel_Writer_Excel5
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
{
/**
* Formula parser
*
* @var PHPExcel_Writer_Excel5_Parser
*/
private $_parser;
/**
* The BIFF file size for the workbook.
* @var integer
* @see _calcSheetOffsets()
*/
public $_biffsize;
/**
* XF Writers
* @var PHPExcel_Writer_Excel5_Xf[]
*/
private $_xfWriters = array();
/**
* Array containing the colour palette
* @var array
*/
public $_palette;
/**
* The codepage indicates the text encoding used for strings
* @var integer
*/
public $_codepage;
/**
* The country code used for localization
* @var integer
*/
public $_country_code;
/**
* Workbook
* @var PHPExcel
*/
private $_phpExcel;
/**
* Fonts writers
*
* @var PHPExcel_Writer_Excel5_Font[]
*/
private $_fontWriters = array();
/**
* Added fonts. Maps from font's hash => index in workbook
*
* @var array
*/
private $_addedFonts = array();
/**
* Shared number formats
*
* @var array
*/
private $_numberFormats = array();
/**
* Added number formats. Maps from numberFormat's hash => index in workbook
*
* @var array
*/
private $_addedNumberFormats = array();
/**
* Sizes of the binary worksheet streams
*
* @var array
*/
private $_worksheetSizes = array();
/**
* Offsets of the binary worksheet streams relative to the start of the global workbook stream
*
* @var array
*/
private $_worksheetOffsets = array();
/**
* Total number of shared strings in workbook
*
* @var int
*/
private $_str_total;
/**
* Number of unique shared strings in workbook
*
* @var int
*/
private $_str_unique;
/**
* Array of unique shared strings in workbook
*
* @var array
*/
private $_str_table;
/**
* Color cache
*/
private $_colors;
/**
* Escher object corresponding to MSODRAWINGGROUP
*
* @var PHPExcel_Shared_Escher
*/
private $_escher;
/**
* Class constructor
*
* @param PHPExcel $phpExcel The Workbook
* @param int &$str_total Total number of strings
* @param int &$str_unique Total number of unique strings
* @param array &$str_table String Table
* @param array &$colors Colour Table
* @param mixed $parser The formula parser created for the Workbook
*/
public function __construct(PHPExcel $phpExcel = null,
&$str_total, &$str_unique, &$str_table, &$colors,
$parser )
{
// It needs to call its parent's constructor explicitly
parent::__construct();
$this->_parser = $parser;
$this->_biffsize = 0;
$this->_palette = array();
$this->_country_code = -1;
$this->_str_total = &$str_total;
$this->_str_unique = &$str_unique;
$this->_str_table = &$str_table;
$this->_colors = &$colors;
$this->_setPaletteXl97();
$this->_phpExcel = $phpExcel;
// set BIFFwriter limit for CONTINUE records
// $this->_limit = 8224;
$this->_codepage = 0x04B0;
// Add empty sheets and Build color cache
$countSheets = $phpExcel->getSheetCount();
for ($i = 0; $i < $countSheets; ++$i) {
$phpSheet = $phpExcel->getSheet($i);
$this->_parser->setExtSheet($phpSheet->getTitle(), $i); // Register worksheet name with parser
$supbook_index = 0x00;
$ref = pack('vvv', $supbook_index, $i, $i);
$this->_parser->_references[] = $ref; // Register reference with parser
// Sheet tab colors?
if ($phpSheet->isTabColorSet()) {
$this->_addColor($phpSheet->getTabColor()->getRGB());
}
}
}
/**
* Add a new XF writer
*
* @param PHPExcel_Style
* @param boolean Is it a style XF?
* @return int Index to XF record
*/
public function addXfWriter($style, $isStyleXf = false)
{
$xfWriter = new PHPExcel_Writer_Excel5_Xf($style);
$xfWriter->setIsStyleXf($isStyleXf);
// Add the font if not already added
$fontIndex = $this->_addFont($style->getFont());
// Assign the font index to the xf record
$xfWriter->setFontIndex($fontIndex);
// Background colors, best to treat these after the font so black will come after white in custom palette
$xfWriter->setFgColor($this->_addColor($style->getFill()->getStartColor()->getRGB()));
$xfWriter->setBgColor($this->_addColor($style->getFill()->getEndColor()->getRGB()));
$xfWriter->setBottomColor($this->_addColor($style->getBorders()->getBottom()->getColor()->getRGB()));
$xfWriter->setTopColor($this->_addColor($style->getBorders()->getTop()->getColor()->getRGB()));
$xfWriter->setRightColor($this->_addColor($style->getBorders()->getRight()->getColor()->getRGB()));
$xfWriter->setLeftColor($this->_addColor($style->getBorders()->getLeft()->getColor()->getRGB()));
$xfWriter->setDiagColor($this->_addColor($style->getBorders()->getDiagonal()->getColor()->getRGB()));
// Add the number format if it is not a built-in one and not already added
if ($style->getNumberFormat()->getBuiltInFormatCode() === false) {
$numberFormatHashCode = $style->getNumberFormat()->getHashCode();
if (isset($this->_addedNumberFormats[$numberFormatHashCode])) {
$numberFormatIndex = $this->_addedNumberFormats[$numberFormatHashCode];
} else {
$numberFormatIndex = 164 + count($this->_numberFormats);
$this->_numberFormats[$numberFormatIndex] = $style->getNumberFormat();
$this->_addedNumberFormats[$numberFormatHashCode] = $numberFormatIndex;
}
} else {
$numberFormatIndex = (int) $style->getNumberFormat()->getBuiltInFormatCode();
}
// Assign the number format index to xf record
$xfWriter->setNumberFormatIndex($numberFormatIndex);
$this->_xfWriters[] = $xfWriter;
$xfIndex = count($this->_xfWriters) - 1;
return $xfIndex;
}
/**
* Add a font to added fonts
*
* @param PHPExcel_Style_Font $font
* @return int Index to FONT record
*/
public function _addFont(PHPExcel_Style_Font $font)
{
$fontHashCode = $font->getHashCode();
if(isset($this->_addedFonts[$fontHashCode])){
$fontIndex = $this->_addedFonts[$fontHashCode];
} else {
$countFonts = count($this->_fontWriters);
$fontIndex = ($countFonts < 4) ? $countFonts : $countFonts + 1;
$fontWriter = new PHPExcel_Writer_Excel5_Font($font);
$fontWriter->setColorIndex($this->_addColor($font->getColor()->getRGB()));
$this->_fontWriters[] = $fontWriter;
$this->_addedFonts[$fontHashCode] = $fontIndex;
}
return $fontIndex;
}
/**
* Alter color palette adding a custom color
*
* @param string $rgb E.g. 'FF00AA'
* @return int Color index
*/
private function _addColor($rgb) {
if (!isset($this->_colors[$rgb])) {
if (count($this->_colors) < 57) {
// then we add a custom color altering the palette
$colorIndex = 8 + count($this->_colors);
$this->_palette[$colorIndex] =
array(
hexdec(substr($rgb, 0, 2)),
hexdec(substr($rgb, 2, 2)),
hexdec(substr($rgb, 4)),
0
);
$this->_colors[$rgb] = $colorIndex;
} else {
// no room for more custom colors, just map to black
$colorIndex = 0;
}
} else {
// fetch already added custom color
$colorIndex = $this->_colors[$rgb];
}
return $colorIndex;
}
/**
* Sets the colour palette to the Excel 97+ default.
*
* @access private
*/
function _setPaletteXl97()
{
$this->_palette = array(
0x08 => array(0x00, 0x00, 0x00, 0x00),
0x09 => array(0xff, 0xff, 0xff, 0x00),
0x0A => array(0xff, 0x00, 0x00, 0x00),
0x0B => array(0x00, 0xff, 0x00, 0x00),
0x0C => array(0x00, 0x00, 0xff, 0x00),
0x0D => array(0xff, 0xff, 0x00, 0x00),
0x0E => array(0xff, 0x00, 0xff, 0x00),
0x0F => array(0x00, 0xff, 0xff, 0x00),
0x10 => array(0x80, 0x00, 0x00, 0x00),
0x11 => array(0x00, 0x80, 0x00, 0x00),
0x12 => array(0x00, 0x00, 0x80, 0x00),
0x13 => array(0x80, 0x80, 0x00, 0x00),
0x14 => array(0x80, 0x00, 0x80, 0x00),
0x15 => array(0x00, 0x80, 0x80, 0x00),
0x16 => array(0xc0, 0xc0, 0xc0, 0x00),
0x17 => array(0x80, 0x80, 0x80, 0x00),
0x18 => array(0x99, 0x99, 0xff, 0x00),
0x19 => array(0x99, 0x33, 0x66, 0x00),
0x1A => array(0xff, 0xff, 0xcc, 0x00),
0x1B => array(0xcc, 0xff, 0xff, 0x00),
0x1C => array(0x66, 0x00, 0x66, 0x00),
0x1D => array(0xff, 0x80, 0x80, 0x00),
0x1E => array(0x00, 0x66, 0xcc, 0x00),
0x1F => array(0xcc, 0xcc, 0xff, 0x00),
0x20 => array(0x00, 0x00, 0x80, 0x00),
0x21 => array(0xff, 0x00, 0xff, 0x00),
0x22 => array(0xff, 0xff, 0x00, 0x00),
0x23 => array(0x00, 0xff, 0xff, 0x00),
0x24 => array(0x80, 0x00, 0x80, 0x00),
0x25 => array(0x80, 0x00, 0x00, 0x00),
0x26 => array(0x00, 0x80, 0x80, 0x00),
0x27 => array(0x00, 0x00, 0xff, 0x00),
0x28 => array(0x00, 0xcc, 0xff, 0x00),
0x29 => array(0xcc, 0xff, 0xff, 0x00),
0x2A => array(0xcc, 0xff, 0xcc, 0x00),
0x2B => array(0xff, 0xff, 0x99, 0x00),
0x2C => array(0x99, 0xcc, 0xff, 0x00),
0x2D => array(0xff, 0x99, 0xcc, 0x00),
0x2E => array(0xcc, 0x99, 0xff, 0x00),
0x2F => array(0xff, 0xcc, 0x99, 0x00),
0x30 => array(0x33, 0x66, 0xff, 0x00),
0x31 => array(0x33, 0xcc, 0xcc, 0x00),
0x32 => array(0x99, 0xcc, 0x00, 0x00),
0x33 => array(0xff, 0xcc, 0x00, 0x00),
0x34 => array(0xff, 0x99, 0x00, 0x00),
0x35 => array(0xff, 0x66, 0x00, 0x00),
0x36 => array(0x66, 0x66, 0x99, 0x00),
0x37 => array(0x96, 0x96, 0x96, 0x00),
0x38 => array(0x00, 0x33, 0x66, 0x00),
0x39 => array(0x33, 0x99, 0x66, 0x00),
0x3A => array(0x00, 0x33, 0x00, 0x00),
0x3B => array(0x33, 0x33, 0x00, 0x00),
0x3C => array(0x99, 0x33, 0x00, 0x00),
0x3D => array(0x99, 0x33, 0x66, 0x00),
0x3E => array(0x33, 0x33, 0x99, 0x00),
0x3F => array(0x33, 0x33, 0x33, 0x00),
);
}
/**
* Assemble worksheets into a workbook and send the BIFF data to an OLE
* storage.
*
* @param array $pWorksheetSizes The sizes in bytes of the binary worksheet streams
* @return string Binary data for workbook stream
*/
public function writeWorkbook($pWorksheetSizes = null)
{
$this->_worksheetSizes = $pWorksheetSizes;
// Calculate the number of selected worksheet tabs and call the finalization
// methods for each worksheet
$total_worksheets = $this->_phpExcel->getSheetCount();
// Add part 1 of the Workbook globals, what goes before the SHEET records
$this->_storeBof(0x0005);
$this->_writeCodepage();
$this->_writeWindow1();
$this->_writeDatemode();
$this->_writeAllFonts();
$this->_writeAllNumFormats();
$this->_writeAllXfs();
$this->_writeAllStyles();
$this->_writePalette();
// Prepare part 3 of the workbook global stream, what goes after the SHEET records
$part3 = '';
if ($this->_country_code != -1) {
$part3 .= $this->_writeCountry();
}
$part3 .= $this->_writeRecalcId();
$part3 .= $this->_writeSupbookInternal();
/* TODO: store external SUPBOOK records and XCT and CRN records
in case of external references for BIFF8 */
$part3 .= $this->_writeExternsheetBiff8();
$part3 .= $this->_writeAllDefinedNamesBiff8();
$part3 .= $this->_writeMsoDrawingGroup();
$part3 .= $this->_writeSharedStringsTable();
$part3 .= $this->writeEof();
// Add part 2 of the Workbook globals, the SHEET records
$this->_calcSheetOffsets();
for ($i = 0; $i < $total_worksheets; ++$i) {
$this->_writeBoundsheet($this->_phpExcel->getSheet($i), $this->_worksheetOffsets[$i]);
}
// Add part 3 of the Workbook globals
$this->_data .= $part3;
return $this->_data;
}
/**
* Calculate offsets for Worksheet BOF records.
*
* @access private
*/
function _calcSheetOffsets()
{
$boundsheet_length = 10; // fixed length for a BOUNDSHEET record
// size of Workbook globals part 1 + 3
$offset = $this->_datasize;
// add size of Workbook globals part 2, the length of the SHEET records
$total_worksheets = count($this->_phpExcel->getAllSheets());
foreach ($this->_phpExcel->getWorksheetIterator() as $sheet) {
$offset += $boundsheet_length + strlen(PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($sheet->getTitle()));
}
// add the sizes of each of the Sheet substreams, respectively
for ($i = 0; $i < $total_worksheets; ++$i) {
$this->_worksheetOffsets[$i] = $offset;
$offset += $this->_worksheetSizes[$i];
}
$this->_biffsize = $offset;
}
/**
* Store the Excel FONT records.
*/
private function _writeAllFonts()
{
foreach ($this->_fontWriters as $fontWriter) {
$this->_append($fontWriter->writeFont());
}
}
/**
* Store user defined numerical formats i.e. FORMAT records
*/
private function _writeAllNumFormats()
{
foreach ($this->_numberFormats as $numberFormatIndex => $numberFormat) {
$this->_writeNumFormat($numberFormat->getFormatCode(), $numberFormatIndex);
}
}
/**
* Write all XF records.
*/
private function _writeAllXfs()
{
foreach ($this->_xfWriters as $xfWriter) {
$this->_append($xfWriter->writeXf());
}
}
/**
* Write all STYLE records.
*/
private function _writeAllStyles()
{
$this->_writeStyle();
}
/**
* Write the EXTERNCOUNT and EXTERNSHEET records. These are used as indexes for
* the NAME records.
*/
private function _writeExterns()
{
$countSheets = $this->_phpExcel->getSheetCount();
// Create EXTERNCOUNT with number of worksheets
$this->_writeExterncount($countSheets);
// Create EXTERNSHEET for each worksheet
for ($i = 0; $i < $countSheets; ++$i) {
$this->_writeExternsheet($this->_phpExcel->getSheet($i)->getTitle());
}
}
/**
* Write the NAME record to define the print area and the repeat rows and cols.
*/
private function _writeNames()
{
// total number of sheets
$total_worksheets = $this->_phpExcel->getSheetCount();
// Create the print area NAME records
for ($i = 0; $i < $total_worksheets; ++$i) {
$sheetSetup = $this->_phpExcel->getSheet($i)->getPageSetup();
// Write a Name record if the print area has been defined
if ($sheetSetup->isPrintAreaSet()) {
// Print area
$printArea = PHPExcel_Cell::splitRange($sheetSetup->getPrintArea());
$printArea = $printArea[0];
$printArea[0] = PHPExcel_Cell::coordinateFromString($printArea[0]);
$printArea[1] = PHPExcel_Cell::coordinateFromString($printArea[1]);
$print_rowmin = $printArea[0][1] - 1;
$print_rowmax = $printArea[1][1] - 1;
$print_colmin = PHPExcel_Cell::columnIndexFromString($printArea[0][0]) - 1;
$print_colmax = PHPExcel_Cell::columnIndexFromString($printArea[1][0]) - 1;
$this->_writeNameShort(
$i, // sheet index
0x06, // NAME type
$print_rowmin,
$print_rowmax,
$print_colmin,
$print_colmax
);
}
}
// Create the print title NAME records
for ($i = 0; $i < $total_worksheets; ++$i) {
$sheetSetup = $this->_phpExcel->getSheet($i)->getPageSetup();
// simultaneous repeatColumns repeatRows
if ($sheetSetup->isColumnsToRepeatAtLeftSet() && $sheetSetup->isRowsToRepeatAtTopSet()) {
$repeat = $sheetSetup->getColumnsToRepeatAtLeft();
$colmin = PHPExcel_Cell::columnIndexFromString($repeat[0]) - 1;
$colmax = PHPExcel_Cell::columnIndexFromString($repeat[1]) - 1;
$repeat = $sheetSetup->getRowsToRepeatAtTop();
$rowmin = $repeat[0] - 1;
$rowmax = $repeat[1] - 1;
$this->_writeNameLong(
$i, // sheet index
0x07, // NAME type
$rowmin,
$rowmax,
$colmin,
$colmax
);
// (exclusive) either repeatColumns or repeatRows
} else if ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
// Columns to repeat
if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
$repeat = $sheetSetup->getColumnsToRepeatAtLeft();
$colmin = PHPExcel_Cell::columnIndexFromString($repeat[0]) - 1;
$colmax = PHPExcel_Cell::columnIndexFromString($repeat[1]) - 1;
} else {
$colmin = 0;
$colmax = 255;
}
// Rows to repeat
if ($sheetSetup->isRowsToRepeatAtTopSet()) {
$repeat = $sheetSetup->getRowsToRepeatAtTop();
$rowmin = $repeat[0] - 1;
$rowmax = $repeat[1] - 1;
} else {
$rowmin = 0;
$rowmax = 65535;
}
$this->_writeNameShort(
$i, // sheet index
0x07, // NAME type
$rowmin,
$rowmax,
$colmin,
$colmax
);
}
}
}
/**
* Writes all the DEFINEDNAME records (BIFF8).
* So far this is only used for repeating rows/columns (print titles) and print areas
*/
private function _writeAllDefinedNamesBiff8()
{
$chunk = '';
// Named ranges
if (count($this->_phpExcel->getNamedRanges()) > 0) {
// Loop named ranges
$namedRanges = $this->_phpExcel->getNamedRanges();
foreach ($namedRanges as $namedRange) {
// Create absolute coordinate
$range = PHPExcel_Cell::splitRange($namedRange->getRange());
for ($i = 0; $i < count($range); $i++) {
$range[$i][0] = '\'' . str_replace("'", "''", $namedRange->getWorksheet()->getTitle()) . '\'!' . PHPExcel_Cell::absoluteCoordinate($range[$i][0]);
if (isset($range[$i][1])) {
$range[$i][1] = PHPExcel_Cell::absoluteCoordinate($range[$i][1]);
}
}
$range = PHPExcel_Cell::buildRange($range); // e.g. Sheet1!$A$1:$B$2
// parse formula
try {
$error = $this->_parser->parse($range);
$formulaData = $this->_parser->toReversePolish();
// make sure tRef3d is of type tRef3dR (0x3A)
if (isset($formulaData{0}) and ($formulaData{0} == "\x7A" or $formulaData{0} == "\x5A")) {
$formulaData = "\x3A" . substr($formulaData, 1);
}
if ($namedRange->getLocalOnly()) {
// local scope
$scope = $this->_phpExcel->getIndex($namedRange->getScope()) + 1;
} else {
// global scope
$scope = 0;
}
$chunk .= $this->writeData($this->_writeDefinedNameBiff8($namedRange->getName(), $formulaData, $scope, false));
} catch(PHPExcel_Exception $e) {
// do nothing
}
}
}
// total number of sheets
$total_worksheets = $this->_phpExcel->getSheetCount();
// write the print titles (repeating rows, columns), if any
for ($i = 0; $i < $total_worksheets; ++$i) {
$sheetSetup = $this->_phpExcel->getSheet($i)->getPageSetup();
// simultaneous repeatColumns repeatRows
if ($sheetSetup->isColumnsToRepeatAtLeftSet() && $sheetSetup->isRowsToRepeatAtTopSet()) {
$repeat = $sheetSetup->getColumnsToRepeatAtLeft();
$colmin = PHPExcel_Cell::columnIndexFromString($repeat[0]) - 1;
$colmax = PHPExcel_Cell::columnIndexFromString($repeat[1]) - 1;
$repeat = $sheetSetup->getRowsToRepeatAtTop();
$rowmin = $repeat[0] - 1;
$rowmax = $repeat[1] - 1;
// construct formula data manually
$formulaData = pack('Cv', 0x29, 0x17); // tMemFunc
$formulaData .= pack('Cvvvvv', 0x3B, $i, 0, 65535, $colmin, $colmax); // tArea3d
$formulaData .= pack('Cvvvvv', 0x3B, $i, $rowmin, $rowmax, 0, 255); // tArea3d
$formulaData .= pack('C', 0x10); // tList
// store the DEFINEDNAME record
$chunk .= $this->writeData($this->_writeDefinedNameBiff8(pack('C', 0x07), $formulaData, $i + 1, true));
// (exclusive) either repeatColumns or repeatRows
} else if ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
// Columns to repeat
if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
$repeat = $sheetSetup->getColumnsToRepeatAtLeft();
$colmin = PHPExcel_Cell::columnIndexFromString($repeat[0]) - 1;
$colmax = PHPExcel_Cell::columnIndexFromString($repeat[1]) - 1;
} else {
$colmin = 0;
$colmax = 255;
}
// Rows to repeat
if ($sheetSetup->isRowsToRepeatAtTopSet()) {
$repeat = $sheetSetup->getRowsToRepeatAtTop();
$rowmin = $repeat[0] - 1;
$rowmax = $repeat[1] - 1;
} else {
$rowmin = 0;
$rowmax = 65535;
}
// construct formula data manually because parser does not recognize absolute 3d cell references
$formulaData = pack('Cvvvvv', 0x3B, $i, $rowmin, $rowmax, $colmin, $colmax);
// store the DEFINEDNAME record
$chunk .= $this->writeData($this->_writeDefinedNameBiff8(pack('C', 0x07), $formulaData, $i + 1, true));
}
}
// write the print areas, if any
for ($i = 0; $i < $total_worksheets; ++$i) {
$sheetSetup = $this->_phpExcel->getSheet($i)->getPageSetup();
if ($sheetSetup->isPrintAreaSet()) {
// Print area, e.g. A3:J6,H1:X20
$printArea = PHPExcel_Cell::splitRange($sheetSetup->getPrintArea());
$countPrintArea = count($printArea);
$formulaData = '';
for ($j = 0; $j < $countPrintArea; ++$j) {
$printAreaRect = $printArea[$j]; // e.g. A3:J6
$printAreaRect[0] = PHPExcel_Cell::coordinateFromString($printAreaRect[0]);
$printAreaRect[1] = PHPExcel_Cell::coordinateFromString($printAreaRect[1]);
$print_rowmin = $printAreaRect[0][1] - 1;
$print_rowmax = $printAreaRect[1][1] - 1;
$print_colmin = PHPExcel_Cell::columnIndexFromString($printAreaRect[0][0]) - 1;
$print_colmax = PHPExcel_Cell::columnIndexFromString($printAreaRect[1][0]) - 1;
// construct formula data manually because parser does not recognize absolute 3d cell references
$formulaData .= pack('Cvvvvv', 0x3B, $i, $print_rowmin, $print_rowmax, $print_colmin, $print_colmax);
if ($j > 0) {
$formulaData .= pack('C', 0x10); // list operator token ','
}
}
// store the DEFINEDNAME record
$chunk .= $this->writeData($this->_writeDefinedNameBiff8(pack('C', 0x06), $formulaData, $i + 1, true));
}
}
// write autofilters, if any
for ($i = 0; $i < $total_worksheets; ++$i) {
$sheetAutoFilter = $this->_phpExcel->getSheet($i)->getAutoFilter();
$autoFilterRange = $sheetAutoFilter->getRange();
if(!empty($autoFilterRange)) {
$rangeBounds = PHPExcel_Cell::rangeBoundaries($autoFilterRange);
//Autofilter built in name
$name = pack('C', 0x0D);
$chunk .= $this->writeData($this->_writeShortNameBiff8($name, $i + 1, $rangeBounds, true));
}
}
return $chunk;
}
/**
* Write a DEFINEDNAME record for BIFF8 using explicit binary formula data
*
* @param string $name The name in UTF-8
* @param string $formulaData The binary formula data
* @param string $sheetIndex 1-based sheet index the defined name applies to. 0 = global
* @param boolean $isBuiltIn Built-in name?
* @return string Complete binary record data
*/
private function _writeDefinedNameBiff8($name, $formulaData, $sheetIndex = 0, $isBuiltIn = false)
{
$record = 0x0018;
// option flags
$options = $isBuiltIn ? 0x20 : 0x00;
// length of the name, character count
$nlen = PHPExcel_Shared_String::CountCharacters($name);
// name with stripped length field
$name = substr(PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($name), 2);
// size of the formula (in bytes)
$sz = strlen($formulaData);
// combine the parts
$data = pack('vCCvvvCCCC', $options, 0, $nlen, $sz, 0, $sheetIndex, 0, 0, 0, 0)
. $name . $formulaData;
$length = strlen($data);
$header = pack('vv', $record, $length);
return $header . $data;
}
/**
* Write a short NAME record
*
* @param string $name
* @param string $sheetIndex 1-based sheet index the defined name applies to. 0 = global
* @param integer[][] $rangeBounds range boundaries
* @param boolean $isHidden
* @return string Complete binary record data
* */
private function _writeShortNameBiff8($name, $sheetIndex = 0, $rangeBounds, $isHidden = false){
$record = 0x0018;
// option flags
$options = ($isHidden ? 0x21 : 0x00);
$extra = pack('Cvvvvv',
0x3B,
$sheetIndex - 1,
$rangeBounds[0][1] - 1,
$rangeBounds[1][1] - 1,
$rangeBounds[0][0] - 1,
$rangeBounds[1][0] - 1);
// size of the formula (in bytes)
$sz = strlen($extra);
// combine the parts
$data = pack('vCCvvvCCCCC', $options, 0, 1, $sz, 0, $sheetIndex, 0, 0, 0, 0, 0)
. $name . $extra;
$length = strlen($data);
$header = pack('vv', $record, $length);
return $header . $data;
}
/**
* Stores the CODEPAGE biff record.
*/
private function _writeCodepage()
{
$record = 0x0042; // Record identifier
$length = 0x0002; // Number of bytes to follow
$cv = $this->_codepage; // The code page
$header = pack('vv', $record, $length);
$data = pack('v', $cv);
$this->_append($header . $data);
}
/**
* Write Excel BIFF WINDOW1 record.
*/
private function _writeWindow1()
{
$record = 0x003D; // Record identifier
$length = 0x0012; // Number of bytes to follow
$xWn = 0x0000; // Horizontal position of window
$yWn = 0x0000; // Vertical position of window
$dxWn = 0x25BC; // Width of window
$dyWn = 0x1572; // Height of window
$grbit = 0x0038; // Option flags
// not supported by PHPExcel, so there is only one selected sheet, the active
$ctabsel = 1; // Number of workbook tabs selected
$wTabRatio = 0x0258; // Tab to scrollbar ratio
// not supported by PHPExcel, set to 0
$itabFirst = 0; // 1st displayed worksheet
$itabCur = $this->_phpExcel->getActiveSheetIndex(); // Active worksheet
$header = pack("vv", $record, $length);
$data = pack("vvvvvvvvv", $xWn, $yWn, $dxWn, $dyWn,
$grbit,
$itabCur, $itabFirst,
$ctabsel, $wTabRatio);
$this->_append($header . $data);
}
/**
* Writes Excel BIFF BOUNDSHEET record.
*
* @param PHPExcel_Worksheet $sheet Worksheet name
* @param integer $offset Location of worksheet BOF
*/
private function _writeBoundsheet($sheet, $offset)
{
$sheetname = $sheet->getTitle();
$record = 0x0085; // Record identifier
// sheet state
switch ($sheet->getSheetState()) {
case PHPExcel_Worksheet::SHEETSTATE_VISIBLE: $ss = 0x00; break;
case PHPExcel_Worksheet::SHEETSTATE_HIDDEN: $ss = 0x01; break;
case PHPExcel_Worksheet::SHEETSTATE_VERYHIDDEN: $ss = 0x02; break;
default: $ss = 0x00; break;
}
// sheet type
$st = 0x00;
$grbit = 0x0000; // Visibility and sheet type
$data = pack("VCC", $offset, $ss, $st);
$data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($sheetname);
$length = strlen($data);
$header = pack("vv", $record, $length);
$this->_append($header . $data);
}
/**
* Write Internal SUPBOOK record
*/
private function _writeSupbookInternal()
{
$record = 0x01AE; // Record identifier
$length = 0x0004; // Bytes to follow
$header = pack("vv", $record, $length);
$data = pack("vv", $this->_phpExcel->getSheetCount(), 0x0401);
return $this->writeData($header . $data);
}
/**
* Writes the Excel BIFF EXTERNSHEET record. These references are used by
* formulas.
*
*/
private function _writeExternsheetBiff8()
{
$total_references = count($this->_parser->_references);
$record = 0x0017; // Record identifier
$length = 2 + 6 * $total_references; // Number of bytes to follow
$supbook_index = 0; // FIXME: only using internal SUPBOOK record
$header = pack("vv", $record, $length);
$data = pack('v', $total_references);
for ($i = 0; $i < $total_references; ++$i) {
$data .= $this->_parser->_references[$i];
}
return $this->writeData($header . $data);
}
/**
* Write Excel BIFF STYLE records.
*/
private function _writeStyle()
{
$record = 0x0293; // Record identifier
$length = 0x0004; // Bytes to follow
$ixfe = 0x8000; // Index to cell style XF
$BuiltIn = 0x00; // Built-in style
$iLevel = 0xff; // Outline style level
$header = pack("vv", $record, $length);
$data = pack("vCC", $ixfe, $BuiltIn, $iLevel);
$this->_append($header . $data);
}
/**
* Writes Excel FORMAT record for non "built-in" numerical formats.
*
* @param string $format Custom format string
* @param integer $ifmt Format index code
*/
private function _writeNumFormat($format, $ifmt)
{
$record = 0x041E; // Record identifier
$numberFormatString = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($format);
$length = 2 + strlen($numberFormatString); // Number of bytes to follow
$header = pack("vv", $record, $length);
$data = pack("v", $ifmt) . $numberFormatString;
$this->_append($header . $data);
}
/**
* Write DATEMODE record to indicate the date system in use (1904 or 1900).
*/
private function _writeDatemode()
{
$record = 0x0022; // Record identifier
$length = 0x0002; // Bytes to follow
$f1904 = (PHPExcel_Shared_Date::getExcelCalendar() == PHPExcel_Shared_Date::CALENDAR_MAC_1904) ?
1 : 0; // Flag for 1904 date system
$header = pack("vv", $record, $length);
$data = pack("v", $f1904);
$this->_append($header . $data);
}
/**
* Write BIFF record EXTERNCOUNT to indicate the number of external sheet
* references in the workbook.
*
* Excel only stores references to external sheets that are used in NAME.
* The workbook NAME record is required to define the print area and the repeat
* rows and columns.
*
* A similar method is used in Worksheet.php for a slightly different purpose.
*
* @param integer $cxals Number of external references
*/
private function _writeExterncount($cxals)
{
$record = 0x0016; // Record identifier
$length = 0x0002; // Number of bytes to follow
$header = pack("vv", $record, $length);
$data = pack("v", $cxals);
$this->_append($header . $data);
}
/**
* Writes the Excel BIFF EXTERNSHEET record. These references are used by
* formulas. NAME record is required to define the print area and the repeat
* rows and columns.
*
* A similar method is used in Worksheet.php for a slightly different purpose.
*
* @param string $sheetname Worksheet name
*/
private function _writeExternsheet($sheetname)
{
$record = 0x0017; // Record identifier
$length = 0x02 + strlen($sheetname); // Number of bytes to follow
$cch = strlen($sheetname); // Length of sheet name
$rgch = 0x03; // Filename encoding
$header = pack("vv", $record, $length);
$data = pack("CC", $cch, $rgch);
$this->_append($header . $data . $sheetname);
}
/**
* Store the NAME record in the short format that is used for storing the print
* area, repeat rows only and repeat columns only.
*
* @param integer $index Sheet index
* @param integer $type Built-in name type
* @param integer $rowmin Start row
* @param integer $rowmax End row
* @param integer $colmin Start colum
* @param integer $colmax End column
*/
private function _writeNameShort($index, $type, $rowmin, $rowmax, $colmin, $colmax)
{
$record = 0x0018; // Record identifier
$length = 0x0024; // Number of bytes to follow
$grbit = 0x0020; // Option flags
$chKey = 0x00; // Keyboard shortcut
$cch = 0x01; // Length of text name
$cce = 0x0015; // Length of text definition
$ixals = $index + 1; // Sheet index
$itab = $ixals; // Equal to ixals
$cchCustMenu = 0x00; // Length of cust menu text
$cchDescription = 0x00; // Length of description text
$cchHelptopic = 0x00; // Length of help topic text
$cchStatustext = 0x00; // Length of status bar text
$rgch = $type; // Built-in name type
$unknown03 = 0x3b;
$unknown04 = 0xffff-$index;
$unknown05 = 0x0000;
$unknown06 = 0x0000;
$unknown07 = 0x1087;
$unknown08 = 0x8005;
$header = pack("vv", $record, $length);
$data = pack("v", $grbit);
$data .= pack("C", $chKey);
$data .= pack("C", $cch);
$data .= pack("v", $cce);
$data .= pack("v", $ixals);
$data .= pack("v", $itab);
$data .= pack("C", $cchCustMenu);
$data .= pack("C", $cchDescription);
$data .= pack("C", $cchHelptopic);
$data .= pack("C", $cchStatustext);
$data .= pack("C", $rgch);
$data .= pack("C", $unknown03);
$data .= pack("v", $unknown04);
$data .= pack("v", $unknown05);
$data .= pack("v", $unknown06);
$data .= pack("v", $unknown07);
$data .= pack("v", $unknown08);
$data .= pack("v", $index);
$data .= pack("v", $index);
$data .= pack("v", $rowmin);
$data .= pack("v", $rowmax);
$data .= pack("C", $colmin);
$data .= pack("C", $colmax);
$this->_append($header . $data);
}
/**
* Store the NAME record in the long format that is used for storing the repeat
* rows and columns when both are specified. This shares a lot of code with
* _writeNameShort() but we use a separate method to keep the code clean.
* Code abstraction for reuse can be carried too far, and I should know. ;-)
*
* @param integer $index Sheet index
* @param integer $type Built-in name type
* @param integer $rowmin Start row
* @param integer $rowmax End row
* @param integer $colmin Start colum
* @param integer $colmax End column
*/
private function _writeNameLong($index, $type, $rowmin, $rowmax, $colmin, $colmax)
{
$record = 0x0018; // Record identifier
$length = 0x003d; // Number of bytes to follow
$grbit = 0x0020; // Option flags
$chKey = 0x00; // Keyboard shortcut
$cch = 0x01; // Length of text name
$cce = 0x002e; // Length of text definition
$ixals = $index + 1; // Sheet index
$itab = $ixals; // Equal to ixals
$cchCustMenu = 0x00; // Length of cust menu text
$cchDescription = 0x00; // Length of description text
$cchHelptopic = 0x00; // Length of help topic text
$cchStatustext = 0x00; // Length of status bar text
$rgch = $type; // Built-in name type
$unknown01 = 0x29;
$unknown02 = 0x002b;
$unknown03 = 0x3b;
$unknown04 = 0xffff-$index;
$unknown05 = 0x0000;
$unknown06 = 0x0000;
$unknown07 = 0x1087;
$unknown08 = 0x8008;
$header = pack("vv", $record, $length);
$data = pack("v", $grbit);
$data .= pack("C", $chKey);
$data .= pack("C", $cch);
$data .= pack("v", $cce);
$data .= pack("v", $ixals);
$data .= pack("v", $itab);
$data .= pack("C", $cchCustMenu);
$data .= pack("C", $cchDescription);
$data .= pack("C", $cchHelptopic);
$data .= pack("C", $cchStatustext);
$data .= pack("C", $rgch);
$data .= pack("C", $unknown01);
$data .= pack("v", $unknown02);
// Column definition
$data .= pack("C", $unknown03);
$data .= pack("v", $unknown04);
$data .= pack("v", $unknown05);
$data .= pack("v", $unknown06);
$data .= pack("v", $unknown07);
$data .= pack("v", $unknown08);
$data .= pack("v", $index);
$data .= pack("v", $index);
$data .= pack("v", 0x0000);
$data .= pack("v", 0x3fff);
$data .= pack("C", $colmin);
$data .= pack("C", $colmax);
// Row definition
$data .= pack("C", $unknown03);
$data .= pack("v", $unknown04);
$data .= pack("v", $unknown05);
$data .= pack("v", $unknown06);
$data .= pack("v", $unknown07);
$data .= pack("v", $unknown08);
$data .= pack("v", $index);
$data .= pack("v", $index);
$data .= pack("v", $rowmin);
$data .= pack("v", $rowmax);
$data .= pack("C", 0x00);
$data .= pack("C", 0xff);
// End of data
$data .= pack("C", 0x10);
$this->_append($header . $data);
}
/**
* Stores the COUNTRY record for localization
*
* @return string
*/
private function _writeCountry()
{
$record = 0x008C; // Record identifier
$length = 4; // Number of bytes to follow
$header = pack('vv', $record, $length);
/* using the same country code always for simplicity */
$data = pack('vv', $this->_country_code, $this->_country_code);
//$this->_append($header . $data);
return $this->writeData($header . $data);
}
/**
* Write the RECALCID record
*
* @return string
*/
private function _writeRecalcId()
{
$record = 0x01C1; // Record identifier
$length = 8; // Number of bytes to follow
$header = pack('vv', $record, $length);
// by inspection of real Excel files, MS Office Excel 2007 writes this
$data = pack('VV', 0x000001C1, 0x00001E667);
return $this->writeData($header . $data);
}
/**
* Stores the PALETTE biff record.
*/
private function _writePalette()
{
$aref = $this->_palette;
$record = 0x0092; // Record identifier
$length = 2 + 4 * count($aref); // Number of bytes to follow
$ccv = count($aref); // Number of RGB values to follow
$data = ''; // The RGB data
// Pack the RGB data
foreach ($aref as $color) {
foreach ($color as $byte) {
$data .= pack("C",$byte);
}
}
$header = pack("vvv", $record, $length, $ccv);
$this->_append($header . $data);
}
/**
* Handling of the SST continue blocks is complicated by the need to include an
* additional continuation byte depending on whether the string is split between
* blocks or whether it starts at the beginning of the block. (There are also
* additional complications that will arise later when/if Rich Strings are
* supported).
*
* The Excel documentation says that the SST record should be followed by an
* EXTSST record. The EXTSST record is a hash table that is used to optimise
* access to SST. However, despite the documentation it doesn't seem to be
* required so we will ignore it.
*
* @return string Binary data
*/
private function _writeSharedStringsTable()
{
// maximum size of record data (excluding record header)
$continue_limit = 8224;
// initialize array of record data blocks
$recordDatas = array();
// start SST record data block with total number of strings, total number of unique strings
$recordData = pack("VV", $this->_str_total, $this->_str_unique);
// loop through all (unique) strings in shared strings table
foreach (array_keys($this->_str_table) as $string) {
// here $string is a BIFF8 encoded string
// length = character count
$headerinfo = unpack("vlength/Cencoding", $string);
// currently, this is always 1 = uncompressed
$encoding = $headerinfo["encoding"];
// initialize finished writing current $string
$finished = false;
while ($finished === false) {
// normally, there will be only one cycle, but if string cannot immediately be written as is
// there will be need for more than one cylcle, if string longer than one record data block, there
// may be need for even more cycles
if (strlen($recordData) + strlen($string) <= $continue_limit) {
// then we can write the string (or remainder of string) without any problems
$recordData .= $string;
if (strlen($recordData) + strlen($string) == $continue_limit) {
// we close the record data block, and initialize a new one
$recordDatas[] = $recordData;
$recordData = '';
}
// we are finished writing this string
$finished = true;
} else {
// special treatment writing the string (or remainder of the string)
// If the string is very long it may need to be written in more than one CONTINUE record.
// check how many bytes more there is room for in the current record
$space_remaining = $continue_limit - strlen($recordData);
// minimum space needed
// uncompressed: 2 byte string length length field + 1 byte option flags + 2 byte character
// compressed: 2 byte string length length field + 1 byte option flags + 1 byte character
$min_space_needed = ($encoding == 1) ? 5 : 4;
// We have two cases
// 1. space remaining is less than minimum space needed
// here we must waste the space remaining and move to next record data block
// 2. space remaining is greater than or equal to minimum space needed
// here we write as much as we can in the current block, then move to next record data block
// 1. space remaining is less than minimum space needed
if ($space_remaining < $min_space_needed) {
// we close the block, store the block data
$recordDatas[] = $recordData;
// and start new record data block where we start writing the string
$recordData = '';
// 2. space remaining is greater than or equal to minimum space needed
} else {
// initialize effective remaining space, for Unicode strings this may need to be reduced by 1, see below
$effective_space_remaining = $space_remaining;
// for uncompressed strings, sometimes effective space remaining is reduced by 1
if ( $encoding == 1 && (strlen($string) - $space_remaining) % 2 == 1 ) {
--$effective_space_remaining;
}
// one block fininshed, store the block data
$recordData .= substr($string, 0, $effective_space_remaining);
$string = substr($string, $effective_space_remaining); // for next cycle in while loop
$recordDatas[] = $recordData;
// start new record data block with the repeated option flags
$recordData = pack('C', $encoding);
}
}
}
}
// Store the last record data block unless it is empty
// if there was no need for any continue records, this will be the for SST record data block itself
if (strlen($recordData) > 0) {
$recordDatas[] = $recordData;
}
// combine into one chunk with all the blocks SST, CONTINUE,...
$chunk = '';
foreach ($recordDatas as $i => $recordData) {
// first block should have the SST record header, remaing should have CONTINUE header
$record = ($i == 0) ? 0x00FC : 0x003C;
$header = pack("vv", $record, strlen($recordData));
$data = $header . $recordData;
$chunk .= $this->writeData($data);
}
return $chunk;
}
/**
* Writes the MSODRAWINGGROUP record if needed. Possibly split using CONTINUE records.
*/
private function _writeMsoDrawingGroup()
{
// write the Escher stream if necessary
if (isset($this->_escher)) {
$writer = new PHPExcel_Writer_Excel5_Escher($this->_escher);
$data = $writer->close();
$record = 0x00EB;
$length = strlen($data);
$header = pack("vv", $record, $length);
return $this->writeData($header . $data);
} else {
return '';
}
}
/**
* Get Escher object
*
* @return PHPExcel_Shared_Escher
*/
public function getEscher()
{
return $this->_escher;
}
/**
* Set Escher object
*
* @param PHPExcel_Shared_Escher $pValue
*/
public function setEscher(PHPExcel_Shared_Escher $pValue = null)
{
$this->_escher = $pValue;
}
}
PK ! x ! PHPExcel/Writer/Excel5/Parser.phpnu [ =,;#()"{}
const REGEX_SHEET_TITLE_UNQUOTED = '[^\*\:\/\\\\\?\[\]\+\-\% \\\'\^\&\<\>\=\,\;\#\(\)\"\{\}]+';
// Sheet title in quoted form (without surrounding quotes)
// Invalid sheet title characters cannot occur in the sheet title:
// *:/\?[] (usual invalid sheet title characters)
// Single quote is represented as a pair ''
const REGEX_SHEET_TITLE_QUOTED = '(([^\*\:\/\\\\\?\[\]\\\'])+|(\\\'\\\')+)+';
/**
* The index of the character we are currently looking at
* @var integer
*/
public $_current_char;
/**
* The token we are working on.
* @var string
*/
public $_current_token;
/**
* The formula to parse
* @var string
*/
public $_formula;
/**
* The character ahead of the current char
* @var string
*/
public $_lookahead;
/**
* The parse tree to be generated
* @var string
*/
public $_parse_tree;
/**
* Array of external sheets
* @var array
*/
public $_ext_sheets;
/**
* Array of sheet references in the form of REF structures
* @var array
*/
public $_references;
/**
* The class constructor
*
*/
public function __construct()
{
$this->_current_char = 0;
$this->_current_token = ''; // The token we are working on.
$this->_formula = ''; // The formula to parse.
$this->_lookahead = ''; // The character ahead of the current char.
$this->_parse_tree = ''; // The parse tree to be generated.
$this->_initializeHashes(); // Initialize the hashes: ptg's and function's ptg's
$this->_ext_sheets = array();
$this->_references = array();
}
/**
* Initialize the ptg and function hashes.
*
* @access private
*/
function _initializeHashes()
{
// The Excel ptg indices
$this->ptg = array(
'ptgExp' => 0x01,
'ptgTbl' => 0x02,
'ptgAdd' => 0x03,
'ptgSub' => 0x04,
'ptgMul' => 0x05,
'ptgDiv' => 0x06,
'ptgPower' => 0x07,
'ptgConcat' => 0x08,
'ptgLT' => 0x09,
'ptgLE' => 0x0A,
'ptgEQ' => 0x0B,
'ptgGE' => 0x0C,
'ptgGT' => 0x0D,
'ptgNE' => 0x0E,
'ptgIsect' => 0x0F,
'ptgUnion' => 0x10,
'ptgRange' => 0x11,
'ptgUplus' => 0x12,
'ptgUminus' => 0x13,
'ptgPercent' => 0x14,
'ptgParen' => 0x15,
'ptgMissArg' => 0x16,
'ptgStr' => 0x17,
'ptgAttr' => 0x19,
'ptgSheet' => 0x1A,
'ptgEndSheet' => 0x1B,
'ptgErr' => 0x1C,
'ptgBool' => 0x1D,
'ptgInt' => 0x1E,
'ptgNum' => 0x1F,
'ptgArray' => 0x20,
'ptgFunc' => 0x21,
'ptgFuncVar' => 0x22,
'ptgName' => 0x23,
'ptgRef' => 0x24,
'ptgArea' => 0x25,
'ptgMemArea' => 0x26,
'ptgMemErr' => 0x27,
'ptgMemNoMem' => 0x28,
'ptgMemFunc' => 0x29,
'ptgRefErr' => 0x2A,
'ptgAreaErr' => 0x2B,
'ptgRefN' => 0x2C,
'ptgAreaN' => 0x2D,
'ptgMemAreaN' => 0x2E,
'ptgMemNoMemN' => 0x2F,
'ptgNameX' => 0x39,
'ptgRef3d' => 0x3A,
'ptgArea3d' => 0x3B,
'ptgRefErr3d' => 0x3C,
'ptgAreaErr3d' => 0x3D,
'ptgArrayV' => 0x40,
'ptgFuncV' => 0x41,
'ptgFuncVarV' => 0x42,
'ptgNameV' => 0x43,
'ptgRefV' => 0x44,
'ptgAreaV' => 0x45,
'ptgMemAreaV' => 0x46,
'ptgMemErrV' => 0x47,
'ptgMemNoMemV' => 0x48,
'ptgMemFuncV' => 0x49,
'ptgRefErrV' => 0x4A,
'ptgAreaErrV' => 0x4B,
'ptgRefNV' => 0x4C,
'ptgAreaNV' => 0x4D,
'ptgMemAreaNV' => 0x4E,
'ptgMemNoMemN' => 0x4F,
'ptgFuncCEV' => 0x58,
'ptgNameXV' => 0x59,
'ptgRef3dV' => 0x5A,
'ptgArea3dV' => 0x5B,
'ptgRefErr3dV' => 0x5C,
'ptgAreaErr3d' => 0x5D,
'ptgArrayA' => 0x60,
'ptgFuncA' => 0x61,
'ptgFuncVarA' => 0x62,
'ptgNameA' => 0x63,
'ptgRefA' => 0x64,
'ptgAreaA' => 0x65,
'ptgMemAreaA' => 0x66,
'ptgMemErrA' => 0x67,
'ptgMemNoMemA' => 0x68,
'ptgMemFuncA' => 0x69,
'ptgRefErrA' => 0x6A,
'ptgAreaErrA' => 0x6B,
'ptgRefNA' => 0x6C,
'ptgAreaNA' => 0x6D,
'ptgMemAreaNA' => 0x6E,
'ptgMemNoMemN' => 0x6F,
'ptgFuncCEA' => 0x78,
'ptgNameXA' => 0x79,
'ptgRef3dA' => 0x7A,
'ptgArea3dA' => 0x7B,
'ptgRefErr3dA' => 0x7C,
'ptgAreaErr3d' => 0x7D
);
// Thanks to Michael Meeks and Gnumeric for the initial arg values.
//
// The following hash was generated by "function_locale.pl" in the distro.
// Refer to function_locale.pl for non-English function names.
//
// The array elements are as follow:
// ptg: The Excel function ptg code.
// args: The number of arguments that the function takes:
// >=0 is a fixed number of arguments.
// -1 is a variable number of arguments.
// class: The reference, value or array class of the function args.
// vol: The function is volatile.
//
$this->_functions = array(
// function ptg args class vol
'COUNT' => array( 0, -1, 0, 0 ),
'IF' => array( 1, -1, 1, 0 ),
'ISNA' => array( 2, 1, 1, 0 ),
'ISERROR' => array( 3, 1, 1, 0 ),
'SUM' => array( 4, -1, 0, 0 ),
'AVERAGE' => array( 5, -1, 0, 0 ),
'MIN' => array( 6, -1, 0, 0 ),
'MAX' => array( 7, -1, 0, 0 ),
'ROW' => array( 8, -1, 0, 0 ),
'COLUMN' => array( 9, -1, 0, 0 ),
'NA' => array( 10, 0, 0, 0 ),
'NPV' => array( 11, -1, 1, 0 ),
'STDEV' => array( 12, -1, 0, 0 ),
'DOLLAR' => array( 13, -1, 1, 0 ),
'FIXED' => array( 14, -1, 1, 0 ),
'SIN' => array( 15, 1, 1, 0 ),
'COS' => array( 16, 1, 1, 0 ),
'TAN' => array( 17, 1, 1, 0 ),
'ATAN' => array( 18, 1, 1, 0 ),
'PI' => array( 19, 0, 1, 0 ),
'SQRT' => array( 20, 1, 1, 0 ),
'EXP' => array( 21, 1, 1, 0 ),
'LN' => array( 22, 1, 1, 0 ),
'LOG10' => array( 23, 1, 1, 0 ),
'ABS' => array( 24, 1, 1, 0 ),
'INT' => array( 25, 1, 1, 0 ),
'SIGN' => array( 26, 1, 1, 0 ),
'ROUND' => array( 27, 2, 1, 0 ),
'LOOKUP' => array( 28, -1, 0, 0 ),
'INDEX' => array( 29, -1, 0, 1 ),
'REPT' => array( 30, 2, 1, 0 ),
'MID' => array( 31, 3, 1, 0 ),
'LEN' => array( 32, 1, 1, 0 ),
'VALUE' => array( 33, 1, 1, 0 ),
'TRUE' => array( 34, 0, 1, 0 ),
'FALSE' => array( 35, 0, 1, 0 ),
'AND' => array( 36, -1, 0, 0 ),
'OR' => array( 37, -1, 0, 0 ),
'NOT' => array( 38, 1, 1, 0 ),
'MOD' => array( 39, 2, 1, 0 ),
'DCOUNT' => array( 40, 3, 0, 0 ),
'DSUM' => array( 41, 3, 0, 0 ),
'DAVERAGE' => array( 42, 3, 0, 0 ),
'DMIN' => array( 43, 3, 0, 0 ),
'DMAX' => array( 44, 3, 0, 0 ),
'DSTDEV' => array( 45, 3, 0, 0 ),
'VAR' => array( 46, -1, 0, 0 ),
'DVAR' => array( 47, 3, 0, 0 ),
'TEXT' => array( 48, 2, 1, 0 ),
'LINEST' => array( 49, -1, 0, 0 ),
'TREND' => array( 50, -1, 0, 0 ),
'LOGEST' => array( 51, -1, 0, 0 ),
'GROWTH' => array( 52, -1, 0, 0 ),
'PV' => array( 56, -1, 1, 0 ),
'FV' => array( 57, -1, 1, 0 ),
'NPER' => array( 58, -1, 1, 0 ),
'PMT' => array( 59, -1, 1, 0 ),
'RATE' => array( 60, -1, 1, 0 ),
'MIRR' => array( 61, 3, 0, 0 ),
'IRR' => array( 62, -1, 0, 0 ),
'RAND' => array( 63, 0, 1, 1 ),
'MATCH' => array( 64, -1, 0, 0 ),
'DATE' => array( 65, 3, 1, 0 ),
'TIME' => array( 66, 3, 1, 0 ),
'DAY' => array( 67, 1, 1, 0 ),
'MONTH' => array( 68, 1, 1, 0 ),
'YEAR' => array( 69, 1, 1, 0 ),
'WEEKDAY' => array( 70, -1, 1, 0 ),
'HOUR' => array( 71, 1, 1, 0 ),
'MINUTE' => array( 72, 1, 1, 0 ),
'SECOND' => array( 73, 1, 1, 0 ),
'NOW' => array( 74, 0, 1, 1 ),
'AREAS' => array( 75, 1, 0, 1 ),
'ROWS' => array( 76, 1, 0, 1 ),
'COLUMNS' => array( 77, 1, 0, 1 ),
'OFFSET' => array( 78, -1, 0, 1 ),
'SEARCH' => array( 82, -1, 1, 0 ),
'TRANSPOSE' => array( 83, 1, 1, 0 ),
'TYPE' => array( 86, 1, 1, 0 ),
'ATAN2' => array( 97, 2, 1, 0 ),
'ASIN' => array( 98, 1, 1, 0 ),
'ACOS' => array( 99, 1, 1, 0 ),
'CHOOSE' => array( 100, -1, 1, 0 ),
'HLOOKUP' => array( 101, -1, 0, 0 ),
'VLOOKUP' => array( 102, -1, 0, 0 ),
'ISREF' => array( 105, 1, 0, 0 ),
'LOG' => array( 109, -1, 1, 0 ),
'CHAR' => array( 111, 1, 1, 0 ),
'LOWER' => array( 112, 1, 1, 0 ),
'UPPER' => array( 113, 1, 1, 0 ),
'PROPER' => array( 114, 1, 1, 0 ),
'LEFT' => array( 115, -1, 1, 0 ),
'RIGHT' => array( 116, -1, 1, 0 ),
'EXACT' => array( 117, 2, 1, 0 ),
'TRIM' => array( 118, 1, 1, 0 ),
'REPLACE' => array( 119, 4, 1, 0 ),
'SUBSTITUTE' => array( 120, -1, 1, 0 ),
'CODE' => array( 121, 1, 1, 0 ),
'FIND' => array( 124, -1, 1, 0 ),
'CELL' => array( 125, -1, 0, 1 ),
'ISERR' => array( 126, 1, 1, 0 ),
'ISTEXT' => array( 127, 1, 1, 0 ),
'ISNUMBER' => array( 128, 1, 1, 0 ),
'ISBLANK' => array( 129, 1, 1, 0 ),
'T' => array( 130, 1, 0, 0 ),
'N' => array( 131, 1, 0, 0 ),
'DATEVALUE' => array( 140, 1, 1, 0 ),
'TIMEVALUE' => array( 141, 1, 1, 0 ),
'SLN' => array( 142, 3, 1, 0 ),
'SYD' => array( 143, 4, 1, 0 ),
'DDB' => array( 144, -1, 1, 0 ),
'INDIRECT' => array( 148, -1, 1, 1 ),
'CALL' => array( 150, -1, 1, 0 ),
'CLEAN' => array( 162, 1, 1, 0 ),
'MDETERM' => array( 163, 1, 2, 0 ),
'MINVERSE' => array( 164, 1, 2, 0 ),
'MMULT' => array( 165, 2, 2, 0 ),
'IPMT' => array( 167, -1, 1, 0 ),
'PPMT' => array( 168, -1, 1, 0 ),
'COUNTA' => array( 169, -1, 0, 0 ),
'PRODUCT' => array( 183, -1, 0, 0 ),
'FACT' => array( 184, 1, 1, 0 ),
'DPRODUCT' => array( 189, 3, 0, 0 ),
'ISNONTEXT' => array( 190, 1, 1, 0 ),
'STDEVP' => array( 193, -1, 0, 0 ),
'VARP' => array( 194, -1, 0, 0 ),
'DSTDEVP' => array( 195, 3, 0, 0 ),
'DVARP' => array( 196, 3, 0, 0 ),
'TRUNC' => array( 197, -1, 1, 0 ),
'ISLOGICAL' => array( 198, 1, 1, 0 ),
'DCOUNTA' => array( 199, 3, 0, 0 ),
'USDOLLAR' => array( 204, -1, 1, 0 ),
'FINDB' => array( 205, -1, 1, 0 ),
'SEARCHB' => array( 206, -1, 1, 0 ),
'REPLACEB' => array( 207, 4, 1, 0 ),
'LEFTB' => array( 208, -1, 1, 0 ),
'RIGHTB' => array( 209, -1, 1, 0 ),
'MIDB' => array( 210, 3, 1, 0 ),
'LENB' => array( 211, 1, 1, 0 ),
'ROUNDUP' => array( 212, 2, 1, 0 ),
'ROUNDDOWN' => array( 213, 2, 1, 0 ),
'ASC' => array( 214, 1, 1, 0 ),
'DBCS' => array( 215, 1, 1, 0 ),
'RANK' => array( 216, -1, 0, 0 ),
'ADDRESS' => array( 219, -1, 1, 0 ),
'DAYS360' => array( 220, -1, 1, 0 ),
'TODAY' => array( 221, 0, 1, 1 ),
'VDB' => array( 222, -1, 1, 0 ),
'MEDIAN' => array( 227, -1, 0, 0 ),
'SUMPRODUCT' => array( 228, -1, 2, 0 ),
'SINH' => array( 229, 1, 1, 0 ),
'COSH' => array( 230, 1, 1, 0 ),
'TANH' => array( 231, 1, 1, 0 ),
'ASINH' => array( 232, 1, 1, 0 ),
'ACOSH' => array( 233, 1, 1, 0 ),
'ATANH' => array( 234, 1, 1, 0 ),
'DGET' => array( 235, 3, 0, 0 ),
'INFO' => array( 244, 1, 1, 1 ),
'DB' => array( 247, -1, 1, 0 ),
'FREQUENCY' => array( 252, 2, 0, 0 ),
'ERROR.TYPE' => array( 261, 1, 1, 0 ),
'REGISTER.ID' => array( 267, -1, 1, 0 ),
'AVEDEV' => array( 269, -1, 0, 0 ),
'BETADIST' => array( 270, -1, 1, 0 ),
'GAMMALN' => array( 271, 1, 1, 0 ),
'BETAINV' => array( 272, -1, 1, 0 ),
'BINOMDIST' => array( 273, 4, 1, 0 ),
'CHIDIST' => array( 274, 2, 1, 0 ),
'CHIINV' => array( 275, 2, 1, 0 ),
'COMBIN' => array( 276, 2, 1, 0 ),
'CONFIDENCE' => array( 277, 3, 1, 0 ),
'CRITBINOM' => array( 278, 3, 1, 0 ),
'EVEN' => array( 279, 1, 1, 0 ),
'EXPONDIST' => array( 280, 3, 1, 0 ),
'FDIST' => array( 281, 3, 1, 0 ),
'FINV' => array( 282, 3, 1, 0 ),
'FISHER' => array( 283, 1, 1, 0 ),
'FISHERINV' => array( 284, 1, 1, 0 ),
'FLOOR' => array( 285, 2, 1, 0 ),
'GAMMADIST' => array( 286, 4, 1, 0 ),
'GAMMAINV' => array( 287, 3, 1, 0 ),
'CEILING' => array( 288, 2, 1, 0 ),
'HYPGEOMDIST' => array( 289, 4, 1, 0 ),
'LOGNORMDIST' => array( 290, 3, 1, 0 ),
'LOGINV' => array( 291, 3, 1, 0 ),
'NEGBINOMDIST' => array( 292, 3, 1, 0 ),
'NORMDIST' => array( 293, 4, 1, 0 ),
'NORMSDIST' => array( 294, 1, 1, 0 ),
'NORMINV' => array( 295, 3, 1, 0 ),
'NORMSINV' => array( 296, 1, 1, 0 ),
'STANDARDIZE' => array( 297, 3, 1, 0 ),
'ODD' => array( 298, 1, 1, 0 ),
'PERMUT' => array( 299, 2, 1, 0 ),
'POISSON' => array( 300, 3, 1, 0 ),
'TDIST' => array( 301, 3, 1, 0 ),
'WEIBULL' => array( 302, 4, 1, 0 ),
'SUMXMY2' => array( 303, 2, 2, 0 ),
'SUMX2MY2' => array( 304, 2, 2, 0 ),
'SUMX2PY2' => array( 305, 2, 2, 0 ),
'CHITEST' => array( 306, 2, 2, 0 ),
'CORREL' => array( 307, 2, 2, 0 ),
'COVAR' => array( 308, 2, 2, 0 ),
'FORECAST' => array( 309, 3, 2, 0 ),
'FTEST' => array( 310, 2, 2, 0 ),
'INTERCEPT' => array( 311, 2, 2, 0 ),
'PEARSON' => array( 312, 2, 2, 0 ),
'RSQ' => array( 313, 2, 2, 0 ),
'STEYX' => array( 314, 2, 2, 0 ),
'SLOPE' => array( 315, 2, 2, 0 ),
'TTEST' => array( 316, 4, 2, 0 ),
'PROB' => array( 317, -1, 2, 0 ),
'DEVSQ' => array( 318, -1, 0, 0 ),
'GEOMEAN' => array( 319, -1, 0, 0 ),
'HARMEAN' => array( 320, -1, 0, 0 ),
'SUMSQ' => array( 321, -1, 0, 0 ),
'KURT' => array( 322, -1, 0, 0 ),
'SKEW' => array( 323, -1, 0, 0 ),
'ZTEST' => array( 324, -1, 0, 0 ),
'LARGE' => array( 325, 2, 0, 0 ),
'SMALL' => array( 326, 2, 0, 0 ),
'QUARTILE' => array( 327, 2, 0, 0 ),
'PERCENTILE' => array( 328, 2, 0, 0 ),
'PERCENTRANK' => array( 329, -1, 0, 0 ),
'MODE' => array( 330, -1, 2, 0 ),
'TRIMMEAN' => array( 331, 2, 0, 0 ),
'TINV' => array( 332, 2, 1, 0 ),
'CONCATENATE' => array( 336, -1, 1, 0 ),
'POWER' => array( 337, 2, 1, 0 ),
'RADIANS' => array( 342, 1, 1, 0 ),
'DEGREES' => array( 343, 1, 1, 0 ),
'SUBTOTAL' => array( 344, -1, 0, 0 ),
'SUMIF' => array( 345, -1, 0, 0 ),
'COUNTIF' => array( 346, 2, 0, 0 ),
'COUNTBLANK' => array( 347, 1, 0, 0 ),
'ISPMT' => array( 350, 4, 1, 0 ),
'DATEDIF' => array( 351, 3, 1, 0 ),
'DATESTRING' => array( 352, 1, 1, 0 ),
'NUMBERSTRING' => array( 353, 2, 1, 0 ),
'ROMAN' => array( 354, -1, 1, 0 ),
'GETPIVOTDATA' => array( 358, -1, 0, 0 ),
'HYPERLINK' => array( 359, -1, 1, 0 ),
'PHONETIC' => array( 360, 1, 0, 0 ),
'AVERAGEA' => array( 361, -1, 0, 0 ),
'MAXA' => array( 362, -1, 0, 0 ),
'MINA' => array( 363, -1, 0, 0 ),
'STDEVPA' => array( 364, -1, 0, 0 ),
'VARPA' => array( 365, -1, 0, 0 ),
'STDEVA' => array( 366, -1, 0, 0 ),
'VARA' => array( 367, -1, 0, 0 ),
'BAHTTEXT' => array( 368, 1, 0, 0 ),
);
}
/**
* Convert a token to the proper ptg value.
*
* @access private
* @param mixed $token The token to convert.
* @return mixed the converted token on success
*/
function _convert($token)
{
if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token)) {
return $this->_convertString($token);
} elseif (is_numeric($token)) {
return $this->_convertNumber($token);
// match references like A1 or $A$1
} elseif (preg_match('/^\$?([A-Ia-i]?[A-Za-z])\$?(\d+)$/',$token)) {
return $this->_convertRef2d($token);
// match external references like Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u",$token)) {
return $this->_convertRef3d($token);
// match external references like 'Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u",$token)) {
return $this->_convertRef3d($token);
// match ranges like A1:B2 or $A$1:$B$2
} elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)\:(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)$/', $token)) {
return $this->_convertRange2d($token);
// match external ranges like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u",$token)) {
return $this->_convertRange3d($token);
// match external ranges like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u",$token)) {
return $this->_convertRange3d($token);
// operators (including parentheses)
} elseif (isset($this->ptg[$token])) {
return pack("C", $this->ptg[$token]);
// match error codes
} elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
return $this->_convertError($token);
// commented so argument number can be processed correctly. See toReversePolish().
/*elseif (preg_match("/[A-Z0-9\xc0-\xdc\.]+/",$token))
{
return($this->_convertFunction($token,$this->_func_args));
}*/
// if it's an argument, ignore the token (the argument remains)
} elseif ($token == 'arg') {
return '';
}
// TODO: use real error codes
throw new PHPExcel_Writer_Exception("Unknown token $token");
}
/**
* Convert a number token to ptgInt or ptgNum
*
* @access private
* @param mixed $num an integer or double for conversion to its ptg value
*/
function _convertNumber($num)
{
// Integer in the range 0..2**16-1
if ((preg_match("/^\d+$/", $num)) and ($num <= 65535)) {
return pack("Cv", $this->ptg['ptgInt'], $num);
} else { // A float
if (PHPExcel_Writer_Excel5_BIFFwriter::getByteOrder()) { // if it's Big Endian
$num = strrev($num);
}
return pack("Cd", $this->ptg['ptgNum'], $num);
}
}
/**
* Convert a string token to ptgStr
*
* @access private
* @param string $string A string for conversion to its ptg value.
* @return mixed the converted token on success
*/
function _convertString($string)
{
// chop away beggining and ending quotes
$string = substr($string, 1, strlen($string) - 2);
if (strlen($string) > 255) {
throw new PHPExcel_Writer_Exception("String is too long");
}
return pack('C', $this->ptg['ptgStr']) . PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($string);
}
/**
* Convert a function to a ptgFunc or ptgFuncVarV depending on the number of
* args that it takes.
*
* @access private
* @param string $token The name of the function for convertion to ptg value.
* @param integer $num_args The number of arguments the function receives.
* @return string The packed ptg for the function
*/
function _convertFunction($token, $num_args)
{
$args = $this->_functions[$token][1];
// $volatile = $this->_functions[$token][3];
// Fixed number of args eg. TIME($i,$j,$k).
if ($args >= 0) {
return pack("Cv", $this->ptg['ptgFuncV'], $this->_functions[$token][0]);
}
// Variable number of args eg. SUM($i,$j,$k, ..).
if ($args == -1) {
return pack("CCv", $this->ptg['ptgFuncVarV'], $num_args, $this->_functions[$token][0]);
}
}
/**
* Convert an Excel range such as A1:D4 to a ptgRefV.
*
* @access private
* @param string $range An Excel range in the A1:A2
* @param int $class
*/
function _convertRange2d($range, $class=0)
{
// TODO: possible class value 0,1,2 check Formula.pm
// Split the range into 2 cell refs
if (preg_match('/^(\$)?([A-Ia-i]?[A-Za-z])(\$)?(\d+)\:(\$)?([A-Ia-i]?[A-Za-z])(\$)?(\d+)$/', $range)) {
list($cell1, $cell2) = explode(':', $range);
} else {
// TODO: use real error codes
throw new PHPExcel_Writer_Exception("Unknown range separator");
}
// Convert the cell references
list($row1, $col1) = $this->_cellToPackedRowcol($cell1);
list($row2, $col2) = $this->_cellToPackedRowcol($cell2);
// The ptg value depends on the class of the ptg.
if ($class == 0) {
$ptgArea = pack("C", $this->ptg['ptgArea']);
} elseif ($class == 1) {
$ptgArea = pack("C", $this->ptg['ptgAreaV']);
} elseif ($class == 2) {
$ptgArea = pack("C", $this->ptg['ptgAreaA']);
} else {
// TODO: use real error codes
throw new PHPExcel_Writer_Exception("Unknown class $class");
}
return $ptgArea . $row1 . $row2 . $col1. $col2;
}
/**
* Convert an Excel 3d range such as "Sheet1!A1:D4" or "Sheet1:Sheet2!A1:D4" to
* a ptgArea3d.
*
* @access private
* @param string $token An Excel range in the Sheet1!A1:A2 format.
* @return mixed The packed ptgArea3d token on success.
*/
function _convertRange3d($token)
{
// $class = 0; // formulas like Sheet1!$A$1:$A$2 in list type data validation need this class (0x3B)
// Split the ref at the ! symbol
list($ext_ref, $range) = explode('!', $token);
// Convert the external reference part (different for BIFF8)
$ext_ref = $this->_getRefIndex($ext_ref);
// Split the range into 2 cell refs
list($cell1, $cell2) = explode(':', $range);
// Convert the cell references
if (preg_match("/^(\\$)?[A-Ia-i]?[A-Za-z](\\$)?(\d+)$/", $cell1)) {
list($row1, $col1) = $this->_cellToPackedRowcol($cell1);
list($row2, $col2) = $this->_cellToPackedRowcol($cell2);
} else { // It's a rows range (like 26:27)
list($row1, $col1, $row2, $col2) = $this->_rangeToPackedRange($cell1.':'.$cell2);
}
// The ptg value depends on the class of the ptg.
// if ($class == 0) {
$ptgArea = pack("C", $this->ptg['ptgArea3d']);
// } elseif ($class == 1) {
// $ptgArea = pack("C", $this->ptg['ptgArea3dV']);
// } elseif ($class == 2) {
// $ptgArea = pack("C", $this->ptg['ptgArea3dA']);
// } else {
// throw new PHPExcel_Writer_Exception("Unknown class $class");
// }
return $ptgArea . $ext_ref . $row1 . $row2 . $col1. $col2;
}
/**
* Convert an Excel reference such as A1, $B2, C$3 or $D$4 to a ptgRefV.
*
* @access private
* @param string $cell An Excel cell reference
* @return string The cell in packed() format with the corresponding ptg
*/
function _convertRef2d($cell)
{
// $class = 2; // as far as I know, this is magick.
// Convert the cell reference
$cell_array = $this->_cellToPackedRowcol($cell);
list($row, $col) = $cell_array;
// The ptg value depends on the class of the ptg.
// if ($class == 0) {
// $ptgRef = pack("C", $this->ptg['ptgRef']);
// } elseif ($class == 1) {
// $ptgRef = pack("C", $this->ptg['ptgRefV']);
// } elseif ($class == 2) {
$ptgRef = pack("C", $this->ptg['ptgRefA']);
// } else {
// // TODO: use real error codes
// throw new PHPExcel_Writer_Exception("Unknown class $class");
// }
return $ptgRef.$row.$col;
}
/**
* Convert an Excel 3d reference such as "Sheet1!A1" or "Sheet1:Sheet2!A1" to a
* ptgRef3d.
*
* @access private
* @param string $cell An Excel cell reference
* @return mixed The packed ptgRef3d token on success.
*/
function _convertRef3d($cell)
{
// $class = 2; // as far as I know, this is magick.
// Split the ref at the ! symbol
list($ext_ref, $cell) = explode('!', $cell);
// Convert the external reference part (different for BIFF8)
$ext_ref = $this->_getRefIndex($ext_ref);
// Convert the cell reference part
list($row, $col) = $this->_cellToPackedRowcol($cell);
// The ptg value depends on the class of the ptg.
// if ($class == 0) {
// $ptgRef = pack("C", $this->ptg['ptgRef3d']);
// } elseif ($class == 1) {
// $ptgRef = pack("C", $this->ptg['ptgRef3dV']);
// } elseif ($class == 2) {
$ptgRef = pack("C", $this->ptg['ptgRef3dA']);
// } else {
// throw new PHPExcel_Writer_Exception("Unknown class $class");
// }
return $ptgRef . $ext_ref. $row . $col;
}
/**
* Convert an error code to a ptgErr
*
* @access private
* @param string $errorCode The error code for conversion to its ptg value
* @return string The error code ptgErr
*/
function _convertError($errorCode)
{
switch ($errorCode) {
case '#NULL!': return pack("C", 0x00);
case '#DIV/0!': return pack("C", 0x07);
case '#VALUE!': return pack("C", 0x0F);
case '#REF!': return pack("C", 0x17);
case '#NAME?': return pack("C", 0x1D);
case '#NUM!': return pack("C", 0x24);
case '#N/A': return pack("C", 0x2A);
}
return pack("C", 0xFF);
}
/**
* Convert the sheet name part of an external reference, for example "Sheet1" or
* "Sheet1:Sheet2", to a packed structure.
*
* @access private
* @param string $ext_ref The name of the external reference
* @return string The reference index in packed() format
*/
function _packExtRef($ext_ref)
{
$ext_ref = preg_replace("/^'/", '', $ext_ref); // Remove leading ' if any.
$ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' if any.
// Check if there is a sheet range eg., Sheet1:Sheet2.
if (preg_match("/:/", $ext_ref)) {
list($sheet_name1, $sheet_name2) = explode(':', $ext_ref);
$sheet1 = $this->_getSheetIndex($sheet_name1);
if ($sheet1 == -1) {
throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name1 in formula");
}
$sheet2 = $this->_getSheetIndex($sheet_name2);
if ($sheet2 == -1) {
throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name2 in formula");
}
// Reverse max and min sheet numbers if necessary
if ($sheet1 > $sheet2) {
list($sheet1, $sheet2) = array($sheet2, $sheet1);
}
} else { // Single sheet name only.
$sheet1 = $this->_getSheetIndex($ext_ref);
if ($sheet1 == -1) {
throw new PHPExcel_Writer_Exception("Unknown sheet name $ext_ref in formula");
}
$sheet2 = $sheet1;
}
// References are stored relative to 0xFFFF.
$offset = -1 - $sheet1;
return pack('vdvv', $offset, 0x00, $sheet1, $sheet2);
}
/**
* Look up the REF index that corresponds to an external sheet name
* (or range). If it doesn't exist yet add it to the workbook's references
* array. It assumes all sheet names given must exist.
*
* @access private
* @param string $ext_ref The name of the external reference
* @return mixed The reference index in packed() format on success
*/
function _getRefIndex($ext_ref)
{
$ext_ref = preg_replace("/^'/", '', $ext_ref); // Remove leading ' if any.
$ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' if any.
$ext_ref = str_replace('\'\'', '\'', $ext_ref); // Replace escaped '' with '
// Check if there is a sheet range eg., Sheet1:Sheet2.
if (preg_match("/:/", $ext_ref)) {
list($sheet_name1, $sheet_name2) = explode(':', $ext_ref);
$sheet1 = $this->_getSheetIndex($sheet_name1);
if ($sheet1 == -1) {
throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name1 in formula");
}
$sheet2 = $this->_getSheetIndex($sheet_name2);
if ($sheet2 == -1) {
throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name2 in formula");
}
// Reverse max and min sheet numbers if necessary
if ($sheet1 > $sheet2) {
list($sheet1, $sheet2) = array($sheet2, $sheet1);
}
} else { // Single sheet name only.
$sheet1 = $this->_getSheetIndex($ext_ref);
if ($sheet1 == -1) {
throw new PHPExcel_Writer_Exception("Unknown sheet name $ext_ref in formula");
}
$sheet2 = $sheet1;
}
// assume all references belong to this document
$supbook_index = 0x00;
$ref = pack('vvv', $supbook_index, $sheet1, $sheet2);
$total_references = count($this->_references);
$index = -1;
for ($i = 0; $i < $total_references; ++$i) {
if ($ref == $this->_references[$i]) {
$index = $i;
break;
}
}
// if REF was not found add it to references array
if ($index == -1) {
$this->_references[$total_references] = $ref;
$index = $total_references;
}
return pack('v', $index);
}
/**
* Look up the index that corresponds to an external sheet name. The hash of
* sheet names is updated by the addworksheet() method of the
* PHPExcel_Writer_Excel5_Workbook class.
*
* @access private
* @param string $sheet_name Sheet name
* @return integer The sheet index, -1 if the sheet was not found
*/
function _getSheetIndex($sheet_name)
{
if (!isset($this->_ext_sheets[$sheet_name])) {
return -1;
} else {
return $this->_ext_sheets[$sheet_name];
}
}
/**
* This method is used to update the array of sheet names. It is
* called by the addWorksheet() method of the
* PHPExcel_Writer_Excel5_Workbook class.
*
* @access public
* @see PHPExcel_Writer_Excel5_Workbook::addWorksheet()
* @param string $name The name of the worksheet being added
* @param integer $index The index of the worksheet being added
*/
function setExtSheet($name, $index)
{
$this->_ext_sheets[$name] = $index;
}
/**
* pack() row and column into the required 3 or 4 byte format.
*
* @access private
* @param string $cell The Excel cell reference to be packed
* @return array Array containing the row and column in packed() format
*/
function _cellToPackedRowcol($cell)
{
$cell = strtoupper($cell);
list($row, $col, $row_rel, $col_rel) = $this->_cellToRowcol($cell);
if ($col >= 256) {
throw new PHPExcel_Writer_Exception("Column in: $cell greater than 255");
}
if ($row >= 65536) {
throw new PHPExcel_Writer_Exception("Row in: $cell greater than 65536 ");
}
// Set the high bits to indicate if row or col are relative.
$col |= $col_rel << 14;
$col |= $row_rel << 15;
$col = pack('v', $col);
$row = pack('v', $row);
return array($row, $col);
}
/**
* pack() row range into the required 3 or 4 byte format.
* Just using maximum col/rows, which is probably not the correct solution
*
* @access private
* @param string $range The Excel range to be packed
* @return array Array containing (row1,col1,row2,col2) in packed() format
*/
function _rangeToPackedRange($range)
{
preg_match('/(\$)?(\d+)\:(\$)?(\d+)/', $range, $match);
// return absolute rows if there is a $ in the ref
$row1_rel = empty($match[1]) ? 1 : 0;
$row1 = $match[2];
$row2_rel = empty($match[3]) ? 1 : 0;
$row2 = $match[4];
// Convert 1-index to zero-index
--$row1;
--$row2;
// Trick poor inocent Excel
$col1 = 0;
$col2 = 65535; // FIXME: maximum possible value for Excel 5 (change this!!!)
// FIXME: this changes for BIFF8
if (($row1 >= 65536) or ($row2 >= 65536)) {
throw new PHPExcel_Writer_Exception("Row in: $range greater than 65536 ");
}
// Set the high bits to indicate if rows are relative.
$col1 |= $row1_rel << 15;
$col2 |= $row2_rel << 15;
$col1 = pack('v', $col1);
$col2 = pack('v', $col2);
$row1 = pack('v', $row1);
$row2 = pack('v', $row2);
return array($row1, $col1, $row2, $col2);
}
/**
* Convert an Excel cell reference such as A1 or $B2 or C$3 or $D$4 to a zero
* indexed row and column number. Also returns two (0,1) values to indicate
* whether the row or column are relative references.
*
* @access private
* @param string $cell The Excel cell reference in A1 format.
* @return array
*/
function _cellToRowcol($cell)
{
preg_match('/(\$)?([A-I]?[A-Z])(\$)?(\d+)/',$cell,$match);
// return absolute column if there is a $ in the ref
$col_rel = empty($match[1]) ? 1 : 0;
$col_ref = $match[2];
$row_rel = empty($match[3]) ? 1 : 0;
$row = $match[4];
// Convert base26 column string to a number.
$expn = strlen($col_ref) - 1;
$col = 0;
$col_ref_length = strlen($col_ref);
for ($i = 0; $i < $col_ref_length; ++$i) {
$col += (ord($col_ref{$i}) - 64) * pow(26, $expn);
--$expn;
}
// Convert 1-index to zero-index
--$row;
--$col;
return array($row, $col, $row_rel, $col_rel);
}
/**
* Advance to the next valid token.
*
* @access private
*/
function _advance()
{
$i = $this->_current_char;
$formula_length = strlen($this->_formula);
// eat up white spaces
if ($i < $formula_length) {
while ($this->_formula{$i} == " ") {
++$i;
}
if ($i < ($formula_length - 1)) {
$this->_lookahead = $this->_formula{$i+1};
}
$token = '';
}
while ($i < $formula_length) {
$token .= $this->_formula{$i};
if ($i < ($formula_length - 1)) {
$this->_lookahead = $this->_formula{$i+1};
} else {
$this->_lookahead = '';
}
if ($this->_match($token) != '') {
//if ($i < strlen($this->_formula) - 1) {
// $this->_lookahead = $this->_formula{$i+1};
//}
$this->_current_char = $i + 1;
$this->_current_token = $token;
return 1;
}
if ($i < ($formula_length - 2)) {
$this->_lookahead = $this->_formula{$i+2};
} else { // if we run out of characters _lookahead becomes empty
$this->_lookahead = '';
}
++$i;
}
//die("Lexical error ".$this->_current_char);
}
/**
* Checks if it's a valid token.
*
* @access private
* @param mixed $token The token to check.
* @return mixed The checked token or false on failure
*/
function _match($token)
{
switch($token) {
case "+":
case "-":
case "*":
case "/":
case "(":
case ")":
case ",":
case ";":
case ">=":
case "<=":
case "=":
case "<>":
case "^":
case "&":
case "%":
return $token;
break;
case ">":
if ($this->_lookahead == '=') { // it's a GE token
break;
}
return $token;
break;
case "<":
// it's a LE or a NE token
if (($this->_lookahead == '=') or ($this->_lookahead == '>')) {
break;
}
return $token;
break;
default:
// if it's a reference A1 or $A$1 or $A1 or A$1
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/',$token) and
!preg_match("/[0-9]/",$this->_lookahead) and
($this->_lookahead != ':') and ($this->_lookahead != '.') and
($this->_lookahead != '!'))
{
return $token;
}
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u",$token) and
!preg_match("/[0-9]/",$this->_lookahead) and
($this->_lookahead != ':') and ($this->_lookahead != '.'))
{
return $token;
}
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u",$token) and
!preg_match("/[0-9]/",$this->_lookahead) and
($this->_lookahead != ':') and ($this->_lookahead != '.'))
{
return $token;
}
// if it's a range A1:A2 or $A$1:$A$2
elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $token) and
!preg_match("/[0-9]/",$this->_lookahead))
{
return $token;
}
// If it's an external range like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u",$token) and
!preg_match("/[0-9]/",$this->_lookahead))
{
return $token;
}
// If it's an external range like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u",$token) and
!preg_match("/[0-9]/",$this->_lookahead))
{
return $token;
}
// If it's a number (check that it's not a sheet name or range)
elseif (is_numeric($token) and
(!is_numeric($token.$this->_lookahead) or ($this->_lookahead == '')) and
($this->_lookahead != '!') and ($this->_lookahead != ':'))
{
return $token;
}
// If it's a string (of maximum 255 characters)
elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/",$token) and $this->_lookahead != '"' and (substr_count($token, '"')%2 == 0))
{
return $token;
}
// If it's an error code
elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A')
{
return $token;
}
// if it's a function call
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i",$token) and ($this->_lookahead == "("))
{
return $token;
}
// It's an argument of some description (e.g. a named range),
// precise nature yet to be determined
elseif(substr($token,-1) == ')') {
return $token;
}
return '';
}
}
/**
* The parsing method. It parses a formula.
*
* @access public
* @param string $formula The formula to parse, without the initial equal
* sign (=).
* @return mixed true on success
*/
function parse($formula)
{
$this->_current_char = 0;
$this->_formula = $formula;
$this->_lookahead = isset($formula{1}) ? $formula{1} : '';
$this->_advance();
$this->_parse_tree = $this->_condition();
return true;
}
/**
* It parses a condition. It assumes the following rule:
* Cond -> Expr [(">" | "<") Expr]
*
* @access private
* @return mixed The parsed ptg'd tree on success
*/
function _condition()
{
$result = $this->_expression();
if ($this->_current_token == "<") {
$this->_advance();
$result2 = $this->_expression();
$result = $this->_createTree('ptgLT', $result, $result2);
} elseif ($this->_current_token == ">") {
$this->_advance();
$result2 = $this->_expression();
$result = $this->_createTree('ptgGT', $result, $result2);
} elseif ($this->_current_token == "<=") {
$this->_advance();
$result2 = $this->_expression();
$result = $this->_createTree('ptgLE', $result, $result2);
} elseif ($this->_current_token == ">=") {
$this->_advance();
$result2 = $this->_expression();
$result = $this->_createTree('ptgGE', $result, $result2);
} elseif ($this->_current_token == "=") {
$this->_advance();
$result2 = $this->_expression();
$result = $this->_createTree('ptgEQ', $result, $result2);
} elseif ($this->_current_token == "<>") {
$this->_advance();
$result2 = $this->_expression();
$result = $this->_createTree('ptgNE', $result, $result2);
} elseif ($this->_current_token == "&") {
$this->_advance();
$result2 = $this->_expression();
$result = $this->_createTree('ptgConcat', $result, $result2);
}
return $result;
}
/**
* It parses a expression. It assumes the following rule:
* Expr -> Term [("+" | "-") Term]
* -> "string"
* -> "-" Term : Negative value
* -> "+" Term : Positive value
* -> Error code
*
* @access private
* @return mixed The parsed ptg'd tree on success
*/
function _expression()
{
// If it's a string return a string node
if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $this->_current_token)) {
$tmp = str_replace('""', '"', $this->_current_token);
if (($tmp == '"') || ($tmp == '')) $tmp = '""'; // Trap for "" that has been used for an empty string
$result = $this->_createTree($tmp, '', '');
$this->_advance();
return $result;
// If it's an error code
} elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $this->_current_token) or $this->_current_token == '#N/A'){
$result = $this->_createTree($this->_current_token, 'ptgErr', '');
$this->_advance();
return $result;
// If it's a negative value
} elseif ($this->_current_token == "-") {
// catch "-" Term
$this->_advance();
$result2 = $this->_expression();
$result = $this->_createTree('ptgUminus', $result2, '');
return $result;
// If it's a positive value
} elseif ($this->_current_token == "+") {
// catch "+" Term
$this->_advance();
$result2 = $this->_expression();
$result = $this->_createTree('ptgUplus', $result2, '');
return $result;
}
$result = $this->_term();
while (($this->_current_token == "+") or
($this->_current_token == "-") or
($this->_current_token == "^")) {
/**/
if ($this->_current_token == "+") {
$this->_advance();
$result2 = $this->_term();
$result = $this->_createTree('ptgAdd', $result, $result2);
} elseif ($this->_current_token == "-") {
$this->_advance();
$result2 = $this->_term();
$result = $this->_createTree('ptgSub', $result, $result2);
} else {
$this->_advance();
$result2 = $this->_term();
$result = $this->_createTree('ptgPower', $result, $result2);
}
}
return $result;
}
/**
* This function just introduces a ptgParen element in the tree, so that Excel
* doesn't get confused when working with a parenthesized formula afterwards.
*
* @access private
* @see _fact()
* @return array The parsed ptg'd tree
*/
function _parenthesizedExpression()
{
$result = $this->_createTree('ptgParen', $this->_expression(), '');
return $result;
}
/**
* It parses a term. It assumes the following rule:
* Term -> Fact [("*" | "/") Fact]
*
* @access private
* @return mixed The parsed ptg'd tree on success
*/
function _term()
{
$result = $this->_fact();
while (($this->_current_token == "*") or
($this->_current_token == "/")) {
/**/
if ($this->_current_token == "*") {
$this->_advance();
$result2 = $this->_fact();
$result = $this->_createTree('ptgMul', $result, $result2);
} else {
$this->_advance();
$result2 = $this->_fact();
$result = $this->_createTree('ptgDiv', $result, $result2);
}
}
return $result;
}
/**
* It parses a factor. It assumes the following rule:
* Fact -> ( Expr )
* | CellRef
* | CellRange
* | Number
* | Function
*
* @access private
* @return mixed The parsed ptg'd tree on success
*/
function _fact()
{
if ($this->_current_token == "(") {
$this->_advance(); // eat the "("
$result = $this->_parenthesizedExpression();
if ($this->_current_token != ")") {
throw new PHPExcel_Writer_Exception("')' token expected.");
}
$this->_advance(); // eat the ")"
return $result;
}
// if it's a reference
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/',$this->_current_token))
{
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u",$this->_current_token))
{
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u",$this->_current_token))
{
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// if it's a range A1:B2 or $A$1:$B$2
elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/',$this->_current_token) or
preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/',$this->_current_token))
{
// must be an error?
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// If it's an external range (Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2)
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u",$this->_current_token))
{
// must be an error?
//$result = $this->_current_token;
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// If it's an external range ('Sheet1'!A1:B2 or 'Sheet1'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1'!$A$1:$B$2)
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u",$this->_current_token))
{
// must be an error?
//$result = $this->_current_token;
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// If it's a number or a percent
elseif (is_numeric($this->_current_token))
{
if($this->_lookahead == '%'){
$result = $this->_createTree('ptgPercent', $this->_current_token, '');
} else {
$result = $this->_createTree($this->_current_token, '', '');
}
$this->_advance();
return $result;
}
// if it's a function call
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i",$this->_current_token))
{
$result = $this->_func();
return $result;
}
throw new PHPExcel_Writer_Exception("Syntax error: ".$this->_current_token.
", lookahead: ".$this->_lookahead.
", current char: ".$this->_current_char);
}
/**
* It parses a function call. It assumes the following rule:
* Func -> ( Expr [,Expr]* )
*
* @access private
* @return mixed The parsed ptg'd tree on success
*/
function _func()
{
$num_args = 0; // number of arguments received
$function = strtoupper($this->_current_token);
$result = ''; // initialize result
$this->_advance();
$this->_advance(); // eat the "("
while ($this->_current_token != ')') {
/**/
if ($num_args > 0) {
if ($this->_current_token == "," or
$this->_current_token == ";")
{
$this->_advance(); // eat the "," or ";"
} else {
throw new PHPExcel_Writer_Exception("Syntax error: comma expected in ".
"function $function, arg #{$num_args}");
}
$result2 = $this->_condition();
$result = $this->_createTree('arg', $result, $result2);
} else { // first argument
$result2 = $this->_condition();
$result = $this->_createTree('arg', '', $result2);
}
++$num_args;
}
if (!isset($this->_functions[$function])) {
throw new PHPExcel_Writer_Exception("Function $function() doesn't exist");
}
$args = $this->_functions[$function][1];
// If fixed number of args eg. TIME($i,$j,$k). Check that the number of args is valid.
if (($args >= 0) and ($args != $num_args)) {
throw new PHPExcel_Writer_Exception("Incorrect number of arguments in function $function() ");
}
$result = $this->_createTree($function, $result, $num_args);
$this->_advance(); // eat the ")"
return $result;
}
/**
* Creates a tree. In fact an array which may have one or two arrays (sub-trees)
* as elements.
*
* @access private
* @param mixed $value The value of this node.
* @param mixed $left The left array (sub-tree) or a final node.
* @param mixed $right The right array (sub-tree) or a final node.
* @return array A tree
*/
function _createTree($value, $left, $right)
{
return array('value' => $value, 'left' => $left, 'right' => $right);
}
/**
* Builds a string containing the tree in reverse polish notation (What you
* would use in a HP calculator stack).
* The following tree:
*
* +
* / \
* 2 3
*
* produces: "23+"
*
* The following tree:
*
* +
* / \
* 3 *
* / \
* 6 A1
*
* produces: "36A1*+"
*
* In fact all operands, functions, references, etc... are written as ptg's
*
* @access public
* @param array $tree The optional tree to convert.
* @return string The tree in reverse polish notation
*/
function toReversePolish($tree = array())
{
$polish = ""; // the string we are going to return
if (empty($tree)) { // If it's the first call use _parse_tree
$tree = $this->_parse_tree;
}
if (is_array($tree['left'])) {
$converted_tree = $this->toReversePolish($tree['left']);
$polish .= $converted_tree;
} elseif ($tree['left'] != '') { // It's a final node
$converted_tree = $this->_convert($tree['left']);
$polish .= $converted_tree;
}
if (is_array($tree['right'])) {
$converted_tree = $this->toReversePolish($tree['right']);
$polish .= $converted_tree;
} elseif ($tree['right'] != '') { // It's a final node
$converted_tree = $this->_convert($tree['right']);
$polish .= $converted_tree;
}
// if it's a function convert it here (so we can set it's arguments)
if (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/",$tree['value']) and
!preg_match('/^([A-Ia-i]?[A-Za-z])(\d+)$/',$tree['value']) and
!preg_match("/^[A-Ia-i]?[A-Za-z](\d+)\.\.[A-Ia-i]?[A-Za-z](\d+)$/",$tree['value']) and
!is_numeric($tree['value']) and
!isset($this->ptg[$tree['value']]))
{
// left subtree for a function is always an array.
if ($tree['left'] != '') {
$left_tree = $this->toReversePolish($tree['left']);
} else {
$left_tree = '';
}
// add it's left subtree and return.
return $left_tree.$this->_convertFunction($tree['value'], $tree['right']);
} else {
$converted_tree = $this->_convert($tree['value']);
}
$polish .= $converted_tree;
return $polish;
}
}
PK ! ^ PHPExcel/Writer/CSV.phpnu [ _phpExcel = $phpExcel;
}
/**
* Save PHPExcel to file
*
* @param string $pFilename
* @throws PHPExcel_Writer_Exception
*/
public function save($pFilename = null) {
// Fetch sheet
$sheet = $this->_phpExcel->getSheet($this->_sheetIndex);
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog();
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(FALSE);
$saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType();
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
// Open file
$fileHandle = fopen($pFilename, 'wb+');
if ($fileHandle === false) {
throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing.");
}
if ($this->_excelCompatibility) {
fwrite($fileHandle, "\xEF\xBB\xBF"); // Enforce UTF-8 BOM Header
$this->setEnclosure('"'); // Set enclosure to "
$this->setDelimiter(";"); // Set delimiter to a semi-colon
$this->setLineEnding("\r\n");
fwrite($fileHandle, 'sep=' . $this->getDelimiter() . $this->_lineEnding);
} elseif ($this->_useBOM) {
// Write the UTF-8 BOM code if required
fwrite($fileHandle, "\xEF\xBB\xBF");
}
// Identify the range that we need to extract from the worksheet
$maxCol = $sheet->getHighestDataColumn();
$maxRow = $sheet->getHighestDataRow();
// Write rows to file
for($row = 1; $row <= $maxRow; ++$row) {
// Convert the row to an array...
$cellsArray = $sheet->rangeToArray('A'.$row.':'.$maxCol.$row,'', $this->_preCalculateFormulas);
// ... and write to the file
$this->_writeLine($fileHandle, $cellsArray[0]);
}
// Close file
fclose($fileHandle);
PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType);
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog);
}
/**
* Get delimiter
*
* @return string
*/
public function getDelimiter() {
return $this->_delimiter;
}
/**
* Set delimiter
*
* @param string $pValue Delimiter, defaults to ,
* @return PHPExcel_Writer_CSV
*/
public function setDelimiter($pValue = ',') {
$this->_delimiter = $pValue;
return $this;
}
/**
* Get enclosure
*
* @return string
*/
public function getEnclosure() {
return $this->_enclosure;
}
/**
* Set enclosure
*
* @param string $pValue Enclosure, defaults to "
* @return PHPExcel_Writer_CSV
*/
public function setEnclosure($pValue = '"') {
if ($pValue == '') {
$pValue = null;
}
$this->_enclosure = $pValue;
return $this;
}
/**
* Get line ending
*
* @return string
*/
public function getLineEnding() {
return $this->_lineEnding;
}
/**
* Set line ending
*
* @param string $pValue Line ending, defaults to OS line ending (PHP_EOL)
* @return PHPExcel_Writer_CSV
*/
public function setLineEnding($pValue = PHP_EOL) {
$this->_lineEnding = $pValue;
return $this;
}
/**
* Get whether BOM should be used
*
* @return boolean
*/
public function getUseBOM() {
return $this->_useBOM;
}
/**
* Set whether BOM should be used
*
* @param boolean $pValue Use UTF-8 byte-order mark? Defaults to false
* @return PHPExcel_Writer_CSV
*/
public function setUseBOM($pValue = false) {
$this->_useBOM = $pValue;
return $this;
}
/**
* Get whether the file should be saved with full Excel Compatibility
*
* @return boolean
*/
public function getExcelCompatibility() {
return $this->_excelCompatibility;
}
/**
* Set whether the file should be saved with full Excel Compatibility
*
* @param boolean $pValue Set the file to be written as a fully Excel compatible csv file
* Note that this overrides other settings such as useBOM, enclosure and delimiter
* @return PHPExcel_Writer_CSV
*/
public function setExcelCompatibility($pValue = false) {
$this->_excelCompatibility = $pValue;
return $this;
}
/**
* Get sheet index
*
* @return int
*/
public function getSheetIndex() {
return $this->_sheetIndex;
}
/**
* Set sheet index
*
* @param int $pValue Sheet index
* @return PHPExcel_Writer_CSV
*/
public function setSheetIndex($pValue = 0) {
$this->_sheetIndex = $pValue;
return $this;
}
/**
* Write line to CSV file
*
* @param mixed $pFileHandle PHP filehandle
* @param array $pValues Array containing values in a row
* @throws PHPExcel_Writer_Exception
*/
private function _writeLine($pFileHandle = null, $pValues = null) {
if (is_array($pValues)) {
// No leading delimiter
$writeDelimiter = false;
// Build the line
$line = '';
foreach ($pValues as $element) {
// Escape enclosures
$element = str_replace($this->_enclosure, $this->_enclosure . $this->_enclosure, $element);
// Add delimiter
if ($writeDelimiter) {
$line .= $this->_delimiter;
} else {
$writeDelimiter = true;
}
// Add enclosed string
$line .= $this->_enclosure . $element . $this->_enclosure;
}
// Add line ending
$line .= $this->_lineEnding;
// Write to file
fwrite($pFileHandle, $line);
} else {
throw new PHPExcel_Writer_Exception("Invalid data row passed to CSV writer.");
}
}
}
PK !
PHPExcel/Writer/Abstract.phpnu [ _includeCharts;
}
/**
* Set write charts in workbook
* Set to true, to advise the Writer to include any charts that exist in the PHPExcel object.
* Set to false (the default) to ignore charts.
*
* @param boolean $pValue
* @return PHPExcel_Writer_IWriter
*/
public function setIncludeCharts($pValue = FALSE) {
$this->_includeCharts = (boolean) $pValue;
return $this;
}
/**
* Get Pre-Calculate Formulas flag
* If this is true (the default), then the writer will recalculate all formulae in a workbook when saving,
* so that the pre-calculated values are immediately available to MS Excel or other office spreadsheet
* viewer when opening the file
* If false, then formulae are not calculated on save. This is faster for saving in PHPExcel, but slower
* when opening the resulting file in MS Excel, because Excel has to recalculate the formulae itself
*
* @return boolean
*/
public function getPreCalculateFormulas() {
return $this->_preCalculateFormulas;
}
/**
* Set Pre-Calculate Formulas
* Set to true (the default) to advise the Writer to calculate all formulae on save
* Set to false to prevent precalculation of formulae on save.
*
* @param boolean $pValue Pre-Calculate Formulas?
* @return PHPExcel_Writer_IWriter
*/
public function setPreCalculateFormulas($pValue = TRUE) {
$this->_preCalculateFormulas = (boolean) $pValue;
return $this;
}
/**
* Get use disk caching where possible?
*
* @return boolean
*/
public function getUseDiskCaching() {
return $this->_useDiskCaching;
}
/**
* Set use disk caching where possible?
*
* @param boolean $pValue
* @param string $pDirectory Disk caching directory
* @throws PHPExcel_Writer_Exception when directory does not exist
* @return PHPExcel_Writer_Excel2007
*/
public function setUseDiskCaching($pValue = FALSE, $pDirectory = NULL) {
$this->_useDiskCaching = $pValue;
if ($pDirectory !== NULL) {
if (is_dir($pDirectory)) {
$this->_diskCachingDirectory = $pDirectory;
} else {
throw new PHPExcel_Writer_Exception("Directory does not exist: $pDirectory");
}
}
return $this;
}
/**
* Get disk caching directory
*
* @return string
*/
public function getDiskCachingDirectory() {
return $this->_diskCachingDirectory;
}
}
PK ! : PHPExcel/locale/ru/functionsnu [ ##
## PHPExcel
##
## Copyright (c) 2006 - 2013 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
##
## @category PHPExcel
## @package PHPExcel_Calculation
## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
## @version 1.8.0, 2014-03-02
##
## Data in this file derived from information provided by web-junior (http://www.web-junior.net/)
##
##
##
## Add-in and Automation functions Функции надстроек и автоматизации
##
GETPIVOTDATA = ПОЛУЧИТЬ.ДАННЫЕ.СВОДНОЙ.ТАБЛИЦЫ ## Возвращает данные, хранящиеся в отчете сводной таблицы.
##
## Cube functions Функции Куб
##
CUBEKPIMEMBER = КУБЭЛЕМЕНТКИП ## Возвращает свойство ключевого индикатора производительности «(КИП)» и отображает имя «КИП» в ячейке. «КИП» представляет собой количественную величину, такую как ежемесячная валовая прибыль или ежеквартальная текучесть кадров, используемой для контроля эффективности работы организации.
CUBEMEMBER = КУБЭЛЕМЕНТ ## Возвращает элемент или кортеж из куба. Используется для проверки существования элемента или кортежа в кубе.
CUBEMEMBERPROPERTY = КУБСВОЙСТВОЭЛЕМЕНТА ## Возвращает значение свойства элемента из куба. Используется для проверки существования имени элемента в кубе и возвращает указанное свойство для этого элемента.
CUBERANKEDMEMBER = КУБПОРЭЛЕМЕНТ ## Возвращает n-ый или ранжированный элемент в множество. Используется для возвращения одного или нескольких элементов в множество, например, лучшего продавца или 10 лучших студентов.
CUBESET = КУБМНОЖ ## Определяет вычислительное множество элементов или кортежей, отправляя на сервер выражение, которое создает множество, а затем возвращает его в Microsoft Office Excel.
CUBESETCOUNT = КУБЧИСЛОЭЛМНОЖ ## Возвращает число элементов множества.
CUBEVALUE = КУБЗНАЧЕНИЕ ## Возвращает обобщенное значение из куба.
##
## Database functions Функции для работы с базами данных
##
DAVERAGE = ДСРЗНАЧ ## Возвращает среднее значение выбранных записей базы данных.
DCOUNT = БСЧЁТ ## Подсчитывает количество числовых ячеек в базе данных.
DCOUNTA = БСЧЁТА ## Подсчитывает количество непустых ячеек в базе данных.
DGET = БИЗВЛЕЧЬ ## Извлекает из базы данных одну запись, удовлетворяющую заданному условию.
DMAX = ДМАКС ## Возвращает максимальное значение среди выделенных записей базы данных.
DMIN = ДМИН ## Возвращает минимальное значение среди выделенных записей базы данных.
DPRODUCT = БДПРОИЗВЕД ## Перемножает значения определенного поля в записях базы данных, удовлетворяющих условию.
DSTDEV = ДСТАНДОТКЛ ## Оценивает стандартное отклонение по выборке для выделенных записей базы данных.
DSTDEVP = ДСТАНДОТКЛП ## Вычисляет стандартное отклонение по генеральной совокупности для выделенных записей базы данных
DSUM = БДСУММ ## Суммирует числа в поле для записей базы данных, удовлетворяющих условию.
DVAR = БДДИСП ## Оценивает дисперсию по выборке из выделенных записей базы данных
DVARP = БДДИСПП ## Вычисляет дисперсию по генеральной совокупности для выделенных записей базы данных
##
## Date and time functions Функции даты и времени
##
DATE = ДАТА ## Возвращает заданную дату в числовом формате.
DATEVALUE = ДАТАЗНАЧ ## Преобразует дату из текстового формата в числовой формат.
DAY = ДЕНЬ ## Преобразует дату в числовом формате в день месяца.
DAYS360 = ДНЕЙ360 ## Вычисляет количество дней между двумя датами на основе 360-дневного года.
EDATE = ДАТАМЕС ## Возвращает дату в числовом формате, отстоящую на заданное число месяцев вперед или назад от начальной даты.
EOMONTH = КОНМЕСЯЦА ## Возвращает дату в числовом формате для последнего дня месяца, отстоящего вперед или назад на заданное число месяцев.
HOUR = ЧАС ## Преобразует дату в числовом формате в часы.
MINUTE = МИНУТЫ ## Преобразует дату в числовом формате в минуты.
MONTH = МЕСЯЦ ## Преобразует дату в числовом формате в месяцы.
NETWORKDAYS = ЧИСТРАБДНИ ## Возвращает количество рабочих дней между двумя датами.
NOW = ТДАТА ## Возвращает текущую дату и время в числовом формате.
SECOND = СЕКУНДЫ ## Преобразует дату в числовом формате в секунды.
TIME = ВРЕМЯ ## Возвращает заданное время в числовом формате.
TIMEVALUE = ВРЕМЗНАЧ ## Преобразует время из текстового формата в числовой формат.
TODAY = СЕГОДНЯ ## Возвращает текущую дату в числовом формате.
WEEKDAY = ДЕНЬНЕД ## Преобразует дату в числовом формате в день недели.
WEEKNUM = НОМНЕДЕЛИ ## Преобразует числовое представление в число, которое указывает, на какую неделю года приходится указанная дата.
WORKDAY = РАБДЕНЬ ## Возвращает дату в числовом формате, отстоящую вперед или назад на заданное количество рабочих дней.
YEAR = ГОД ## Преобразует дату в числовом формате в год.
YEARFRAC = ДОЛЯГОДА ## Возвращает долю года, которую составляет количество дней между начальной и конечной датами.
##
## Engineering functions Инженерные функции
##
BESSELI = БЕССЕЛЬ.I ## Возвращает модифицированную функцию Бесселя In(x).
BESSELJ = БЕССЕЛЬ.J ## Возвращает функцию Бесселя Jn(x).
BESSELK = БЕССЕЛЬ.K ## Возвращает модифицированную функцию Бесселя Kn(x).
BESSELY = БЕССЕЛЬ.Y ## Возвращает функцию Бесселя Yn(x).
BIN2DEC = ДВ.В.ДЕС ## Преобразует двоичное число в десятичное.
BIN2HEX = ДВ.В.ШЕСТН ## Преобразует двоичное число в шестнадцатеричное.
BIN2OCT = ДВ.В.ВОСЬМ ## Преобразует двоичное число в восьмеричное.
COMPLEX = КОМПЛЕКСН ## Преобразует коэффициенты при вещественной и мнимой частях комплексного числа в комплексное число.
CONVERT = ПРЕОБР ## Преобразует число из одной системы единиц измерения в другую.
DEC2BIN = ДЕС.В.ДВ ## Преобразует десятичное число в двоичное.
DEC2HEX = ДЕС.В.ШЕСТН ## Преобразует десятичное число в шестнадцатеричное.
DEC2OCT = ДЕС.В.ВОСЬМ ## Преобразует десятичное число в восьмеричное.
DELTA = ДЕЛЬТА ## Проверяет равенство двух значений.
ERF = ФОШ ## Возвращает функцию ошибки.
ERFC = ДФОШ ## Возвращает дополнительную функцию ошибки.
GESTEP = ПОРОГ ## Проверяет, не превышает ли данное число порогового значения.
HEX2BIN = ШЕСТН.В.ДВ ## Преобразует шестнадцатеричное число в двоичное.
HEX2DEC = ШЕСТН.В.ДЕС ## Преобразует шестнадцатеричное число в десятичное.
HEX2OCT = ШЕСТН.В.ВОСЬМ ## Преобразует шестнадцатеричное число в восьмеричное.
IMABS = МНИМ.ABS ## Возвращает абсолютную величину (модуль) комплексного числа.
IMAGINARY = МНИМ.ЧАСТЬ ## Возвращает коэффициент при мнимой части комплексного числа.
IMARGUMENT = МНИМ.АРГУМЕНТ ## Возвращает значение аргумента комплексного числа (тета) — угол, выраженный в радианах.
IMCONJUGATE = МНИМ.СОПРЯЖ ## Возвращает комплексно-сопряженное комплексное число.
IMCOS = МНИМ.COS ## Возвращает косинус комплексного числа.
IMDIV = МНИМ.ДЕЛ ## Возвращает частное от деления двух комплексных чисел.
IMEXP = МНИМ.EXP ## Возвращает экспоненту комплексного числа.
IMLN = МНИМ.LN ## Возвращает натуральный логарифм комплексного числа.
IMLOG10 = МНИМ.LOG10 ## Возвращает обычный (десятичный) логарифм комплексного числа.
IMLOG2 = МНИМ.LOG2 ## Возвращает двоичный логарифм комплексного числа.
IMPOWER = МНИМ.СТЕПЕНЬ ## Возвращает комплексное число, возведенное в целую степень.
IMPRODUCT = МНИМ.ПРОИЗВЕД ## Возвращает произведение от 2 до 29 комплексных чисел.
IMREAL = МНИМ.ВЕЩ ## Возвращает коэффициент при вещественной части комплексного числа.
IMSIN = МНИМ.SIN ## Возвращает синус комплексного числа.
IMSQRT = МНИМ.КОРЕНЬ ## Возвращает значение квадратного корня из комплексного числа.
IMSUB = МНИМ.РАЗН ## Возвращает разность двух комплексных чисел.
IMSUM = МНИМ.СУММ ## Возвращает сумму комплексных чисел.
OCT2BIN = ВОСЬМ.В.ДВ ## Преобразует восьмеричное число в двоичное.
OCT2DEC = ВОСЬМ.В.ДЕС ## Преобразует восьмеричное число в десятичное.
OCT2HEX = ВОСЬМ.В.ШЕСТН ## Преобразует восьмеричное число в шестнадцатеричное.
##
## Financial functions Финансовые функции
##
ACCRINT = НАКОПДОХОД ## Возвращает накопленный процент по ценным бумагам с периодической выплатой процентов.
ACCRINTM = НАКОПДОХОДПОГАШ ## Возвращает накопленный процент по ценным бумагам, проценты по которым выплачиваются в срок погашения.
AMORDEGRC = АМОРУМ ## Возвращает величину амортизации для каждого периода, используя коэффициент амортизации.
AMORLINC = АМОРУВ ## Возвращает величину амортизации для каждого периода.
COUPDAYBS = ДНЕЙКУПОНДО ## Возвращает количество дней от начала действия купона до даты соглашения.
COUPDAYS = ДНЕЙКУПОН ## Возвращает число дней в периоде купона, содержащем дату соглашения.
COUPDAYSNC = ДНЕЙКУПОНПОСЛЕ ## Возвращает число дней от даты соглашения до срока следующего купона.
COUPNCD = ДАТАКУПОНПОСЛЕ ## Возвращает следующую дату купона после даты соглашения.
COUPNUM = ЧИСЛКУПОН ## Возвращает количество купонов, которые могут быть оплачены между датой соглашения и сроком вступления в силу.
COUPPCD = ДАТАКУПОНДО ## Возвращает предыдущую дату купона перед датой соглашения.
CUMIPMT = ОБЩПЛАТ ## Возвращает общую выплату, произведенную между двумя периодическими выплатами.
CUMPRINC = ОБЩДОХОД ## Возвращает общую выплату по займу между двумя периодами.
DB = ФУО ## Возвращает величину амортизации актива для заданного периода, рассчитанную методом фиксированного уменьшения остатка.
DDB = ДДОБ ## Возвращает величину амортизации актива за данный период, используя метод двойного уменьшения остатка или иной явно указанный метод.
DISC = СКИДКА ## Возвращает норму скидки для ценных бумаг.
DOLLARDE = РУБЛЬ.ДЕС ## Преобразует цену в рублях, выраженную в виде дроби, в цену в рублях, выраженную десятичным числом.
DOLLARFR = РУБЛЬ.ДРОБЬ ## Преобразует цену в рублях, выраженную десятичным числом, в цену в рублях, выраженную в виде дроби.
DURATION = ДЛИТ ## Возвращает ежегодную продолжительность действия ценных бумаг с периодическими выплатами по процентам.
EFFECT = ЭФФЕКТ ## Возвращает действующие ежегодные процентные ставки.
FV = БС ## Возвращает будущую стоимость инвестиции.
FVSCHEDULE = БЗРАСПИС ## Возвращает будущую стоимость первоначальной основной суммы после начисления ряда сложных процентов.
INTRATE = ИНОРМА ## Возвращает процентную ставку для полностью инвестированных ценных бумаг.
IPMT = ПРПЛТ ## Возвращает величину выплаты прибыли на вложения за данный период.
IRR = ВСД ## Возвращает внутреннюю ставку доходности для ряда потоков денежных средств.
ISPMT = ПРОЦПЛАТ ## Вычисляет выплаты за указанный период инвестиции.
MDURATION = МДЛИТ ## Возвращает модифицированную длительность Маколея для ценных бумаг с предполагаемой номинальной стоимостью 100 рублей.
MIRR = МВСД ## Возвращает внутреннюю ставку доходности, при которой положительные и отрицательные денежные потоки имеют разные значения ставки.
NOMINAL = НОМИНАЛ ## Возвращает номинальную годовую процентную ставку.
NPER = КПЕР ## Возвращает общее количество периодов выплаты для данного вклада.
NPV = ЧПС ## Возвращает чистую приведенную стоимость инвестиции, основанной на серии периодических денежных потоков и ставке дисконтирования.
ODDFPRICE = ЦЕНАПЕРВНЕРЕГ ## Возвращает цену за 100 рублей нарицательной стоимости ценных бумаг с нерегулярным первым периодом.
ODDFYIELD = ДОХОДПЕРВНЕРЕГ ## Возвращает доход по ценным бумагам с нерегулярным первым периодом.
ODDLPRICE = ЦЕНАПОСЛНЕРЕГ ## Возвращает цену за 100 рублей нарицательной стоимости ценных бумаг с нерегулярным последним периодом.
ODDLYIELD = ДОХОДПОСЛНЕРЕГ ## Возвращает доход по ценным бумагам с нерегулярным последним периодом.
PMT = ПЛТ ## Возвращает величину выплаты за один период аннуитета.
PPMT = ОСПЛТ ## Возвращает величину выплат в погашение основной суммы по инвестиции за заданный период.
PRICE = ЦЕНА ## Возвращает цену за 100 рублей нарицательной стоимости ценных бумаг, по которым производится периодическая выплата процентов.
PRICEDISC = ЦЕНАСКИДКА ## Возвращает цену за 100 рублей номинальной стоимости ценных бумаг, на которые сделана скидка.
PRICEMAT = ЦЕНАПОГАШ ## Возвращает цену за 100 рублей номинальной стоимости ценных бумаг, проценты по которым выплачиваются в срок погашения.
PV = ПС ## Возвращает приведенную (к текущему моменту) стоимость инвестиции.
RATE = СТАВКА ## Возвращает процентную ставку по аннуитету за один период.
RECEIVED = ПОЛУЧЕНО ## Возвращает сумму, полученную к сроку погашения полностью обеспеченных ценных бумаг.
SLN = АПЛ ## Возвращает величину линейной амортизации актива за один период.
SYD = АСЧ ## Возвращает величину амортизации актива за данный период, рассчитанную методом суммы годовых чисел.
TBILLEQ = РАВНОКЧЕК ## Возвращает эквивалентный облигации доход по казначейскому чеку.
TBILLPRICE = ЦЕНАКЧЕК ## Возвращает цену за 100 рублей нарицательной стоимости для казначейского чека.
TBILLYIELD = ДОХОДКЧЕК ## Возвращает доход по казначейскому чеку.
VDB = ПУО ## Возвращает величину амортизации актива для указанного или частичного периода при использовании метода сокращающегося баланса.
XIRR = ЧИСТВНДОХ ## Возвращает внутреннюю ставку доходности для графика денежных потоков, которые не обязательно носят периодический характер.
XNPV = ЧИСТНЗ ## Возвращает чистую приведенную стоимость для денежных потоков, которые не обязательно являются периодическими.
YIELD = ДОХОД ## Возвращает доход от ценных бумаг, по которым производятся периодические выплаты процентов.
YIELDDISC = ДОХОДСКИДКА ## Возвращает годовой доход по ценным бумагам, на которые сделана скидка (пример — казначейские чеки).
YIELDMAT = ДОХОДПОГАШ ## Возвращает годовой доход от ценных бумаг, проценты по которым выплачиваются в срок погашения.
##
## Information functions Информационные функции
##
CELL = ЯЧЕЙКА ## Возвращает информацию о формате, расположении или содержимом ячейки.
ERROR.TYPE = ТИП.ОШИБКИ ## Возвращает числовой код, соответствующий типу ошибки.
INFO = ИНФОРМ ## Возвращает информацию о текущей операционной среде.
ISBLANK = ЕПУСТО ## Возвращает значение ИСТИНА, если аргумент является ссылкой на пустую ячейку.
ISERR = ЕОШ ## Возвращает значение ИСТИНА, если аргумент ссылается на любое значение ошибки, кроме #Н/Д.
ISERROR = ЕОШИБКА ## Возвращает значение ИСТИНА, если аргумент ссылается на любое значение ошибки.
ISEVEN = ЕЧЁТН ## Возвращает значение ИСТИНА, если значение аргумента является четным числом.
ISLOGICAL = ЕЛОГИЧ ## Возвращает значение ИСТИНА, если аргумент ссылается на логическое значение.
ISNA = ЕНД ## Возвращает значение ИСТИНА, если аргумент ссылается на значение ошибки #Н/Д.
ISNONTEXT = ЕНЕТЕКСТ ## Возвращает значение ИСТИНА, если значение аргумента не является текстом.
ISNUMBER = ЕЧИСЛО ## Возвращает значение ИСТИНА, если аргумент ссылается на число.
ISODD = ЕНЕЧЁТ ## Возвращает значение ИСТИНА, если значение аргумента является нечетным числом.
ISREF = ЕССЫЛКА ## Возвращает значение ИСТИНА, если значение аргумента является ссылкой.
ISTEXT = ЕТЕКСТ ## Возвращает значение ИСТИНА, если значение аргумента является текстом.
N = Ч ## Возвращает значение, преобразованное в число.
NA = НД ## Возвращает значение ошибки #Н/Д.
TYPE = ТИП ## Возвращает число, обозначающее тип данных значения.
##
## Logical functions Логические функции
##
AND = И ## Renvoie VRAI si tous ses arguments sont VRAI.
FALSE = ЛОЖЬ ## Возвращает логическое значение ЛОЖЬ.
IF = ЕСЛИ ## Выполняет проверку условия.
IFERROR = ЕСЛИОШИБКА ## Возвращает введённое значение, если вычисление по формуле вызывает ошибку; в противном случае функция возвращает результат вычисления.
NOT = НЕ ## Меняет логическое значение своего аргумента на противоположное.
OR = ИЛИ ## Возвращает значение ИСТИНА, если хотя бы один аргумент имеет значение ИСТИНА.
TRUE = ИСТИНА ## Возвращает логическое значение ИСТИНА.
##
## Lookup and reference functions Функции ссылки и поиска
##
ADDRESS = АДРЕС ## Возвращает ссылку на отдельную ячейку листа в виде текста.
AREAS = ОБЛАСТИ ## Возвращает количество областей в ссылке.
CHOOSE = ВЫБОР ## Выбирает значение из списка значений по индексу.
COLUMN = СТОЛБЕЦ ## Возвращает номер столбца, на который указывает ссылка.
COLUMNS = ЧИСЛСТОЛБ ## Возвращает количество столбцов в ссылке.
HLOOKUP = ГПР ## Ищет в первой строке массива и возвращает значение отмеченной ячейки
HYPERLINK = ГИПЕРССЫЛКА ## Создает ссылку, открывающую документ, который находится на сервере сети, в интрасети или в Интернете.
INDEX = ИНДЕКС ## Использует индекс для выбора значения из ссылки или массива.
INDIRECT = ДВССЫЛ ## Возвращает ссылку, заданную текстовым значением.
LOOKUP = ПРОСМОТР ## Ищет значения в векторе или массиве.
MATCH = ПОИСКПОЗ ## Ищет значения в ссылке или массиве.
OFFSET = СМЕЩ ## Возвращает смещение ссылки относительно заданной ссылки.
ROW = СТРОКА ## Возвращает номер строки, определяемой ссылкой.
ROWS = ЧСТРОК ## Возвращает количество строк в ссылке.
RTD = ДРВ ## Извлекает данные реального времени из программ, поддерживающих автоматизацию COM (Программирование объектов. Стандартное средство для работы с объектами некоторого приложения из другого приложения или средства разработки. Программирование объектов (ранее называемое программированием OLE) является функцией модели COM (Component Object Model, модель компонентных объектов).).
TRANSPOSE = ТРАНСП ## Возвращает транспонированный массив.
VLOOKUP = ВПР ## Ищет значение в первом столбце массива и возвращает значение из ячейки в найденной строке и указанном столбце.
##
## Math and trigonometry functions Математические и тригонометрические функции
##
ABS = ABS ## Возвращает модуль (абсолютную величину) числа.
ACOS = ACOS ## Возвращает арккосинус числа.
ACOSH = ACOSH ## Возвращает гиперболический арккосинус числа.
ASIN = ASIN ## Возвращает арксинус числа.
ASINH = ASINH ## Возвращает гиперболический арксинус числа.
ATAN = ATAN ## Возвращает арктангенс числа.
ATAN2 = ATAN2 ## Возвращает арктангенс для заданных координат x и y.
ATANH = ATANH ## Возвращает гиперболический арктангенс числа.
CEILING = ОКРВВЕРХ ## Округляет число до ближайшего целого или до ближайшего кратного указанному значению.
COMBIN = ЧИСЛКОМБ ## Возвращает количество комбинаций для заданного числа объектов.
COS = COS ## Возвращает косинус числа.
COSH = COSH ## Возвращает гиперболический косинус числа.
DEGREES = ГРАДУСЫ ## Преобразует радианы в градусы.
EVEN = ЧЁТН ## Округляет число до ближайшего четного целого.
EXP = EXP ## Возвращает число e, возведенное в указанную степень.
FACT = ФАКТР ## Возвращает факториал числа.
FACTDOUBLE = ДВФАКТР ## Возвращает двойной факториал числа.
FLOOR = ОКРВНИЗ ## Округляет число до ближайшего меньшего по модулю значения.
GCD = НОД ## Возвращает наибольший общий делитель.
INT = ЦЕЛОЕ ## Округляет число до ближайшего меньшего целого.
LCM = НОК ## Возвращает наименьшее общее кратное.
LN = LN ## Возвращает натуральный логарифм числа.
LOG = LOG ## Возвращает логарифм числа по заданному основанию.
LOG10 = LOG10 ## Возвращает десятичный логарифм числа.
MDETERM = МОПРЕД ## Возвращает определитель матрицы массива.
MINVERSE = МОБР ## Возвращает обратную матрицу массива.
MMULT = МУМНОЖ ## Возвращает произведение матриц двух массивов.
MOD = ОСТАТ ## Возвращает остаток от деления.
MROUND = ОКРУГЛТ ## Возвращает число, округленное с требуемой точностью.
MULTINOMIAL = МУЛЬТИНОМ ## Возвращает мультиномиальный коэффициент множества чисел.
ODD = НЕЧЁТ ## Округляет число до ближайшего нечетного целого.
PI = ПИ ## Возвращает число пи.
POWER = СТЕПЕНЬ ## Возвращает результат возведения числа в степень.
PRODUCT = ПРОИЗВЕД ## Возвращает произведение аргументов.
QUOTIENT = ЧАСТНОЕ ## Возвращает целую часть частного при делении.
RADIANS = РАДИАНЫ ## Преобразует градусы в радианы.
RAND = СЛЧИС ## Возвращает случайное число в интервале от 0 до 1.
RANDBETWEEN = СЛУЧМЕЖДУ ## Возвращает случайное число в интервале между двумя заданными числами.
ROMAN = РИМСКОЕ ## Преобразует арабские цифры в римские в виде текста.
ROUND = ОКРУГЛ ## Округляет число до указанного количества десятичных разрядов.
ROUNDDOWN = ОКРУГЛВНИЗ ## Округляет число до ближайшего меньшего по модулю значения.
ROUNDUP = ОКРУГЛВВЕРХ ## Округляет число до ближайшего большего по модулю значения.
SERIESSUM = РЯД.СУММ ## Возвращает сумму степенного ряда, вычисленную по формуле.
SIGN = ЗНАК ## Возвращает знак числа.
SIN = SIN ## Возвращает синус заданного угла.
SINH = SINH ## Возвращает гиперболический синус числа.
SQRT = КОРЕНЬ ## Возвращает положительное значение квадратного корня.
SQRTPI = КОРЕНЬПИ ## Возвращает квадратный корень из значения выражения (число * ПИ).
SUBTOTAL = ПРОМЕЖУТОЧНЫЕ.ИТОГИ ## Возвращает промежуточный итог в списке или базе данных.
SUM = СУММ ## Суммирует аргументы.
SUMIF = СУММЕСЛИ ## Суммирует ячейки, удовлетворяющие заданному условию.
SUMIFS = СУММЕСЛИМН ## Суммирует диапазон ячеек, удовлетворяющих нескольким условиям.
SUMPRODUCT = СУММПРОИЗВ ## Возвращает сумму произведений соответствующих элементов массивов.
SUMSQ = СУММКВ ## Возвращает сумму квадратов аргументов.
SUMX2MY2 = СУММРАЗНКВ ## Возвращает сумму разностей квадратов соответствующих значений в двух массивах.
SUMX2PY2 = СУММСУММКВ ## Возвращает сумму сумм квадратов соответствующих элементов двух массивов.
SUMXMY2 = СУММКВРАЗН ## Возвращает сумму квадратов разностей соответствующих значений в двух массивах.
TAN = TAN ## Возвращает тангенс числа.
TANH = TANH ## Возвращает гиперболический тангенс числа.
TRUNC = ОТБР ## Отбрасывает дробную часть числа.
##
## Statistical functions Статистические функции
##
AVEDEV = СРОТКЛ ## Возвращает среднее арифметическое абсолютных значений отклонений точек данных от среднего.
AVERAGE = СРЗНАЧ ## Возвращает среднее арифметическое аргументов.
AVERAGEA = СРЗНАЧА ## Возвращает среднее арифметическое аргументов, включая числа, текст и логические значения.
AVERAGEIF = СРЗНАЧЕСЛИ ## Возвращает среднее значение (среднее арифметическое) всех ячеек в диапазоне, которые удовлетворяют данному условию.
AVERAGEIFS = СРЗНАЧЕСЛИМН ## Возвращает среднее значение (среднее арифметическое) всех ячеек, которые удовлетворяют нескольким условиям.
BETADIST = БЕТАРАСП ## Возвращает интегральную функцию бета-распределения.
BETAINV = БЕТАОБР ## Возвращает обратную интегральную функцию указанного бета-распределения.
BINOMDIST = БИНОМРАСП ## Возвращает отдельное значение биномиального распределения.
CHIDIST = ХИ2РАСП ## Возвращает одностороннюю вероятность распределения хи-квадрат.
CHIINV = ХИ2ОБР ## Возвращает обратное значение односторонней вероятности распределения хи-квадрат.
CHITEST = ХИ2ТЕСТ ## Возвращает тест на независимость.
CONFIDENCE = ДОВЕРИТ ## Возвращает доверительный интервал для среднего значения по генеральной совокупности.
CORREL = КОРРЕЛ ## Возвращает коэффициент корреляции между двумя множествами данных.
COUNT = СЧЁТ ## Подсчитывает количество чисел в списке аргументов.
COUNTA = СЧЁТЗ ## Подсчитывает количество значений в списке аргументов.
COUNTBLANK = СЧИТАТЬПУСТОТЫ ## Подсчитывает количество пустых ячеек в диапазоне
COUNTIF = СЧЁТЕСЛИ ## Подсчитывает количество ячеек в диапазоне, удовлетворяющих заданному условию
COUNTIFS = СЧЁТЕСЛИМН ## Подсчитывает количество ячеек внутри диапазона, удовлетворяющих нескольким условиям.
COVAR = КОВАР ## Возвращает ковариацию, среднее произведений парных отклонений
CRITBINOM = КРИТБИНОМ ## Возвращает наименьшее значение, для которого интегральное биномиальное распределение меньше или равно заданному критерию.
DEVSQ = КВАДРОТКЛ ## Возвращает сумму квадратов отклонений.
EXPONDIST = ЭКСПРАСП ## Возвращает экспоненциальное распределение.
FDIST = FРАСП ## Возвращает F-распределение вероятности.
FINV = FРАСПОБР ## Возвращает обратное значение для F-распределения вероятности.
FISHER = ФИШЕР ## Возвращает преобразование Фишера.
FISHERINV = ФИШЕРОБР ## Возвращает обратное преобразование Фишера.
FORECAST = ПРЕДСКАЗ ## Возвращает значение линейного тренда.
FREQUENCY = ЧАСТОТА ## Возвращает распределение частот в виде вертикального массива.
FTEST = ФТЕСТ ## Возвращает результат F-теста.
GAMMADIST = ГАММАРАСП ## Возвращает гамма-распределение.
GAMMAINV = ГАММАОБР ## Возвращает обратное гамма-распределение.
GAMMALN = ГАММАНЛОГ ## Возвращает натуральный логарифм гамма функции, Γ(x).
GEOMEAN = СРГЕОМ ## Возвращает среднее геометрическое.
GROWTH = РОСТ ## Возвращает значения в соответствии с экспоненциальным трендом.
HARMEAN = СРГАРМ ## Возвращает среднее гармоническое.
HYPGEOMDIST = ГИПЕРГЕОМЕТ ## Возвращает гипергеометрическое распределение.
INTERCEPT = ОТРЕЗОК ## Возвращает отрезок, отсекаемый на оси линией линейной регрессии.
KURT = ЭКСЦЕСС ## Возвращает эксцесс множества данных.
LARGE = НАИБОЛЬШИЙ ## Возвращает k-ое наибольшее значение в множестве данных.
LINEST = ЛИНЕЙН ## Возвращает параметры линейного тренда.
LOGEST = ЛГРФПРИБЛ ## Возвращает параметры экспоненциального тренда.
LOGINV = ЛОГНОРМОБР ## Возвращает обратное логарифмическое нормальное распределение.
LOGNORMDIST = ЛОГНОРМРАСП ## Возвращает интегральное логарифмическое нормальное распределение.
MAX = МАКС ## Возвращает наибольшее значение в списке аргументов.
MAXA = МАКСА ## Возвращает наибольшее значение в списке аргументов, включая числа, текст и логические значения.
MEDIAN = МЕДИАНА ## Возвращает медиану заданных чисел.
MIN = МИН ## Возвращает наименьшее значение в списке аргументов.
MINA = МИНА ## Возвращает наименьшее значение в списке аргументов, включая числа, текст и логические значения.
MODE = МОДА ## Возвращает значение моды множества данных.
NEGBINOMDIST = ОТРБИНОМРАСП ## Возвращает отрицательное биномиальное распределение.
NORMDIST = НОРМРАСП ## Возвращает нормальную функцию распределения.
NORMINV = НОРМОБР ## Возвращает обратное нормальное распределение.
NORMSDIST = НОРМСТРАСП ## Возвращает стандартное нормальное интегральное распределение.
NORMSINV = НОРМСТОБР ## Возвращает обратное значение стандартного нормального распределения.
PEARSON = ПИРСОН ## Возвращает коэффициент корреляции Пирсона.
PERCENTILE = ПЕРСЕНТИЛЬ ## Возвращает k-ую персентиль для значений диапазона.
PERCENTRANK = ПРОЦЕНТРАНГ ## Возвращает процентную норму значения в множестве данных.
PERMUT = ПЕРЕСТ ## Возвращает количество перестановок для заданного числа объектов.
POISSON = ПУАССОН ## Возвращает распределение Пуассона.
PROB = ВЕРОЯТНОСТЬ ## Возвращает вероятность того, что значение из диапазона находится внутри заданных пределов.
QUARTILE = КВАРТИЛЬ ## Возвращает квартиль множества данных.
RANK = РАНГ ## Возвращает ранг числа в списке чисел.
RSQ = КВПИРСОН ## Возвращает квадрат коэффициента корреляции Пирсона.
SKEW = СКОС ## Возвращает асимметрию распределения.
SLOPE = НАКЛОН ## Возвращает наклон линии линейной регрессии.
SMALL = НАИМЕНЬШИЙ ## Возвращает k-ое наименьшее значение в множестве данных.
STANDARDIZE = НОРМАЛИЗАЦИЯ ## Возвращает нормализованное значение.
STDEV = СТАНДОТКЛОН ## Оценивает стандартное отклонение по выборке.
STDEVA = СТАНДОТКЛОНА ## Оценивает стандартное отклонение по выборке, включая числа, текст и логические значения.
STDEVP = СТАНДОТКЛОНП ## Вычисляет стандартное отклонение по генеральной совокупности.
STDEVPA = СТАНДОТКЛОНПА ## Вычисляет стандартное отклонение по генеральной совокупности, включая числа, текст и логические значения.
STEYX = СТОШYX ## Возвращает стандартную ошибку предсказанных значений y для каждого значения x в регрессии.
TDIST = СТЬЮДРАСП ## Возвращает t-распределение Стьюдента.
TINV = СТЬЮДРАСПОБР ## Возвращает обратное t-распределение Стьюдента.
TREND = ТЕНДЕНЦИЯ ## Возвращает значения в соответствии с линейным трендом.
TRIMMEAN = УРЕЗСРЕДНЕЕ ## Возвращает среднее внутренности множества данных.
TTEST = ТТЕСТ ## Возвращает вероятность, соответствующую критерию Стьюдента.
VAR = ДИСП ## Оценивает дисперсию по выборке.
VARA = ДИСПА ## Оценивает дисперсию по выборке, включая числа, текст и логические значения.
VARP = ДИСПР ## Вычисляет дисперсию для генеральной совокупности.
VARPA = ДИСПРА ## Вычисляет дисперсию для генеральной совокупности, включая числа, текст и логические значения.
WEIBULL = ВЕЙБУЛЛ ## Возвращает распределение Вейбулла.
ZTEST = ZТЕСТ ## Возвращает двустороннее P-значение z-теста.
##
## Text functions Текстовые функции
##
ASC = ASC ## Для языков с двухбайтовыми наборами знаков (например, катакана) преобразует полноширинные (двухбайтовые) знаки в полуширинные (однобайтовые).
BAHTTEXT = БАТТЕКСТ ## Преобразует число в текст, используя денежный формат ß (БАТ).
CHAR = СИМВОЛ ## Возвращает знак с заданным кодом.
CLEAN = ПЕЧСИМВ ## Удаляет все непечатаемые знаки из текста.
CODE = КОДСИМВ ## Возвращает числовой код первого знака в текстовой строке.
CONCATENATE = СЦЕПИТЬ ## Объединяет несколько текстовых элементов в один.
DOLLAR = РУБЛЬ ## Преобразует число в текст, используя денежный формат.
EXACT = СОВПАД ## Проверяет идентичность двух текстовых значений.
FIND = НАЙТИ ## Ищет вхождения одного текстового значения в другом (с учетом регистра).
FINDB = НАЙТИБ ## Ищет вхождения одного текстового значения в другом (с учетом регистра).
FIXED = ФИКСИРОВАННЫЙ ## Форматирует число и преобразует его в текст с заданным числом десятичных знаков.
JIS = JIS ## Для языков с двухбайтовыми наборами знаков (например, катакана) преобразует полуширинные (однобайтовые) знаки в текстовой строке в полноширинные (двухбайтовые).
LEFT = ЛЕВСИМВ ## Возвращает крайние слева знаки текстового значения.
LEFTB = ЛЕВБ ## Возвращает крайние слева знаки текстового значения.
LEN = ДЛСТР ## Возвращает количество знаков в текстовой строке.
LENB = ДЛИНБ ## Возвращает количество знаков в текстовой строке.
LOWER = СТРОЧН ## Преобразует все буквы текста в строчные.
MID = ПСТР ## Возвращает заданное число знаков из строки текста, начиная с указанной позиции.
MIDB = ПСТРБ ## Возвращает заданное число знаков из строки текста, начиная с указанной позиции.
PHONETIC = PHONETIC ## Извлекает фонетические (фуригана) знаки из текстовой строки.
PROPER = ПРОПНАЧ ## Преобразует первую букву в каждом слове текста в прописную.
REPLACE = ЗАМЕНИТЬ ## Заменяет знаки в тексте.
REPLACEB = ЗАМЕНИТЬБ ## Заменяет знаки в тексте.
REPT = ПОВТОР ## Повторяет текст заданное число раз.
RIGHT = ПРАВСИМВ ## Возвращает крайние справа знаки текстовой строки.
RIGHTB = ПРАВБ ## Возвращает крайние справа знаки текстовой строки.
SEARCH = ПОИСК ## Ищет вхождения одного текстового значения в другом (без учета регистра).
SEARCHB = ПОИСКБ ## Ищет вхождения одного текстового значения в другом (без учета регистра).
SUBSTITUTE = ПОДСТАВИТЬ ## Заменяет в текстовой строке старый текст новым.
T = Т ## Преобразует аргументы в текст.
TEXT = ТЕКСТ ## Форматирует число и преобразует его в текст.
TRIM = СЖПРОБЕЛЫ ## Удаляет из текста пробелы.
UPPER = ПРОПИСН ## Преобразует все буквы текста в прописные.
VALUE = ЗНАЧЕН ## Преобразует текстовый аргумент в число.
PK ! 9H}B B PHPExcel/locale/ru/confignu [ ##
## PHPExcel
##
## Copyright (c) 2006 - 2013 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
##
## @category PHPExcel
## @package PHPExcel_Settings
## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
## @version 1.8.0, 2014-03-02
##
##
ArgumentSeparator = ;
##
## (For future use)
##
currencySymbol = р
##
## Excel Error Codes (For future use)
##
NULL = #ПУСТО!
DIV0 = #ДЕЛ/0!
VALUE = #ЗНАЧ!
REF = #ССЫЛ!
NAME = #ИМЯ?
NUM = #ЧИСЛО!
NA = #Н/Д
PK ! d PHPExcel/locale/hu/functionsnu [ ##
## PHPExcel
##
## Copyright (c) 2006 - 2013 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
##
## @category PHPExcel
## @package PHPExcel_Calculation
## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
## @version 1.8.0, 2014-03-02
##
## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/
##
##
##
## Add-in and Automation functions Bővítmények és automatizálási függvények
##
GETPIVOTDATA = KIMUTATÁSADATOT.VESZ ## A kimutatásokban tárolt adatok visszaadására használható.
##
## Cube functions Kockafüggvények
##
CUBEKPIMEMBER = KOCKA.FŐTELJMUT ## Egy fő teljesítménymutató (KPI) nevét, tulajdonságát és mértékegységét adja eredményül, a nevet és a tulajdonságot megjeleníti a cellában. A KPI-k számszerűsíthető mérési lehetőséget jelentenek – ilyen mutató például a havi bruttó nyereség vagy az egy alkalmazottra jutó negyedéves forgalom –, egy szervezet teljesítményének nyomonkövetésére használhatók.
CUBEMEMBER = KOCKA.TAG ## Kockahierachia tagját vagy rekordját adja eredményül. Ellenőrizhető vele, hogy szerepel-e a kockában az adott tag vagy rekord.
CUBEMEMBERPROPERTY = KOCKA.TAG.TUL ## A kocka egyik tagtulajdonságának értékét adja eredményül. Használatával ellenőrizhető, hogy szerepel-e egy tagnév a kockában, eredménye pedig az erre a tagra vonatkozó, megadott tulajdonság.
CUBERANKEDMEMBER = KOCKA.HALM.ELEM ## Egy halmaz rangsor szerinti n-edik tagját adja eredményül. Használatával egy halmaz egy vagy több elemét kaphatja meg, például a legnagyobb teljesítményű üzletkötőt vagy a 10 legjobb tanulót.
CUBESET = KOCKA.HALM ## Számított tagok vagy rekordok halmazát adja eredményül, ehhez egy beállított kifejezést elküld a kiszolgálón található kockának, majd ezt a halmazt adja vissza a Microsoft Office Excel alkalmazásnak.
CUBESETCOUNT = KOCKA.HALM.DB ## Egy halmaz elemszámát adja eredményül.
CUBEVALUE = KOCKA.ÉRTÉK ## Kockából összesített értéket ad eredményül.
##
## Database functions Adatbázis-kezelő függvények
##
DAVERAGE = AB.ÁTLAG ## A kijelölt adatbáziselemek átlagát számítja ki.
DCOUNT = AB.DARAB ## Megszámolja, hogy az adatbázisban hány cella tartalmaz számokat.
DCOUNTA = AB.DARAB2 ## Megszámolja az adatbázisban lévő nem üres cellákat.
DGET = AB.MEZŐ ## Egy adatbázisból egyetlen olyan rekordot ad vissza, amely megfelel a megadott feltételeknek.
DMAX = AB.MAX ## A kiválasztott adatbáziselemek közül a legnagyobb értéket adja eredményül.
DMIN = AB.MIN ## A kijelölt adatbáziselemek közül a legkisebb értéket adja eredményül.
DPRODUCT = AB.SZORZAT ## Az adatbázis megadott feltételeknek eleget tevő rekordjaira összeszorozza a megadott mezőben található számértékeket, és eredményül ezt a szorzatot adja.
DSTDEV = AB.SZÓRÁS ## A kijelölt adatbáziselemek egy mintája alapján megbecsüli a szórást.
DSTDEVP = AB.SZÓRÁS2 ## A kijelölt adatbáziselemek teljes sokasága alapján kiszámítja a szórást.
DSUM = AB.SZUM ## Összeadja a feltételnek megfelelő adatbázisrekordok mezőoszlopában a számokat.
DVAR = AB.VAR ## A kijelölt adatbáziselemek mintája alapján becslést ad a szórásnégyzetre.
DVARP = AB.VAR2 ## A kijelölt adatbáziselemek teljes sokasága alapján kiszámítja a szórásnégyzetet.
##
## Date and time functions Dátumfüggvények
##
DATE = DÁTUM ## Adott dátum dátumértékét adja eredményül.
DATEVALUE = DÁTUMÉRTÉK ## Szövegként megadott dátumot dátumértékké alakít át.
DAY = NAP ## Dátumértéket a hónap egy napjává (0-31) alakít.
DAYS360 = NAP360 ## Két dátum közé eső napok számát számítja ki a 360 napos év alapján.
EDATE = EDATE ## Adott dátumnál adott számú hónappal korábbi vagy későbbi dátum dátumértékét adja eredményül.
EOMONTH = EOMONTH ## Adott dátumnál adott számú hónappal korábbi vagy későbbi hónap utolsó napjának dátumértékét adja eredményül.
HOUR = ÓRA ## Időértéket órákká alakít.
MINUTE = PERC ## Időértéket percekké alakít.
MONTH = HÓNAP ## Időértéket hónapokká alakít.
NETWORKDAYS = NETWORKDAYS ## Két dátum között a teljes munkanapok számát adja meg.
NOW = MOST ## A napi dátum dátumértékét és a pontos idő időértékét adja eredményül.
SECOND = MPERC ## Időértéket másodpercekké alakít át.
TIME = IDŐ ## Adott időpont időértékét adja meg.
TIMEVALUE = IDŐÉRTÉK ## Szövegként megadott időpontot időértékké alakít át.
TODAY = MA ## A napi dátum dátumértékét adja eredményül.
WEEKDAY = HÉT.NAPJA ## Dátumértéket a hét napjává alakítja át.
WEEKNUM = WEEKNUM ## Visszatérési értéke egy szám, amely azt mutatja meg, hogy a megadott dátum az év hányadik hetére esik.
WORKDAY = WORKDAY ## Adott dátumnál adott munkanappal korábbi vagy későbbi dátum dátumértékét adja eredményül.
YEAR = ÉV ## Sorszámot évvé alakít át.
YEARFRAC = YEARFRAC ## Az adott dátumok közötti teljes napok számát törtévként adja meg.
##
## Engineering functions Mérnöki függvények
##
BESSELI = BESSELI ## Az In(x) módosított Bessel-függvény értékét adja eredményül.
BESSELJ = BESSELJ ## A Jn(x) Bessel-függvény értékét adja eredményül.
BESSELK = BESSELK ## A Kn(x) módosított Bessel-függvény értékét adja eredményül.
BESSELY = BESSELY ## Az Yn(x) módosított Bessel-függvény értékét adja eredményül.
BIN2DEC = BIN2DEC ## Bináris számot decimálissá alakít át.
BIN2HEX = BIN2HEX ## Bináris számot hexadecimálissá alakít át.
BIN2OCT = BIN2OCT ## Bináris számot oktálissá alakít át.
COMPLEX = COMPLEX ## Valós és képzetes részből komplex számot képez.
CONVERT = CONVERT ## Mértékegységeket vált át.
DEC2BIN = DEC2BIN ## Decimális számot binárissá alakít át.
DEC2HEX = DEC2HEX ## Decimális számot hexadecimálissá alakít át.
DEC2OCT = DEC2OCT ## Decimális számot oktálissá alakít át.
DELTA = DELTA ## Azt vizsgálja, hogy két érték egyenlő-e.
ERF = ERF ## A hibafüggvény értékét adja eredményül.
ERFC = ERFC ## A kiegészített hibafüggvény értékét adja eredményül.
GESTEP = GESTEP ## Azt vizsgálja, hogy egy szám nagyobb-e adott küszöbértéknél.
HEX2BIN = HEX2BIN ## Hexadecimális számot binárissá alakít át.
HEX2DEC = HEX2DEC ## Hexadecimális számot decimálissá alakít át.
HEX2OCT = HEX2OCT ## Hexadecimális számot oktálissá alakít át.
IMABS = IMABS ## Komplex szám abszolút értékét (modulusát) adja eredményül.
IMAGINARY = IMAGINARY ## Komplex szám képzetes részét adja eredményül.
IMARGUMENT = IMARGUMENT ## A komplex szám radiánban kifejezett théta argumentumát adja eredményül.
IMCONJUGATE = IMCONJUGATE ## Komplex szám komplex konjugáltját adja eredményül.
IMCOS = IMCOS ## Komplex szám koszinuszát adja eredményül.
IMDIV = IMDIV ## Két komplex szám hányadosát adja eredményül.
IMEXP = IMEXP ## Az e szám komplex kitevőjű hatványát adja eredményül.
IMLN = IMLN ## Komplex szám természetes logaritmusát adja eredményül.
IMLOG10 = IMLOG10 ## Komplex szám tízes alapú logaritmusát adja eredményül.
IMLOG2 = IMLOG2 ## Komplex szám kettes alapú logaritmusát adja eredményül.
IMPOWER = IMPOWER ## Komplex szám hatványát adja eredményül.
IMPRODUCT = IMPRODUCT ## Komplex számok szorzatát adja eredményül.
IMREAL = IMREAL ## Komplex szám valós részét adja eredményül.
IMSIN = IMSIN ## Komplex szám szinuszát adja eredményül.
IMSQRT = IMSQRT ## Komplex szám négyzetgyökét adja eredményül.
IMSUB = IMSUB ## Két komplex szám különbségét adja eredményül.
IMSUM = IMSUM ## Komplex számok összegét adja eredményül.
OCT2BIN = OCT2BIN ## Oktális számot binárissá alakít át.
OCT2DEC = OCT2DEC ## Oktális számot decimálissá alakít át.
OCT2HEX = OCT2HEX ## Oktális számot hexadecimálissá alakít át.
##
## Financial functions Pénzügyi függvények
##
ACCRINT = ACCRINT ## Periodikusan kamatozó értékpapír felszaporodott kamatát adja eredményül.
ACCRINTM = ACCRINTM ## Lejáratkor kamatozó értékpapír felszaporodott kamatát adja eredményül.
AMORDEGRC = AMORDEGRC ## Állóeszköz lineáris értékcsökkenését adja meg az egyes könyvelési időszakokra vonatkozóan.
AMORLINC = AMORLINC ## Az egyes könyvelési időszakokban az értékcsökkenést adja meg.
COUPDAYBS = COUPDAYBS ## A szelvényidőszak kezdetétől a kifizetés időpontjáig eltelt napokat adja vissza.
COUPDAYS = COUPDAYS ## A kifizetés időpontját magában foglaló szelvényperiódus hosszát adja meg napokban.
COUPDAYSNC = COUPDAYSNC ## A kifizetés időpontja és a legközelebbi szelvénydátum közötti napok számát adja meg.
COUPNCD = COUPNCD ## A kifizetést követő legelső szelvénydátumot adja eredményül.
COUPNUM = COUPNUM ## A kifizetés és a lejárat időpontja között kifizetendő szelvények számát adja eredményül.
COUPPCD = COUPPCD ## A kifizetés előtti utolsó szelvénydátumot adja eredményül.
CUMIPMT = CUMIPMT ## Két fizetési időszak között kifizetett kamat halmozott értékét adja eredményül.
CUMPRINC = CUMPRINC ## Két fizetési időszak között kifizetett részletek halmozott (kamatot nem tartalmazó) értékét adja eredményül.
DB = KCS2 ## Eszköz adott időszak alatti értékcsökkenését számítja ki a lineáris leírási modell alkalmazásával.
DDB = KCSA ## Eszköz értékcsökkenését számítja ki adott időszakra vonatkozóan a progresszív vagy egyéb megadott leírási modell alkalmazásával.
DISC = DISC ## Értékpapír leszámítolási kamatlábát adja eredményül.
DOLLARDE = DOLLARDE ## Egy közönséges törtként megadott számot tizedes törtté alakít át.
DOLLARFR = DOLLARFR ## Tizedes törtként megadott számot közönséges törtté alakít át.
DURATION = DURATION ## Periodikus kamatfizetésű értékpapír éves kamatérzékenységét adja eredményül.
EFFECT = EFFECT ## Az éves tényleges kamatláb értékét adja eredményül.
FV = JBÉ ## Befektetés jövőbeli értékét számítja ki.
FVSCHEDULE = FVSCHEDULE ## A kezdőtőke adott kamatlábak szerint megnövelt jövőbeli értékét adja eredményül.
INTRATE = INTRATE ## A lejáratig teljesen lekötött értékpapír kamatrátáját adja eredményül.
IPMT = RRÉSZLET ## Hiteltörlesztésen belül a tőketörlesztés nagyságát számítja ki adott időszakra.
IRR = BMR ## A befektetés belső megtérülési rátáját számítja ki pénzáramláshoz.
ISPMT = LRÉSZLETKAMAT ## A befektetés adott időszakára fizetett kamatot számítja ki.
MDURATION = MDURATION ## Egy 100 Ft névértékű értékpapír Macauley-féle módosított kamatérzékenységét adja eredményül.
MIRR = MEGTÉRÜLÉS ## A befektetés belső megtérülési rátáját számítja ki a költségek és a bevételek különböző kamatlába mellett.
NOMINAL = NOMINAL ## Az éves névleges kamatláb értékét adja eredményül.
NPER = PER.SZÁM ## A törlesztési időszakok számát adja meg.
NPV = NMÉ ## Befektetéshez kapcsolódó pénzáramlás nettó jelenértékét számítja ki ismert pénzáramlás és kamatláb mellett.
ODDFPRICE = ODDFPRICE ## Egy 100 Ft névértékű, a futamidő elején töredék-időszakos értékpapír árát adja eredményül.
ODDFYIELD = ODDFYIELD ## A futamidő elején töredék-időszakos értékpapír hozamát adja eredményül.
ODDLPRICE = ODDLPRICE ## Egy 100 Ft névértékű, a futamidő végén töredék-időszakos értékpapír árát adja eredményül.
ODDLYIELD = ODDLYIELD ## A futamidő végén töredék-időszakos értékpapír hozamát adja eredményül.
PMT = RÉSZLET ## A törlesztési időszakra vonatkozó törlesztési összeget számítja ki.
PPMT = PRÉSZLET ## Hiteltörlesztésen belül a tőketörlesztés nagyságát számítja ki adott időszakra.
PRICE = PRICE ## Egy 100 Ft névértékű, periodikusan kamatozó értékpapír árát adja eredményül.
PRICEDISC = PRICEDISC ## Egy 100 Ft névértékű leszámítolt értékpapír árát adja eredményül.
PRICEMAT = PRICEMAT ## Egy 100 Ft névértékű, a lejáratkor kamatozó értékpapír árát adja eredményül.
PV = MÉ ## Befektetés jelenlegi értékét számítja ki.
RATE = RÁTA ## Egy törlesztési időszakban az egy időszakra eső kamatláb nagyságát számítja ki.
RECEIVED = RECEIVED ## A lejáratig teljesen lekötött értékpapír lejáratakor kapott összegét adja eredményül.
SLN = LCSA ## Tárgyi eszköz egy időszakra eső amortizációját adja meg bruttó érték szerinti lineáris leírási kulcsot alkalmazva.
SYD = SYD ## Tárgyi eszköz értékcsökkenését számítja ki adott időszakra az évek számjegyösszegével dolgozó módszer alapján.
TBILLEQ = TBILLEQ ## Kincstárjegy kötvény-egyenértékű hozamát adja eredményül.
TBILLPRICE = TBILLPRICE ## Egy 100 Ft névértékű kincstárjegy árát adja eredményül.
TBILLYIELD = TBILLYIELD ## Kincstárjegy hozamát adja eredményül.
VDB = ÉCSRI ## Tárgyi eszköz amortizációját számítja ki megadott vagy részidőszakra a csökkenő egyenleg módszerének alkalmazásával.
XIRR = XIRR ## Ütemezett készpénzforgalom (cash flow) belső megtérülési kamatrátáját adja eredményül.
XNPV = XNPV ## Ütemezett készpénzforgalom (cash flow) nettó jelenlegi értékét adja eredményül.
YIELD = YIELD ## Periodikusan kamatozó értékpapír hozamát adja eredményül.
YIELDDISC = YIELDDISC ## Leszámítolt értékpapír (például kincstárjegy) éves hozamát adja eredményül.
YIELDMAT = YIELDMAT ## Lejáratkor kamatozó értékpapír éves hozamát adja eredményül.
##
## Information functions Információs függvények
##
CELL = CELLA ## Egy cella formátumára, elhelyezkedésére vagy tartalmára vonatkozó adatokat ad eredményül.
ERROR.TYPE = HIBA.TÍPUS ## Egy hibatípushoz tartozó számot ad eredményül.
INFO = INFÓ ## A rendszer- és munkakörnyezet pillanatnyi állapotáról ad felvilágosítást.
ISBLANK = ÜRES ## Eredménye IGAZ, ha az érték üres.
ISERR = HIBA ## Eredménye IGAZ, ha az érték valamelyik hibaérték a #HIÁNYZIK kivételével.
ISERROR = HIBÁS ## Eredménye IGAZ, ha az érték valamelyik hibaérték.
ISEVEN = ISEVEN ## Eredménye IGAZ, ha argumentuma páros szám.
ISLOGICAL = LOGIKAI ## Eredménye IGAZ, ha az érték logikai érték.
ISNA = NINCS ## Eredménye IGAZ, ha az érték a #HIÁNYZIK hibaérték.
ISNONTEXT = NEM.SZÖVEG ## Eredménye IGAZ, ha az érték nem szöveg.
ISNUMBER = SZÁM ## Eredménye IGAZ, ha az érték szám.
ISODD = ISODD ## Eredménye IGAZ, ha argumentuma páratlan szám.
ISREF = HIVATKOZÁS ## Eredménye IGAZ, ha az érték hivatkozás.
ISTEXT = SZÖVEG.E ## Eredménye IGAZ, ha az érték szöveg.
N = N ## Argumentumának értékét számmá alakítja.
NA = HIÁNYZIK ## Eredménye a #HIÁNYZIK hibaérték.
TYPE = TÍPUS ## Érték adattípusának azonosítószámát adja eredményül.
##
## Logical functions Logikai függvények
##
AND = ÉS ## Eredménye IGAZ, ha minden argumentuma IGAZ.
FALSE = HAMIS ## A HAMIS logikai értéket adja eredményül.
IF = HA ## Logikai vizsgálatot hajt végre.
IFERROR = HAHIBA ## A megadott értéket adja vissza, ha egy képlet hibához vezet; más esetben a képlet értékét adja eredményül.
NOT = NEM ## Argumentuma értékének ellentettjét adja eredményül.
OR = VAGY ## Eredménye IGAZ, ha bármely argumentuma IGAZ.
TRUE = IGAZ ## Az IGAZ logikai értéket adja eredményül.
##
## Lookup and reference functions Keresési és hivatkozási függvények
##
ADDRESS = CÍM ## A munkalap egy cellájára való hivatkozást adja szövegként eredményül.
AREAS = TERÜLET ## Hivatkozásban a területek számát adja eredményül.
CHOOSE = VÁLASZT ## Értékek listájából választ ki egy elemet.
COLUMN = OSZLOP ## Egy hivatkozás oszlopszámát adja eredményül.
COLUMNS = OSZLOPOK ## A hivatkozásban található oszlopok számát adja eredményül.
HLOOKUP = VKERES ## A megadott tömb felső sorában adott értékű elemet keres, és a megtalált elem oszlopából adott sorban elhelyezkedő értékkel tér vissza.
HYPERLINK = HIPERHIVATKOZÁS ## Hálózati kiszolgálón, intraneten vagy az interneten tárolt dokumentumot megnyitó parancsikont vagy hivatkozást hoz létre.
INDEX = INDEX ## Tömb- vagy hivatkozás indexszel megadott értékét adja vissza.
INDIRECT = INDIREKT ## Szöveg megadott hivatkozást ad eredményül.
LOOKUP = KERES ## Vektorban vagy tömbben keres meg értékeket.
MATCH = HOL.VAN ## Hivatkozásban vagy tömbben értékeket keres.
OFFSET = OFSZET ## Hivatkozás egy másik hivatkozástól számított távolságát adja meg.
ROW = SOR ## Egy hivatkozás sorának számát adja meg.
ROWS = SOROK ## Egy hivatkozás sorainak számát adja meg.
RTD = RTD ## Valós idejű adatokat keres vissza a COM automatizmust (automatizálás: Egy alkalmazás objektumaival való munka másik alkalmazásból vagy fejlesztőeszközből. A korábban OLE automatizmusnak nevezett automatizálás iparági szabvány, a Component Object Model (COM) szolgáltatása.) támogató programból.
TRANSPOSE = TRANSZPONÁLÁS ## Egy tömb transzponáltját adja eredményül.
VLOOKUP = FKERES ## A megadott tömb bal szélső oszlopában megkeres egy értéket, majd annak sora és a megadott oszlop metszéspontjában levő értéked adja eredményül.
##
## Math and trigonometry functions Matematikai és trigonometrikus függvények
##
ABS = ABS ## Egy szám abszolút értékét adja eredményül.
ACOS = ARCCOS ## Egy szám arkusz koszinuszát számítja ki.
ACOSH = ACOSH ## Egy szám inverz koszinusz hiperbolikuszát számítja ki.
ASIN = ARCSIN ## Egy szám arkusz szinuszát számítja ki.
ASINH = ASINH ## Egy szám inverz szinusz hiperbolikuszát számítja ki.
ATAN = ARCTAN ## Egy szám arkusz tangensét számítja ki.
ATAN2 = ARCTAN2 ## X és y koordináták alapján számítja ki az arkusz tangens értéket.
ATANH = ATANH ## A szám inverz tangens hiperbolikuszát számítja ki.
CEILING = PLAFON ## Egy számot a legközelebbi egészre vagy a pontosságként megadott érték legközelebb eső többszörösére kerekít.
COMBIN = KOMBINÁCIÓK ## Adott számú objektum összes lehetséges kombinációinak számát számítja ki.
COS = COS ## Egy szám koszinuszát számítja ki.
COSH = COSH ## Egy szám koszinusz hiperbolikuszát számítja ki.
DEGREES = FOK ## Radiánt fokká alakít át.
EVEN = PÁROS ## Egy számot a legközelebbi páros egész számra kerekít.
EXP = KITEVŐ ## Az e adott kitevőjű hatványát adja eredményül.
FACT = FAKT ## Egy szám faktoriálisát számítja ki.
FACTDOUBLE = FACTDOUBLE ## Egy szám dupla faktoriálisát adja eredményül.
FLOOR = PADLÓ ## Egy számot lefelé, a nulla felé kerekít.
GCD = GCD ## A legnagyobb közös osztót adja eredményül.
INT = INT ## Egy számot lefelé kerekít a legközelebbi egészre.
LCM = LCM ## A legkisebb közös többszöröst adja eredményül.
LN = LN ## Egy szám természetes logaritmusát számítja ki.
LOG = LOG ## Egy szám adott alapú logaritmusát számítja ki.
LOG10 = LOG10 ## Egy szám 10-es alapú logaritmusát számítja ki.
MDETERM = MDETERM ## Egy tömb mátrix-determinánsát számítja ki.
MINVERSE = INVERZ.MÁTRIX ## Egy tömb mátrix inverzét adja eredményül.
MMULT = MSZORZAT ## Két tömb mátrix-szorzatát adja meg.
MOD = MARADÉK ## Egy szám osztási maradékát adja eredményül.
MROUND = MROUND ## A kívánt többszörösére kerekített értéket ad eredményül.
MULTINOMIAL = MULTINOMIAL ## Számhalmaz multinomiálisát adja eredményül.
ODD = PÁRATLAN ## Egy számot a legközelebbi páratlan számra kerekít.
PI = PI ## A pi matematikai állandót adja vissza.
POWER = HATVÁNY ## Egy szám adott kitevőjű hatványát számítja ki.
PRODUCT = SZORZAT ## Argumentumai szorzatát számítja ki.
QUOTIENT = QUOTIENT ## Egy hányados egész részét adja eredményül.
RADIANS = RADIÁN ## Fokot radiánná alakít át.
RAND = VÉL ## Egy 0 és 1 közötti véletlen számot ad eredményül.
RANDBETWEEN = RANDBETWEEN ## Megadott számok közé eső véletlen számot állít elő.
ROMAN = RÓMAI ## Egy számot római számokkal kifejezve szövegként ad eredményül.
ROUND = KEREKÍTÉS ## Egy számot adott számú számjegyre kerekít.
ROUNDDOWN = KEREKÍTÉS.LE ## Egy számot lefelé, a nulla felé kerekít.
ROUNDUP = KEREKÍTÉS.FEL ## Egy számot felfelé, a nullától távolabbra kerekít.
SERIESSUM = SERIESSUM ## Hatványsor összegét adja eredményül.
SIGN = ELŐJEL ## Egy szám előjelét adja meg.
SIN = SIN ## Egy szög szinuszát számítja ki.
SINH = SINH ## Egy szám szinusz hiperbolikuszát számítja ki.
SQRT = GYÖK ## Egy szám pozitív négyzetgyökét számítja ki.
SQRTPI = SQRTPI ## A (szám*pi) négyzetgyökét adja eredményül.
SUBTOTAL = RÉSZÖSSZEG ## Lista vagy adatbázis részösszegét adja eredményül.
SUM = SZUM ## Összeadja az argumentumlistájában lévő számokat.
SUMIF = SZUMHA ## A megadott feltételeknek eleget tevő cellákban található értékeket adja össze.
SUMIFS = SZUMHATÖBB ## Több megadott feltételnek eleget tévő tartománycellák összegét adja eredményül.
SUMPRODUCT = SZORZATÖSSZEG ## A megfelelő tömbelemek szorzatának összegét számítja ki.
SUMSQ = NÉGYZETÖSSZEG ## Argumentumai négyzetének összegét számítja ki.
SUMX2MY2 = SZUMX2BŐLY2 ## Két tömb megfelelő elemei négyzetének különbségét összegzi.
SUMX2PY2 = SZUMX2MEGY2 ## Két tömb megfelelő elemei négyzetének összegét összegzi.
SUMXMY2 = SZUMXBŐLY2 ## Két tömb megfelelő elemei különbségének négyzetösszegét számítja ki.
TAN = TAN ## Egy szám tangensét számítja ki.
TANH = TANH ## Egy szám tangens hiperbolikuszát számítja ki.
TRUNC = CSONK ## Egy számot egésszé csonkít.
##
## Statistical functions Statisztikai függvények
##
AVEDEV = ÁTL.ELTÉRÉS ## Az adatpontoknak átlaguktól való átlagos abszolút eltérését számítja ki.
AVERAGE = ÁTLAG ## Argumentumai átlagát számítja ki.
AVERAGEA = ÁTLAGA ## Argumentumai átlagát számítja ki (beleértve a számokat, szöveget és logikai értékeket).
AVERAGEIF = ÁTLAGHA ## A megadott feltételnek eleget tévő tartomány celláinak átlagát (számtani közepét) adja eredményül.
AVERAGEIFS = ÁTLAGHATÖBB ## A megadott feltételeknek eleget tévő cellák átlagát (számtani közepét) adja eredményül.
BETADIST = BÉTA.ELOSZLÁS ## A béta-eloszlás függvényt számítja ki.
BETAINV = INVERZ.BÉTA ## Adott béta-eloszláshoz kiszámítja a béta eloszlásfüggvény inverzét.
BINOMDIST = BINOM.ELOSZLÁS ## A diszkrét binomiális eloszlás valószínűségértékét számítja ki.
CHIDIST = KHI.ELOSZLÁS ## A khi-négyzet-eloszlás egyszélű valószínűségértékét számítja ki.
CHIINV = INVERZ.KHI ## A khi-négyzet-eloszlás egyszélű valószínűségértékének inverzét számítja ki.
CHITEST = KHI.PRÓBA ## Függetlenségvizsgálatot hajt végre.
CONFIDENCE = MEGBÍZHATÓSÁG ## Egy statisztikai sokaság várható értékének megbízhatósági intervallumát adja eredményül.
CORREL = KORREL ## Két adathalmaz korrelációs együtthatóját számítja ki.
COUNT = DARAB ## Megszámolja, hogy argumentumlistájában hány szám található.
COUNTA = DARAB2 ## Megszámolja, hogy argumentumlistájában hány érték található.
COUNTBLANK = DARABÜRES ## Egy tartományban összeszámolja az üres cellákat.
COUNTIF = DARABTELI ## Egy tartományban összeszámolja azokat a cellákat, amelyek eleget tesznek a megadott feltételnek.
COUNTIFS = DARABHATÖBB ## Egy tartományban összeszámolja azokat a cellákat, amelyek eleget tesznek több feltételnek.
COVAR = KOVAR ## A kovarianciát, azaz a páronkénti eltérések szorzatának átlagát számítja ki.
CRITBINOM = KRITBINOM ## Azt a legkisebb számot adja eredményül, amelyre a binomiális eloszlásfüggvény értéke nem kisebb egy adott határértéknél.
DEVSQ = SQ ## Az átlagtól való eltérések négyzetének összegét számítja ki.
EXPONDIST = EXP.ELOSZLÁS ## Az exponenciális eloszlás értékét számítja ki.
FDIST = F.ELOSZLÁS ## Az F-eloszlás értékét számítja ki.
FINV = INVERZ.F ## Az F-eloszlás inverzének értékét számítja ki.
FISHER = FISHER ## Fisher-transzformációt hajt végre.
FISHERINV = INVERZ.FISHER ## A Fisher-transzformáció inverzét hajtja végre.
FORECAST = ELŐREJELZÉS ## Az ismert értékek alapján lineáris regresszióval becsült értéket ad eredményül.
FREQUENCY = GYAKORISÁG ## A gyakorisági vagy empirikus eloszlás értékét függőleges tömbként adja eredményül.
FTEST = F.PRÓBA ## Az F-próba értékét adja eredményül.
GAMMADIST = GAMMA.ELOSZLÁS ## A gamma-eloszlás értékét számítja ki.
GAMMAINV = INVERZ.GAMMA ## A gamma-eloszlás eloszlásfüggvénye inverzének értékét számítja ki.
GAMMALN = GAMMALN ## A gamma-függvény természetes logaritmusát számítja ki.
GEOMEAN = MÉRTANI.KÖZÉP ## Argumentumai mértani középértékét számítja ki.
GROWTH = NÖV ## Exponenciális regresszió alapján ad becslést.
HARMEAN = HARM.KÖZÉP ## Argumentumai harmonikus átlagát számítja ki.
HYPGEOMDIST = HIPERGEOM.ELOSZLÁS ## A hipergeometriai eloszlás értékét számítja ki.
INTERCEPT = METSZ ## A regressziós egyenes y tengellyel való metszéspontját határozza meg.
KURT = CSÚCSOSSÁG ## Egy adathalmaz csúcsosságát számítja ki.
LARGE = NAGY ## Egy adathalmaz k-adik legnagyobb elemét adja eredményül.
LINEST = LIN.ILL ## A legkisebb négyzetek módszerével az adatokra illesztett egyenes paramétereit határozza meg.
LOGEST = LOG.ILL ## Az adatokra illesztett exponenciális görbe paramétereit határozza meg.
LOGINV = INVERZ.LOG.ELOSZLÁS ## A lognormális eloszlás inverzét számítja ki.
LOGNORMDIST = LOG.ELOSZLÁS ## A lognormális eloszlásfüggvény értékét számítja ki.
MAX = MAX ## Az argumentumai között szereplő legnagyobb számot adja meg.
MAXA = MAX2 ## Az argumentumai között szereplő legnagyobb számot adja meg (beleértve a számokat, szöveget és logikai értékeket).
MEDIAN = MEDIÁN ## Adott számhalmaz mediánját számítja ki.
MIN = MIN ## Az argumentumai között szereplő legkisebb számot adja meg.
MINA = MIN2 ## Az argumentumai között szereplő legkisebb számot adja meg, beleértve a számokat, szöveget és logikai értékeket.
MODE = MÓDUSZ ## Egy adathalmazból kiválasztja a leggyakrabban előforduló számot.
NEGBINOMDIST = NEGBINOM.ELOSZL ## A negatív binomiális eloszlás értékét számítja ki.
NORMDIST = NORM.ELOSZL ## A normális eloszlás értékét számítja ki.
NORMINV = INVERZ.NORM ## A normális eloszlás eloszlásfüggvénye inverzének értékét számítja ki.
NORMSDIST = STNORMELOSZL ## A standard normális eloszlás eloszlásfüggvényének értékét számítja ki.
NORMSINV = INVERZ.STNORM ## A standard normális eloszlás eloszlásfüggvénye inverzének értékét számítja ki.
PEARSON = PEARSON ## A Pearson-féle korrelációs együtthatót számítja ki.
PERCENTILE = PERCENTILIS ## Egy tartományban található értékek k-adik percentilisét, azaz százalékosztályát adja eredményül.
PERCENTRANK = SZÁZALÉKRANG ## Egy értéknek egy adathalmazon belül vett százalékos rangját (elhelyezkedését) számítja ki.
PERMUT = VARIÁCIÓK ## Adott számú objektum k-ad osztályú ismétlés nélküli variációinak számát számítja ki.
POISSON = POISSON ## A Poisson-eloszlás értékét számítja ki.
PROB = VALÓSZÍNŰSÉG ## Annak valószínűségét számítja ki, hogy adott értékek két határérték közé esnek.
QUARTILE = KVARTILIS ## Egy adathalmaz kvartilisét (negyedszintjét) számítja ki.
RANK = SORSZÁM ## Kiszámítja, hogy egy szám hányadik egy számsorozatban.
RSQ = RNÉGYZET ## Kiszámítja a Pearson-féle szorzatmomentum korrelációs együtthatójának négyzetét.
SKEW = FERDESÉG ## Egy eloszlás ferdeségét határozza meg.
SLOPE = MEREDEKSÉG ## Egy lineáris regressziós egyenes meredekségét számítja ki.
SMALL = KICSI ## Egy adathalmaz k-adik legkisebb elemét adja meg.
STANDARDIZE = NORMALIZÁLÁS ## Normalizált értéket ad eredményül.
STDEV = SZÓRÁS ## Egy statisztikai sokaság mintájából kiszámítja annak szórását.
STDEVA = SZÓRÁSA ## Egy statisztikai sokaság mintájából kiszámítja annak szórását (beleértve a számokat, szöveget és logikai értékeket).
STDEVP = SZÓRÁSP ## Egy statisztikai sokaság egészéből kiszámítja annak szórását.
STDEVPA = SZÓRÁSPA ## Egy statisztikai sokaság egészéből kiszámítja annak szórását (beleértve számokat, szöveget és logikai értékeket).
STEYX = STHIBAYX ## Egy regresszió esetén az egyes x-értékek alapján meghatározott y-értékek standard hibáját számítja ki.
TDIST = T.ELOSZLÁS ## A Student-féle t-eloszlás értékét számítja ki.
TINV = INVERZ.T ## A Student-féle t-eloszlás inverzét számítja ki.
TREND = TREND ## Lineáris trend értékeit számítja ki.
TRIMMEAN = RÉSZÁTLAG ## Egy adathalmaz középső részének átlagát számítja ki.
TTEST = T.PRÓBA ## A Student-féle t-próbához tartozó valószínűséget számítja ki.
VAR = VAR ## Minta alapján becslést ad a varianciára.
VARA = VARA ## Minta alapján becslést ad a varianciára (beleértve számokat, szöveget és logikai értékeket).
VARP = VARP ## Egy statisztikai sokaság varianciáját számítja ki.
VARPA = VARPA ## Egy statisztikai sokaság varianciáját számítja ki (beleértve számokat, szöveget és logikai értékeket).
WEIBULL = WEIBULL ## A Weibull-féle eloszlás értékét számítja ki.
ZTEST = Z.PRÓBA ## Az egyszélű z-próbával kapott valószínűségértéket számítja ki.
##
## Text functions Szövegműveletekhez használható függvények
##
ASC = ASC ## Szöveg teljes szélességű (kétbájtos) latin és katakana karaktereit félszélességű (egybájtos) karakterekké alakítja.
BAHTTEXT = BAHTSZÖVEG ## Számot szöveggé alakít a ß (baht) pénznemformátum használatával.
CHAR = KARAKTER ## A kódszámmal meghatározott karaktert adja eredményül.
CLEAN = TISZTÍT ## A szövegből eltávolítja az összes nem nyomtatható karaktert.
CODE = KÓD ## Karaktersorozat első karakterének numerikus kódját adja eredményül.
CONCATENATE = ÖSSZEFŰZ ## Több szövegelemet egyetlen szöveges elemmé fűz össze.
DOLLAR = FORINT ## Számot pénznem formátumú szöveggé alakít át.
EXACT = AZONOS ## Megvizsgálja, hogy két érték azonos-e.
FIND = SZÖVEG.TALÁL ## Karaktersorozatot keres egy másikban (a kis- és nagybetűk megkülönböztetésével).
FINDB = SZÖVEG.TALÁL2 ## Karaktersorozatot keres egy másikban (a kis- és nagybetűk megkülönböztetésével).
FIXED = FIX ## Számot szöveges formátumúra alakít adott számú tizedesjegyre kerekítve.
JIS = JIS ## A félszélességű (egybájtos) latin és a katakana karaktereket teljes szélességű (kétbájtos) karakterekké alakítja.
LEFT = BAL ## Szöveg bal szélső karaktereit adja eredményül.
LEFTB = BAL2 ## Szöveg bal szélső karaktereit adja eredményül.
LEN = HOSSZ ## Szöveg karakterekben mért hosszát adja eredményül.
LENB = HOSSZ2 ## Szöveg karakterekben mért hosszát adja eredményül.
LOWER = KISBETŰ ## Szöveget kisbetűssé alakít át.
MID = KÖZÉP ## A szöveg adott pozíciójától kezdve megadott számú karaktert ad vissza eredményként.
MIDB = KÖZÉP2 ## A szöveg adott pozíciójától kezdve megadott számú karaktert ad vissza eredményként.
PHONETIC = PHONETIC ## Szöveg furigana (fonetikus) karaktereit adja vissza.
PROPER = TNÉV ## Szöveg minden szavának kezdőbetűjét nagybetűsre cseréli.
REPLACE = CSERE ## A szövegen belül karaktereket cserél.
REPLACEB = CSERE2 ## A szövegen belül karaktereket cserél.
REPT = SOKSZOR ## Megadott számú alkalommal megismétel egy szövegrészt.
RIGHT = JOBB ## Szövegrész jobb szélső karaktereit adja eredményül.
RIGHTB = JOBB2 ## Szövegrész jobb szélső karaktereit adja eredményül.
SEARCH = SZÖVEG.KERES ## Karaktersorozatot keres egy másikban (a kis- és nagybetűk között nem tesz különbséget).
SEARCHB = SZÖVEG.KERES2 ## Karaktersorozatot keres egy másikban (a kis- és nagybetűk között nem tesz különbséget).
SUBSTITUTE = HELYETTE ## Szövegben adott karaktereket másikra cserél.
T = T ## Argumentumát szöveggé alakítja át.
TEXT = SZÖVEG ## Számértéket alakít át adott számformátumú szöveggé.
TRIM = TRIM ## A szövegből eltávolítja a szóközöket.
UPPER = NAGYBETŰS ## Szöveget nagybetűssé alakít át.
VALUE = ÉRTÉK ## Szöveget számmá alakít át.
PK ! +%e7 7 PHPExcel/locale/hu/confignu [ ##
## PHPExcel
##
## Copyright (c) 2006 - 2013 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
##
## @category PHPExcel
## @package PHPExcel_Settings
## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
## @version 1.8.0, 2014-03-02
##
##
ArgumentSeparator = ;
##
## (For future use)
##
currencySymbol = Ft
##
## Excel Error Codes (For future use)
##
NULL = #NULLA!
DIV0 = #ZÉRÓOSZTÓ!
VALUE = #ÉRTÉK!
REF = #HIV!
NAME = #NÉV?
NUM = #SZÁM!
NA = #HIÁNYZIK
PK ! ? ? PHPExcel/locale/tr/functionsnu [ ##
## PHPExcel
##
## Copyright (c) 2006 - 2013 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
##
## @category PHPExcel
## @package PHPExcel_Calculation
## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
## @version 1.8.0, 2014-03-02
##
## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/
##
##
##
## Add-in and Automation functions Eklenti ve Otomasyon fonksiyonları
##
GETPIVOTDATA = ÖZETVERİAL ## Bir Özet Tablo raporunda saklanan verileri verir.
##
## Cube functions Küp işlevleri
##
CUBEKPIMEMBER = KÜPKPIÜYE ## Kilit performans göstergesi (KPI-Key Performance Indicator) adını, özelliğini ve ölçüsünü verir ve hücredeki ad ve özelliği gösterir. KPI, bir kurumun performansını izlemek için kullanılan aylık brüt kâr ya da üç aylık çalışan giriş çıkışları gibi ölçülebilen bir birimdir.
CUBEMEMBER = KÜPÜYE ## Bir küp hiyerarşisinde bir üyeyi veya kaydı verir. Üye veya kaydın küpte varolduğunu doğrulamak için kullanılır.
CUBEMEMBERPROPERTY = KÜPÜYEÖZELLİĞİ ## Bir küpte bir üyenin özelliğinin değerini verir. Küp içinde üye adının varlığını doğrulamak ve bu üyenin belli özelliklerini getirmek için kullanılır.
CUBERANKEDMEMBER = KÜPÜYESIRASI ## Bir küme içindeki üyenin derecesini veya kaçıncı olduğunu verir. En iyi satış elemanı, veya en iyi on öğrenci gibi bir kümedeki bir veya daha fazla öğeyi getirmek için kullanılır.
CUBESET = KÜPKÜME ## Kümeyi oluşturan ve ardından bu kümeyi Microsoft Office Excel'e getiren sunucudaki küpe küme ifadelerini göndererek hesaplanan üye veya kayıt kümesini tanımlar.
CUBESETCOUNT = KÜPKÜMESAY ## Bir kümedeki öğelerin sayısını getirir.
CUBEVALUE = KÜPDEĞER ## Bir küpten toplam değeri getirir.
##
## Database functions Veritabanı işlevleri
##
DAVERAGE = VSEÇORT ## Seçili veritabanı girdilerinin ortalamasını verir.
DCOUNT = VSEÇSAY ## Veritabanında sayı içeren hücre sayısını hesaplar.
DCOUNTA = VSEÇSAYDOLU ## Veritabanındaki boş olmayan hücreleri sayar.
DGET = VAL ## Veritabanından, belirtilen ölçütlerle eşleşen tek bir rapor çıkarır.
DMAX = VSEÇMAK ## Seçili veritabanı girişlerinin en yüksek değerini verir.
DMIN = VSEÇMİN ## Seçili veritabanı girişlerinin en düşük değerini verir.
DPRODUCT = VSEÇÇARP ## Kayıtların belli bir alanında bulunan, bir veritabanındaki ölçütlerle eşleşen değerleri çarpar.
DSTDEV = VSEÇSTDSAPMA ## Seçili veritabanı girişlerinden oluşan bir örneğe dayanarak, standart sapmayı tahmin eder.
DSTDEVP = VSEÇSTDSAPMAS ## Standart sapmayı, seçili veritabanı girişlerinin tüm popülasyonunu esas alarak hesaplar.
DSUM = VSEÇTOPLA ## Kayıtların alan sütununda bulunan, ölçütle eşleşen sayıları toplar.
DVAR = VSEÇVAR ## Seçili veritabanı girişlerinden oluşan bir örneği esas alarak farkı tahmin eder.
DVARP = VSEÇVARS ## Seçili veritabanı girişlerinin tüm popülasyonunu esas alarak farkı hesaplar.
##
## Date and time functions Tarih ve saat işlevleri
##
DATE = TARİH ## Belirli bir tarihin seri numarasını verir.
DATEVALUE = TARİHSAYISI ## Metin biçimindeki bir tarihi seri numarasına dönüştürür.
DAY = GÜN ## Seri numarasını, ayın bir gününe dönüştürür.
DAYS360 = GÜN360 ## İki tarih arasındaki gün sayısını, 360 günlük yılı esas alarak hesaplar.
EDATE = SERİTARİH ## Başlangıç tarihinden itibaren, belirtilen ay sayısından önce veya sonraki tarihin seri numarasını verir.
EOMONTH = SERİAY ## Belirtilen sayıda ay önce veya sonraki ayın son gününün seri numarasını verir.
HOUR = SAAT ## Bir seri numarasını saate dönüştürür.
MINUTE = DAKİKA ## Bir seri numarasını dakikaya dönüştürür.
MONTH = AY ## Bir seri numarasını aya dönüştürür.
NETWORKDAYS = TAMİŞGÜNÜ ## İki tarih arasındaki tam çalışma günlerinin sayısını verir.
NOW = ŞİMDİ ## Geçerli tarihin ve saatin seri numarasını verir.
SECOND = SANİYE ## Bir seri numarasını saniyeye dönüştürür.
TIME = ZAMAN ## Belirli bir zamanın seri numarasını verir.
TIMEVALUE = ZAMANSAYISI ## Metin biçimindeki zamanı seri numarasına dönüştürür.
TODAY = BUGÜN ## Bugünün tarihini seri numarasına dönüştürür.
WEEKDAY = HAFTANINGÜNÜ ## Bir seri numarasını, haftanın gününe dönüştürür.
WEEKNUM = HAFTASAY ## Dizisel değerini, haftanın yıl içinde bulunduğu konumu sayısal olarak gösteren sayıya dönüştürür.
WORKDAY = İŞGÜNÜ ## Belirtilen sayıda çalışma günü öncesinin ya da sonrasının tarihinin seri numarasını verir.
YEAR = YIL ## Bir seri numarasını yıla dönüştürür.
YEARFRAC = YILORAN ## Başlangıç_tarihi ve bitiş_tarihi arasındaki tam günleri gösteren yıl kesrini verir.
##
## Engineering functions Mühendislik işlevleri
##
BESSELI = BESSELI ## Değiştirilmiş Bessel fonksiyonu In(x)'i verir.
BESSELJ = BESSELJ ## Bessel fonksiyonu Jn(x)'i verir.
BESSELK = BESSELK ## Değiştirilmiş Bessel fonksiyonu Kn(x)'i verir.
BESSELY = BESSELY ## Bessel fonksiyonu Yn(x)'i verir.
BIN2DEC = BIN2DEC ## İkili bir sayıyı, ondalık sayıya dönüştürür.
BIN2HEX = BIN2HEX ## İkili bir sayıyı, onaltılıya dönüştürür.
BIN2OCT = BIN2OCT ## İkili bir sayıyı, sekizliye dönüştürür.
COMPLEX = KARMAŞIK ## Gerçek ve sanal katsayıları, karmaşık sayıya dönüştürür.
CONVERT = ÇEVİR ## Bir sayıyı, bir ölçüm sisteminden bir başka ölçüm sistemine dönüştürür.
DEC2BIN = DEC2BIN ## Ondalık bir sayıyı, ikiliye dönüştürür.
DEC2HEX = DEC2HEX ## Ondalık bir sayıyı, onaltılıya dönüştürür.
DEC2OCT = DEC2OCT ## Ondalık bir sayıyı sekizliğe dönüştürür.
DELTA = DELTA ## İki değerin eşit olup olmadığını sınar.
ERF = HATAİŞLEV ## Hata işlevini verir.
ERFC = TÜMHATAİŞLEV ## Tümleyici hata işlevini verir.
GESTEP = BESINIR ## Bir sayının eşik değerinden büyük olup olmadığını sınar.
HEX2BIN = HEX2BIN ## Onaltılı bir sayıyı ikiliye dönüştürür.
HEX2DEC = HEX2DEC ## Onaltılı bir sayıyı ondalığa dönüştürür.
HEX2OCT = HEX2OCT ## Onaltılı bir sayıyı sekizliğe dönüştürür.
IMABS = SANMUTLAK ## Karmaşık bir sayının mutlak değerini (modül) verir.
IMAGINARY = SANAL ## Karmaşık bir sayının sanal katsayısını verir.
IMARGUMENT = SANBAĞ_DEĞİŞKEN ## Radyanlarla belirtilen bir açı olan teta bağımsız değişkenini verir.
IMCONJUGATE = SANEŞLENEK ## Karmaşık bir sayının karmaşık eşleniğini verir.
IMCOS = SANCOS ## Karmaşık bir sayının kosinüsünü verir.
IMDIV = SANBÖL ## İki karmaşık sayının bölümünü verir.
IMEXP = SANÜS ## Karmaşık bir sayının üssünü verir.
IMLN = SANLN ## Karmaşık bir sayının doğal logaritmasını verir.
IMLOG10 = SANLOG10 ## Karmaşık bir sayının, 10 tabanında logaritmasını verir.
IMLOG2 = SANLOG2 ## Karmaşık bir sayının 2 tabanında logaritmasını verir.
IMPOWER = SANÜSSÜ ## Karmaşık bir sayıyı, bir tamsayı üssüne yükseltilmiş olarak verir.
IMPRODUCT = SANÇARP ## Karmaşık sayıların çarpımını verir.
IMREAL = SANGERÇEK ## Karmaşık bir sayının, gerçek katsayısını verir.
IMSIN = SANSIN ## Karmaşık bir sayının sinüsünü verir.
IMSQRT = SANKAREKÖK ## Karmaşık bir sayının karekökünü verir.
IMSUB = SANÇIKAR ## İki karmaşık sayının farkını verir.
IMSUM = SANTOPLA ## Karmaşık sayıların toplamını verir.
OCT2BIN = OCT2BIN ## Sekizli bir sayıyı ikiliye dönüştürür.
OCT2DEC = OCT2DEC ## Sekizli bir sayıyı ondalığa dönüştürür.
OCT2HEX = OCT2HEX ## Sekizli bir sayıyı onaltılıya dönüştürür.
##
## Financial functions Finansal fonksiyonlar
##
ACCRINT = GERÇEKFAİZ ## Dönemsel faiz ödeyen hisse senedine ilişkin tahakkuk eden faizi getirir.
ACCRINTM = GERÇEKFAİZV ## Vadesinde ödeme yapan bir tahvilin tahakkuk etmiş faizini verir.
AMORDEGRC = AMORDEGRC ## Yıpranma katsayısı kullanarak her hesap döneminin değer kaybını verir.
AMORLINC = AMORLINC ## Her hesap dönemi içindeki yıpranmayı verir.
COUPDAYBS = KUPONGÜNBD ## Kupon süresinin başlangıcından alış tarihine kadar olan süredeki gün sayısını verir.
COUPDAYS = KUPONGÜN ## Kupon süresindeki, gün sayısını, alış tarihini de içermek üzere, verir.
COUPDAYSNC = KUPONGÜNDSK ## Alış tarihinden bir sonraki kupon tarihine kadar olan gün sayısını verir.
COUPNCD = KUPONGÜNSKT ## Alış tarihinden bir sonraki kupon tarihini verir.
COUPNUM = KUPONSAYI ## Alış tarihiyle vade tarihi arasında ödenecek kuponların sayısını verir.
COUPPCD = KUPONGÜNÖKT ## Alış tarihinden bir önceki kupon tarihini verir.
CUMIPMT = AİÇVERİMORANI ## İki dönem arasında ödenen kümülatif faizi verir.
CUMPRINC = ANA_PARA_ÖDEMESİ ## İki dönem arasında bir borç üzerine ödenen birikimli temeli verir.
DB = AZALANBAKİYE ## Bir malın belirtilen bir süre içindeki yıpranmasını, sabit azalan bakiye yöntemini kullanarak verir.
DDB = ÇİFTAZALANBAKİYE ## Bir malın belirtilen bir süre içindeki yıpranmasını, çift azalan bakiye yöntemi ya da sizin belirttiğiniz başka bir yöntemi kullanarak verir.
DISC = İNDİRİM ## Bir tahvilin indirim oranını verir.
DOLLARDE = LİRAON ## Kesir olarak tanımlanmış lira fiyatını, ondalık sayı olarak tanımlanmış lira fiyatına dönüştürür.
DOLLARFR = LİRAKES ## Ondalık sayı olarak tanımlanmış lira fiyatını, kesir olarak tanımlanmış lira fiyatına dönüştürür.
DURATION = SÜRE ## Belli aralıklarla faiz ödemesi yapan bir tahvilin yıllık süresini verir.
EFFECT = ETKİN ## Efektif yıllık faiz oranını verir.
FV = ANBD ## Bir yatırımın gelecekteki değerini verir.
FVSCHEDULE = GDPROGRAM ## Bir seri birleşik faiz oranı uyguladıktan sonra, bir başlangıçtaki anaparanın gelecekteki değerini verir.
INTRATE = FAİZORANI ## Tam olarak yatırım yapılmış bir tahvilin faiz oranını verir.
IPMT = FAİZTUTARI ## Bir yatırımın verilen bir süre için faiz ödemesini verir.
IRR = İÇ_VERİM_ORANI ## Bir para akışı serisi için, iç verim oranını verir.
ISPMT = ISPMT ## Yatırımın belirli bir dönemi boyunca ödenen faizi hesaplar.
MDURATION = MSÜRE ## Varsayılan par değeri 10.000.000 lira olan bir tahvil için Macauley değiştirilmiş süreyi verir.
MIRR = D_İÇ_VERİM_ORANI ## Pozitif ve negatif para akışlarının farklı oranlarda finanse edildiği durumlarda, iç verim oranını verir.
NOMINAL = NOMİNAL ## Yıllık nominal faiz oranını verir.
NPER = DÖNEM_SAYISI ## Bir yatırımın dönem sayısını verir.
NPV = NBD ## Bir yatırımın bugünkü net değerini, bir dönemsel para akışları serisine ve bir indirim oranına bağlı olarak verir.
ODDFPRICE = TEKYDEĞER ## Tek bir ilk dönemi olan bir tahvilin değerini, her 100.000.000 lirada bir verir.
ODDFYIELD = TEKYÖDEME ## Tek bir ilk dönemi olan bir tahvilin ödemesini verir.
ODDLPRICE = TEKSDEĞER ## Tek bir son dönemi olan bir tahvilin fiyatını her 10.000.000 lirada bir verir.
ODDLYIELD = TEKSÖDEME ## Tek bir son dönemi olan bir tahvilin ödemesini verir.
PMT = DEVRESEL_ÖDEME ## Bir yıllık dönemsel ödemeyi verir.
PPMT = ANA_PARA_ÖDEMESİ ## Verilen bir süre için, bir yatırımın anaparasına dayanan ödemeyi verir.
PRICE = DEĞER ## Dönemsel faiz ödeyen bir tahvilin fiyatını 10.000.00 liralık değer başına verir.
PRICEDISC = DEĞERİND ## İndirimli bir tahvilin fiyatını 10.000.000 liralık nominal değer başına verir.
PRICEMAT = DEĞERVADE ## Faizini vade sonunda ödeyen bir tahvilin fiyatını 10.000.000 nominal değer başına verir.
PV = BD ## Bir yatırımın bugünkü değerini verir.
RATE = FAİZ_ORANI ## Bir yıllık dönem başına düşen faiz oranını verir.
RECEIVED = GETİRİ ## Tam olarak yatırılmış bir tahvilin vadesinin bitiminde alınan miktarı verir.
SLN = DA ## Bir malın bir dönem içindeki doğrusal yıpranmasını verir.
SYD = YAT ## Bir malın belirli bir dönem için olan amortismanını verir.
TBILLEQ = HTAHEŞ ## Bir Hazine bonosunun bono eşdeğeri ödemesini verir.
TBILLPRICE = HTAHDEĞER ## Bir Hazine bonosunun değerini, 10.000.000 liralık nominal değer başına verir.
TBILLYIELD = HTAHÖDEME ## Bir Hazine bonosunun ödemesini verir.
VDB = DAB ## Bir malın amortismanını, belirlenmiş ya da kısmi bir dönem için, bir azalan bakiye yöntemi kullanarak verir.
XIRR = AİÇVERİMORANI ## Dönemsel olması gerekmeyen bir para akışları programı için, iç verim oranını verir.
XNPV = ANBD ## Dönemsel olması gerekmeyen bir para akışları programı için, bugünkü net değeri verir.
YIELD = ÖDEME ## Belirli aralıklarla faiz ödeyen bir tahvilin ödemesini verir.
YIELDDISC = ÖDEMEİND ## İndirimli bir tahvilin yıllık ödemesini verir; örneğin, bir Hazine bonosunun.
YIELDMAT = ÖDEMEVADE ## Vadesinin bitiminde faiz ödeyen bir tahvilin yıllık ödemesini verir.
##
## Information functions Bilgi fonksiyonları
##
CELL = HÜCRE ## Bir hücrenin biçimlendirmesi, konumu ya da içeriği hakkında bilgi verir.
ERROR.TYPE = HATA.TİPİ ## Bir hata türüne ilişkin sayıları verir.
INFO = BİLGİ ## Geçerli işletim ortamı hakkında bilgi verir.
ISBLANK = EBOŞSA ## Değer boşsa, DOĞRU verir.
ISERR = EHATA ## Değer, #YOK dışındaki bir hata değeriyse, DOĞRU verir.
ISERROR = EHATALIYSA ## Değer, herhangi bir hata değeriyse, DOĞRU verir.
ISEVEN = ÇİFTTİR ## Sayı çiftse, DOĞRU verir.
ISLOGICAL = EMANTIKSALSA ## Değer, mantıksal bir değerse, DOĞRU verir.
ISNA = EYOKSA ## Değer, #YOK hata değeriyse, DOĞRU verir.
ISNONTEXT = EMETİNDEĞİLSE ## Değer, metin değilse, DOĞRU verir.
ISNUMBER = ESAYIYSA ## Değer, bir sayıysa, DOĞRU verir.
ISODD = TEKTİR ## Sayı tekse, DOĞRU verir.
ISREF = EREFSE ## Değer bir başvuruysa, DOĞRU verir.
ISTEXT = EMETİNSE ## Değer bir metinse DOĞRU verir.
N = N ## Sayıya dönüştürülmüş bir değer verir.
NA = YOKSAY ## #YOK hata değerini verir.
TYPE = TİP ## Bir değerin veri türünü belirten bir sayı verir.
##
## Logical functions Mantıksal fonksiyonlar
##
AND = VE ## Bütün bağımsız değişkenleri DOĞRU ise, DOĞRU verir.
FALSE = YANLIŞ ## YANLIŞ mantıksal değerini verir.
IF = EĞER ## Gerçekleştirilecek bir mantıksal sınama belirtir.
IFERROR = EĞERHATA ## Formül hatalıysa belirttiğiniz değeri verir; bunun dışındaki durumlarda formülün sonucunu verir.
NOT = DEĞİL ## Bağımsız değişkeninin mantığını tersine çevirir.
OR = YADA ## Bağımsız değişkenlerden herhangi birisi DOĞRU ise, DOĞRU verir.
TRUE = DOĞRU ## DOĞRU mantıksal değerini verir.
##
## Lookup and reference functions Arama ve Başvuru fonksiyonları
##
ADDRESS = ADRES ## Bir başvuruyu, çalışma sayfasındaki tek bir hücreye metin olarak verir.
AREAS = ALANSAY ## Renvoie le nombre de zones dans une référence.
CHOOSE = ELEMAN ## Değerler listesinden bir değer seçer.
COLUMN = SÜTUN ## Bir başvurunun sütun sayısını verir.
COLUMNS = SÜTUNSAY ## Bir başvurudaki sütunların sayısını verir.
HLOOKUP = YATAYARA ## Bir dizinin en üst satırına bakar ve belirtilen hücrenin değerini verir.
HYPERLINK = KÖPRÜ ## Bir ağ sunucusunda, bir intranette ya da Internet'te depolanan bir belgeyi açan bir kısayol ya da atlama oluşturur.
INDEX = İNDİS ## Başvurudan veya diziden bir değer seçmek için, bir dizin kullanır.
INDIRECT = DOLAYLI ## Metin değeriyle belirtilen bir başvuru verir.
LOOKUP = ARA ## Bir vektördeki veya dizideki değerleri arar.
MATCH = KAÇINCI ## Bir başvurudaki veya dizideki değerleri arar.
OFFSET = KAYDIR ## Verilen bir başvurudan, bir başvuru kaydırmayı verir.
ROW = SATIR ## Bir başvurunun satır sayısını verir.
ROWS = SATIRSAY ## Bir başvurudaki satırların sayısını verir.
RTD = RTD ## COM otomasyonunu destekleyen programdan gerçek zaman verileri alır.
TRANSPOSE = DEVRİK_DÖNÜŞÜM ## Bir dizinin devrik dönüşümünü verir.
VLOOKUP = DÜŞEYARA ## Bir dizinin ilk sütununa bakar ve bir hücrenin değerini vermek için satır boyunca hareket eder.
##
## Math and trigonometry functions Matematik ve trigonometri fonksiyonları
##
ABS = MUTLAK ## Bir sayının mutlak değerini verir.
ACOS = ACOS ## Bir sayının ark kosinüsünü verir.
ACOSH = ACOSH ## Bir sayının ters hiperbolik kosinüsünü verir.
ASIN = ASİN ## Bir sayının ark sinüsünü verir.
ASINH = ASİNH ## Bir sayının ters hiperbolik sinüsünü verir.
ATAN = ATAN ## Bir sayının ark tanjantını verir.
ATAN2 = ATAN2 ## Ark tanjantı, x- ve y- koordinatlarından verir.
ATANH = ATANH ## Bir sayının ters hiperbolik tanjantını verir.
CEILING = TAVANAYUVARLA ## Bir sayıyı, en yakın tamsayıya ya da en yakın katına yuvarlar.
COMBIN = KOMBİNASYON ## Verilen sayıda öğenin kombinasyon sayısını verir.
COS = COS ## Bir sayının kosinüsünü verir.
COSH = COSH ## Bir sayının hiperbolik kosinüsünü verir.
DEGREES = DERECE ## Radyanları dereceye dönüştürür.
EVEN = ÇİFT ## Bir sayıyı, en yakın daha büyük çift tamsayıya yuvarlar.
EXP = ÜS ## e'yi, verilen bir sayının üssüne yükseltilmiş olarak verir.
FACT = ÇARPINIM ## Bir sayının faktörünü verir.
FACTDOUBLE = ÇİFTFAKTÖR ## Bir sayının çift çarpınımını verir.
FLOOR = TABANAYUVARLA ## Bir sayıyı, daha küçük sayıya, sıfıra yakınsayarak yuvarlar.
GCD = OBEB ## En büyük ortak böleni verir.
INT = TAMSAYI ## Bir sayıyı aşağıya doğru en yakın tamsayıya yuvarlar.
LCM = OKEK ## En küçük ortak katı verir.
LN = LN ## Bir sayının doğal logaritmasını verir.
LOG = LOG ## Bir sayının, belirtilen bir tabandaki logaritmasını verir.
LOG10 = LOG10 ## Bir sayının 10 tabanında logaritmasını verir.
MDETERM = DETERMİNANT ## Bir dizinin dizey determinantını verir.
MINVERSE = DİZEY_TERS ## Bir dizinin dizey tersini verir.
MMULT = DÇARP ## İki dizinin dizey çarpımını verir.
MOD = MODÜLO ## Bölmeden kalanı verir.
MROUND = KYUVARLA ## İstenen kata yuvarlanmış bir sayı verir.
MULTINOMIAL = ÇOKTERİMLİ ## Bir sayılar kümesinin çok terimlisini verir.
ODD = TEK ## Bir sayıyı en yakın daha büyük tek sayıya yuvarlar.
PI = Pİ ## Pi değerini verir.
POWER = KUVVET ## Bir üsse yükseltilmiş sayının sonucunu verir.
PRODUCT = ÇARPIM ## Bağımsız değişkenlerini çarpar.
QUOTIENT = BÖLÜM ## Bir bölme işleminin tamsayı kısmını verir.
RADIANS = RADYAN ## Dereceleri radyanlara dönüştürür.
RAND = S_SAYI_ÜRET ## 0 ile 1 arasında rastgele bir sayı verir.
RANDBETWEEN = RASTGELEARALIK ## Belirttiğiniz sayılar arasında rastgele bir sayı verir.
ROMAN = ROMEN ## Bir normal rakamı, metin olarak, romen rakamına çevirir.
ROUND = YUVARLA ## Bir sayıyı, belirtilen basamak sayısına yuvarlar.
ROUNDDOWN = AŞAĞIYUVARLA ## Bir sayıyı, daha küçük sayıya, sıfıra yakınsayarak yuvarlar.
ROUNDUP = YUKARIYUVARLA ## Bir sayıyı daha büyük sayıya, sıfırdan ıraksayarak yuvarlar.
SERIESSUM = SERİTOPLA ## Bir üs serisinin toplamını, formüle bağlı olarak verir.
SIGN = İŞARET ## Bir sayının işaretini verir.
SIN = SİN ## Verilen bir açının sinüsünü verir.
SINH = SİNH ## Bir sayının hiperbolik sinüsünü verir.
SQRT = KAREKÖK ## Pozitif bir karekök verir.
SQRTPI = KAREKÖKPİ ## (* Pi sayısının) kare kökünü verir.
SUBTOTAL = ALTTOPLAM ## Bir listedeki ya da veritabanındaki bir alt toplamı verir.
SUM = TOPLA ## Bağımsız değişkenlerini toplar.
SUMIF = ETOPLA ## Verilen ölçütle belirlenen hücreleri toplar.
SUMIFS = SUMIFS ## Bir aralıktaki, birden fazla ölçüte uyan hücreleri ekler.
SUMPRODUCT = TOPLA.ÇARPIM ## İlişkili dizi bileşenlerinin çarpımlarının toplamını verir.
SUMSQ = TOPKARE ## Bağımsız değişkenlerin karelerinin toplamını verir.
SUMX2MY2 = TOPX2EY2 ## İki dizideki ilişkili değerlerin farkının toplamını verir.
SUMX2PY2 = TOPX2AY2 ## İki dizideki ilişkili değerlerin karelerinin toplamının toplamını verir.
SUMXMY2 = TOPXEY2 ## İki dizideki ilişkili değerlerin farklarının karelerinin toplamını verir.
TAN = TAN ## Bir sayının tanjantını verir.
TANH = TANH ## Bir sayının hiperbolik tanjantını verir.
TRUNC = NSAT ## Bir sayının, tamsayı durumuna gelecek şekilde, fazlalıklarını atar.
##
## Statistical functions İstatistiksel fonksiyonlar
##
AVEDEV = ORTSAP ## Veri noktalarının ortalamalarından mutlak sapmalarının ortalamasını verir.
AVERAGE = ORTALAMA ## Bağımsız değişkenlerinin ortalamasını verir.
AVERAGEA = ORTALAMAA ## Bağımsız değişkenlerinin, sayılar, metin ve mantıksal değerleri içermek üzere ortalamasını verir.
AVERAGEIF = EĞERORTALAMA ## Verili ölçütü karşılayan bir aralıktaki bütün hücrelerin ortalamasını (aritmetik ortalama) hesaplar.
AVERAGEIFS = EĞERLERORTALAMA ## Birden çok ölçüte uyan tüm hücrelerin ortalamasını (aritmetik ortalama) hesaplar.
BETADIST = BETADAĞ ## Beta birikimli dağılım fonksiyonunu verir.
BETAINV = BETATERS ## Belirli bir beta dağılımı için birikimli dağılım fonksiyonunun tersini verir.
BINOMDIST = BİNOMDAĞ ## Tek terimli binom dağılımı olasılığını verir.
CHIDIST = KİKAREDAĞ ## Kikare dağılımın tek kuyruklu olasılığını verir.
CHIINV = KİKARETERS ## Kikare dağılımın kuyruklu olasılığının tersini verir.
CHITEST = KİKARETEST ## Bağımsızlık sınamalarını verir.
CONFIDENCE = GÜVENİRLİK ## Bir popülasyon ortalaması için güvenirlik aralığını verir.
CORREL = KORELASYON ## İki veri kümesi arasındaki bağlantı katsayısını verir.
COUNT = BAĞ_DEĞ_SAY ## Bağımsız değişkenler listesinde kaç tane sayı bulunduğunu sayar.
COUNTA = BAĞ_DEĞ_DOLU_SAY ## Bağımsız değişkenler listesinde kaç tane değer bulunduğunu sayar.
COUNTBLANK = BOŞLUKSAY ## Aralıktaki boş hücre sayısını hesaplar.
COUNTIF = EĞERSAY ## Verilen ölçütlere uyan bir aralık içindeki hücreleri sayar.
COUNTIFS = ÇOKEĞERSAY ## Birden çok ölçüte uyan bir aralık içindeki hücreleri sayar.
COVAR = KOVARYANS ## Eşleştirilmiş sapmaların ortalaması olan kovaryansı verir.
CRITBINOM = KRİTİKBİNOM ## Birikimli binom dağılımının bir ölçüt değerinden küçük veya ölçüt değerine eşit olduğu en küçük değeri verir.
DEVSQ = SAPKARE ## Sapmaların karelerinin toplamını verir.
EXPONDIST = ÜSTELDAĞ ## Üstel dağılımı verir.
FDIST = FDAĞ ## F olasılık dağılımını verir.
FINV = FTERS ## F olasılık dağılımının tersini verir.
FISHER = FISHER ## Fisher dönüşümünü verir.
FISHERINV = FISHERTERS ## Fisher dönüşümünün tersini verir.
FORECAST = TAHMİN ## Bir doğrusal eğilim boyunca bir değer verir.
FREQUENCY = SIKLIK ## Bir sıklık dağılımını, dikey bir dizi olarak verir.
FTEST = FTEST ## Bir F-test'in sonucunu verir.
GAMMADIST = GAMADAĞ ## Gama dağılımını verir.
GAMMAINV = GAMATERS ## Gama kümülatif dağılımının tersini verir.
GAMMALN = GAMALN ## Gama fonksiyonunun (?(x)) doğal logaritmasını verir.
GEOMEAN = GEOORT ## Geometrik ortayı verir.
GROWTH = BÜYÜME ## Üstel bir eğilim boyunca değerler verir.
HARMEAN = HARORT ## Harmonik ortayı verir.
HYPGEOMDIST = HİPERGEOMDAĞ ## Hipergeometrik dağılımı verir.
INTERCEPT = KESMENOKTASI ## Doğrusal çakıştırma çizgisinin kesişme noktasını verir.
KURT = BASIKLIK ## Bir veri kümesinin basıklığını verir.
LARGE = BÜYÜK ## Bir veri kümesinde k. en büyük değeri verir.
LINEST = DOT ## Doğrusal bir eğilimin parametrelerini verir.
LOGEST = LOT ## Üstel bir eğilimin parametrelerini verir.
LOGINV = LOGTERS ## Bir lognormal dağılımının tersini verir.
LOGNORMDIST = LOGNORMDAĞ ## Birikimli lognormal dağılımını verir.
MAX = MAK ## Bir bağımsız değişkenler listesindeki en büyük değeri verir.
MAXA = MAKA ## Bir bağımsız değişkenler listesindeki, sayılar, metin ve mantıksal değerleri içermek üzere, en büyük değeri verir.
MEDIAN = ORTANCA ## Belirtilen sayıların orta değerini verir.
MIN = MİN ## Bir bağımsız değişkenler listesindeki en küçük değeri verir.
MINA = MİNA ## Bir bağımsız değişkenler listesindeki, sayılar, metin ve mantıksal değerleri de içermek üzere, en küçük değeri verir.
MODE = ENÇOK_OLAN ## Bir veri kümesindeki en sık rastlanan değeri verir.
NEGBINOMDIST = NEGBİNOMDAĞ ## Negatif binom dağılımını verir.
NORMDIST = NORMDAĞ ## Normal birikimli dağılımı verir.
NORMINV = NORMTERS ## Normal kümülatif dağılımın tersini verir.
NORMSDIST = NORMSDAĞ ## Standart normal birikimli dağılımı verir.
NORMSINV = NORMSTERS ## Standart normal birikimli dağılımın tersini verir.
PEARSON = PEARSON ## Pearson çarpım moment korelasyon katsayısını verir.
PERCENTILE = YÜZDEBİRLİK ## Bir aralık içerisinde bulunan değerlerin k. frekans toplamını verir.
PERCENTRANK = YÜZDERANK ## Bir veri kümesindeki bir değerin yüzde mertebesini verir.
PERMUT = PERMÜTASYON ## Verilen sayıda nesne için permütasyon sayısını verir.
POISSON = POISSON ## Poisson dağılımını verir.
PROB = OLASILIK ## Bir aralıktaki değerlerin iki sınır arasında olması olasılığını verir.
QUARTILE = DÖRTTEBİRLİK ## Bir veri kümesinin dörtte birliğini verir.
RANK = RANK ## Bir sayılar listesinde bir sayının mertebesini verir.
RSQ = RKARE ## Pearson çarpım moment korelasyon katsayısının karesini verir.
SKEW = ÇARPIKLIK ## Bir dağılımın çarpıklığını verir.
SLOPE = EĞİM ## Doğrusal çakışma çizgisinin eğimini verir.
SMALL = KÜÇÜK ## Bir veri kümesinde k. en küçük değeri verir.
STANDARDIZE = STANDARTLAŞTIRMA ## Normalleştirilmiş bir değer verir.
STDEV = STDSAPMA ## Bir örneğe dayanarak standart sapmayı tahmin eder.
STDEVA = STDSAPMAA ## Standart sapmayı, sayılar, metin ve mantıksal değerleri içermek üzere, bir örneğe bağlı olarak tahmin eder.
STDEVP = STDSAPMAS ## Standart sapmayı, tüm popülasyona bağlı olarak hesaplar.
STDEVPA = STDSAPMASA ## Standart sapmayı, sayılar, metin ve mantıksal değerleri içermek üzere, tüm popülasyona bağlı olarak hesaplar.
STEYX = STHYX ## Regresyondaki her x için tahmini y değerinin standart hatasını verir.
TDIST = TDAĞ ## T-dağılımını verir.
TINV = TTERS ## T-dağılımının tersini verir.
TREND = EĞİLİM ## Doğrusal bir eğilim boyunca değerler verir.
TRIMMEAN = KIRPORTALAMA ## Bir veri kümesinin içinin ortalamasını verir.
TTEST = TTEST ## T-test'le ilişkilendirilmiş olasılığı verir.
VAR = VAR ## Varyansı, bir örneğe bağlı olarak tahmin eder.
VARA = VARA ## Varyansı, sayılar, metin ve mantıksal değerleri içermek üzere, bir örneğe bağlı olarak tahmin eder.
VARP = VARS ## Varyansı, tüm popülasyona dayanarak hesaplar.
VARPA = VARSA ## Varyansı, sayılar, metin ve mantıksal değerleri içermek üzere, tüm popülasyona bağlı olarak hesaplar.
WEIBULL = WEIBULL ## Weibull dağılımını hesaplar.
ZTEST = ZTEST ## Z-testinin tek kuyruklu olasılık değerini hesaplar.
##
## Text functions Metin fonksiyonları
##
ASC = ASC ## Bir karakter dizesindeki çift enli (iki bayt) İngilizce harfleri veya katakanayı yarım enli (tek bayt) karakterlerle değiştirir.
BAHTTEXT = BAHTTEXT ## Sayıyı, ß (baht) para birimi biçimini kullanarak metne dönüştürür.
CHAR = DAMGA ## Kod sayısıyla belirtilen karakteri verir.
CLEAN = TEMİZ ## Metindeki bütün yazdırılamaz karakterleri kaldırır.
CODE = KOD ## Bir metin dizesindeki ilk karakter için sayısal bir kod verir.
CONCATENATE = BİRLEŞTİR ## Pek çok metin öğesini bir metin öğesi olarak birleştirir.
DOLLAR = LİRA ## Bir sayıyı YTL (yeni Türk lirası) para birimi biçimini kullanarak metne dönüştürür.
EXACT = ÖZDEŞ ## İki metin değerinin özdeş olup olmadığını anlamak için, değerleri denetler.
FIND = BUL ## Bir metin değerini, bir başkasının içinde bulur (büyük küçük harf duyarlıdır).
FINDB = BULB ## Bir metin değerini, bir başkasının içinde bulur (büyük küçük harf duyarlıdır).
FIXED = SAYIDÜZENLE ## Bir sayıyı, sabit sayıda ondalıkla, metin olarak biçimlendirir.
JIS = JIS ## Bir karakter dizesindeki tek enli (tek bayt) İngilizce harfleri veya katakanayı çift enli (iki bayt) karakterlerle değiştirir.
LEFT = SOL ## Bir metin değerinden en soldaki karakterleri verir.
LEFTB = SOLB ## Bir metin değerinden en soldaki karakterleri verir.
LEN = UZUNLUK ## Bir metin dizesindeki karakter sayısını verir.
LENB = UZUNLUKB ## Bir metin dizesindeki karakter sayısını verir.
LOWER = KÜÇÜKHARF ## Metni küçük harfe çevirir.
MID = ORTA ## Bir metin dizesinden belirli sayıda karakteri, belirttiğiniz konumdan başlamak üzere verir.
MIDB = ORTAB ## Bir metin dizesinden belirli sayıda karakteri, belirttiğiniz konumdan başlamak üzere verir.
PHONETIC = SES ## Metin dizesinden ses (furigana) karakterlerini ayıklar.
PROPER = YAZIM.DÜZENİ ## Bir metin değerinin her bir sözcüğünün ilk harfini büyük harfe çevirir.
REPLACE = DEĞİŞTİR ## Metnin içindeki karakterleri değiştirir.
REPLACEB = DEĞİŞTİRB ## Metnin içindeki karakterleri değiştirir.
REPT = YİNELE ## Metni belirtilen sayıda yineler.
RIGHT = SAĞ ## Bir metin değerinden en sağdaki karakterleri verir.
RIGHTB = SAĞB ## Bir metin değerinden en sağdaki karakterleri verir.
SEARCH = BUL ## Bir metin değerini, bir başkasının içinde bulur (büyük küçük harf duyarlı değildir).
SEARCHB = BULB ## Bir metin değerini, bir başkasının içinde bulur (büyük küçük harf duyarlı değildir).
SUBSTITUTE = YERİNEKOY ## Bir metin dizesinde, eski metnin yerine yeni metin koyar.
T = M ## Bağımsız değerlerini metne dönüştürür.
TEXT = METNEÇEVİR ## Bir sayıyı biçimlendirir ve metne dönüştürür.
TRIM = KIRP ## Metindeki boşlukları kaldırır.
UPPER = BÜYÜKHARF ## Metni büyük harfe çevirir.
VALUE = SAYIYAÇEVİR ## Bir metin bağımsız değişkenini sayıya dönüştürür.
PK ! * * PHPExcel/locale/tr/confignu [ ##
## PHPExcel
##
## Copyright (c) 2006 - 2013 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
##
## @category PHPExcel
## @package PHPExcel_Settings
## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
## @version 1.8.0, 2014-03-02
##
##
ArgumentSeparator = ;
##
## (For future use)
##
currencySymbol = YTL
##
## Excel Error Codes (For future use)
##
NULL = #BOŞ!
DIV0 = #SAYI/0!
VALUE = #DEĞER!
REF = #BAŞV!
NAME = #AD?
NUM = #SAYI!
NA = #YOK
PK ! Ts s PHPExcel/locale/en/uk/confignu [ ##
## PHPExcel
##
## Copyright (c) 2006 - 2013 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
##
## @category PHPExcel
## @package PHPExcel_Settings
## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
## @version 1.8.0, 2014-03-02
##
##
##
## (For future use)
##
currencySymbol = £
PK !
a| | PHPExcel/locale/cs/functionsnu [ ##
## PHPExcel
##
## Copyright (c) 2006 - 2013 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
##
## @category PHPExcel
## @package PHPExcel_Calculation
## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
## @version 1.8.0, 2014-03-02
##
## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/
##
##
##
## Add-in and Automation functions Funkce doplňků a automatizace
##
GETPIVOTDATA = ZÍSKATKONTDATA ## Vrátí data uložená v kontingenční tabulce. Pomocí funkce ZÍSKATKONTDATA můžete načíst souhrnná data z kontingenční tabulky, pokud jsou tato data v kontingenční sestavě zobrazena.
##
## Cube functions Funkce pro práci s krychlemi
##
CUBEKPIMEMBER = CUBEKPIMEMBER ## Vrátí název, vlastnost a velikost klíčového ukazatele výkonu (KUV) a zobrazí v buňce název a vlastnost. Klíčový ukazatel výkonu je kvantifikovatelná veličina, například hrubý měsíční zisk nebo čtvrtletní obrat na zaměstnance, která se používá pro sledování výkonnosti organizace.
CUBEMEMBER = CUBEMEMBER ## Vrátí člen nebo n-tici v hierarchii krychle. Slouží k ověření, zda v krychli existuje člen nebo n-tice.
CUBEMEMBERPROPERTY = CUBEMEMBERPROPERTY ## Vrátí hodnotu vlastnosti člena v krychli. Slouží k ověření, zda v krychli existuje člen s daným názvem, a k vrácení konkrétní vlastnosti tohoto člena.
CUBERANKEDMEMBER = CUBERANKEDMEMBER ## Vrátí n-tý nebo pořadový člen sady. Použijte ji pro vrácení jednoho nebo více prvků sady, například obchodníka s nejvyšším obratem nebo deseti nejlepších studentů.
CUBESET = CUBESET ## Definuje vypočtenou sadu členů nebo n-tic odesláním výrazu sady do krychle na serveru, který vytvoří sadu a potom ji vrátí do aplikace Microsoft Office Excel.
CUBESETCOUNT = CUBESETCOUNT ## Vrátí počet položek v množině
CUBEVALUE = CUBEVALUE ## Vrátí úhrnnou hodnotu z krychle.
##
## Database functions Funkce databáze
##
DAVERAGE = DPRŮMĚR ## Vrátí průměr vybraných položek databáze.
DCOUNT = DPOČET ## Spočítá buňky databáze obsahující čísla.
DCOUNTA = DPOČET2 ## Spočítá buňky databáze, které nejsou prázdné.
DGET = DZÍSKAT ## Extrahuje z databáze jeden záznam splňující zadaná kritéria.
DMAX = DMAX ## Vrátí maximální hodnotu z vybraných položek databáze.
DMIN = DMIN ## Vrátí minimální hodnotu z vybraných položek databáze.
DPRODUCT = DSOUČIN ## Vynásobí hodnoty určitého pole záznamů v databázi, které splňují daná kritéria.
DSTDEV = DSMODCH.VÝBĚR ## Odhadne směrodatnou odchylku výběru vybraných položek databáze.
DSTDEVP = DSMODCH ## Vypočte směrodatnou odchylku základního souboru vybraných položek databáze.
DSUM = DSUMA ## Sečte čísla ve sloupcovém poli záznamů databáze, která splňují daná kritéria.
DVAR = DVAR.VÝBĚR ## Odhadne rozptyl výběru vybraných položek databáze.
DVARP = DVAR ## Vypočte rozptyl základního souboru vybraných položek databáze.
##
## Date and time functions Funkce data a času
##
DATE = DATUM ## Vrátí pořadové číslo určitého data.
DATEVALUE = DATUMHODN ## Převede datum ve formě textu na pořadové číslo.
DAY = DEN ## Převede pořadové číslo na den v měsíci.
DAYS360 = ROK360 ## Vrátí počet dní mezi dvěma daty na základě roku s 360 dny.
EDATE = EDATE ## Vrátí pořadové číslo data, které označuje určený počet měsíců před nebo po počátečním datu.
EOMONTH = EOMONTH ## Vrátí pořadové číslo posledního dne měsíce před nebo po zadaném počtu měsíců.
HOUR = HODINA ## Převede pořadové číslo na hodinu.
MINUTE = MINUTA ## Převede pořadové číslo na minutu.
MONTH = MĚSÍC ## Převede pořadové číslo na měsíc.
NETWORKDAYS = NETWORKDAYS ## Vrátí počet celých pracovních dní mezi dvěma daty.
NOW = NYNÍ ## Vrátí pořadové číslo aktuálního data a času.
SECOND = SEKUNDA ## Převede pořadové číslo na sekundu.
TIME = ČAS ## Vrátí pořadové číslo určitého času.
TIMEVALUE = ČASHODN ## Převede čas ve formě textu na pořadové číslo.
TODAY = DNES ## Vrátí pořadové číslo dnešního data.
WEEKDAY = DENTÝDNE ## Převede pořadové číslo na den v týdnu.
WEEKNUM = WEEKNUM ## Převede pořadové číslo na číslo představující číselnou pozici týdne v roce.
WORKDAY = WORKDAY ## Vrátí pořadové číslo data před nebo po zadaném počtu pracovních dní.
YEAR = ROK ## Převede pořadové číslo na rok.
YEARFRAC = YEARFRAC ## Vrátí část roku vyjádřenou zlomkem a představující počet celých dní mezi počátečním a koncovým datem.
##
## Engineering functions Inženýrské funkce (Technické funkce)
##
BESSELI = BESSELI ## Vrátí modifikovanou Besselovu funkci In(x).
BESSELJ = BESSELJ ## Vrátí modifikovanou Besselovu funkci Jn(x).
BESSELK = BESSELK ## Vrátí modifikovanou Besselovu funkci Kn(x).
BESSELY = BESSELY ## Vrátí Besselovu funkci Yn(x).
BIN2DEC = BIN2DEC ## Převede binární číslo na desítkové.
BIN2HEX = BIN2HEX ## Převede binární číslo na šestnáctkové.
BIN2OCT = BIN2OCT ## Převede binární číslo na osmičkové.
COMPLEX = COMPLEX ## Převede reálnou a imaginární část na komplexní číslo.
CONVERT = CONVERT ## Převede číslo do jiného jednotkového měrného systému.
DEC2BIN = DEC2BIN ## Převede desítkového čísla na dvojkové
DEC2HEX = DEC2HEX ## Převede desítkové číslo na šestnáctkové.
DEC2OCT = DEC2OCT ## Převede desítkové číslo na osmičkové.
DELTA = DELTA ## Testuje rovnost dvou hodnot.
ERF = ERF ## Vrátí chybovou funkci.
ERFC = ERFC ## Vrátí doplňkovou chybovou funkci.
GESTEP = GESTEP ## Testuje, zda je číslo větší než mezní hodnota.
HEX2BIN = HEX2BIN ## Převede šestnáctkové číslo na binární.
HEX2DEC = HEX2DEC ## Převede šestnáctkové číslo na desítkové.
HEX2OCT = HEX2OCT ## Převede šestnáctkové číslo na osmičkové.
IMABS = IMABS ## Vrátí absolutní hodnotu (modul) komplexního čísla.
IMAGINARY = IMAGINARY ## Vrátí imaginární část komplexního čísla.
IMARGUMENT = IMARGUMENT ## Vrátí argument théta, úhel vyjádřený v radiánech.
IMCONJUGATE = IMCONJUGATE ## Vrátí komplexně sdružené číslo ke komplexnímu číslu.
IMCOS = IMCOS ## Vrátí kosinus komplexního čísla.
IMDIV = IMDIV ## Vrátí podíl dvou komplexních čísel.
IMEXP = IMEXP ## Vrátí exponenciální tvar komplexního čísla.
IMLN = IMLN ## Vrátí přirozený logaritmus komplexního čísla.
IMLOG10 = IMLOG10 ## Vrátí dekadický logaritmus komplexního čísla.
IMLOG2 = IMLOG2 ## Vrátí logaritmus komplexního čísla při základu 2.
IMPOWER = IMPOWER ## Vrátí komplexní číslo umocněné na celé číslo.
IMPRODUCT = IMPRODUCT ## Vrátí součin komplexních čísel.
IMREAL = IMREAL ## Vrátí reálnou část komplexního čísla.
IMSIN = IMSIN ## Vrátí sinus komplexního čísla.
IMSQRT = IMSQRT ## Vrátí druhou odmocninu komplexního čísla.
IMSUB = IMSUB ## Vrátí rozdíl mezi dvěma komplexními čísly.
IMSUM = IMSUM ## Vrátí součet dvou komplexních čísel.
OCT2BIN = OCT2BIN ## Převede osmičkové číslo na binární.
OCT2DEC = OCT2DEC ## Převede osmičkové číslo na desítkové.
OCT2HEX = OCT2HEX ## Převede osmičkové číslo na šestnáctkové.
##
## Financial functions Finanční funkce
##
ACCRINT = ACCRINT ## Vrátí nahromaděný úrok z cenného papíru, ze kterého je úrok placen v pravidelných termínech.
ACCRINTM = ACCRINTM ## Vrátí nahromaděný úrok z cenného papíru, ze kterého je úrok placen k datu splatnosti.
AMORDEGRC = AMORDEGRC ## Vrátí lineární amortizaci v každém účetním období pomocí koeficientu amortizace.
AMORLINC = AMORLINC ## Vrátí lineární amortizaci v každém účetním období.
COUPDAYBS = COUPDAYBS ## Vrátí počet dnů od začátku období placení kupónů do data splatnosti.
COUPDAYS = COUPDAYS ## Vrátí počet dnů v období placení kupónů, které obsahuje den zúčtování.
COUPDAYSNC = COUPDAYSNC ## Vrátí počet dnů od data zúčtování do následujícího data placení kupónu.
COUPNCD = COUPNCD ## Vrátí následující datum placení kupónu po datu zúčtování.
COUPNUM = COUPNUM ## Vrátí počet kupónů splatných mezi datem zúčtování a datem splatnosti.
COUPPCD = COUPPCD ## Vrátí předchozí datum placení kupónu před datem zúčtování.
CUMIPMT = CUMIPMT ## Vrátí kumulativní úrok splacený mezi dvěma obdobími.
CUMPRINC = CUMPRINC ## Vrátí kumulativní jistinu splacenou mezi dvěma obdobími půjčky.
DB = ODPIS.ZRYCH ## Vrátí odpis aktiva za určité období pomocí degresivní metody odpisu s pevným zůstatkem.
DDB = ODPIS.ZRYCH2 ## Vrátí odpis aktiva za určité období pomocí dvojité degresivní metody odpisu nebo jiné metody, kterou zadáte.
DISC = DISC ## Vrátí diskontní sazbu cenného papíru.
DOLLARDE = DOLLARDE ## Převede částku v korunách vyjádřenou zlomkem na částku v korunách vyjádřenou desetinným číslem.
DOLLARFR = DOLLARFR ## Převede částku v korunách vyjádřenou desetinným číslem na částku v korunách vyjádřenou zlomkem.
DURATION = DURATION ## Vrátí roční dobu cenného papíru s pravidelnými úrokovými sazbami.
EFFECT = EFFECT ## Vrátí efektivní roční úrokovou sazbu.
FV = BUDHODNOTA ## Vrátí budoucí hodnotu investice.
FVSCHEDULE = FVSCHEDULE ## Vrátí budoucí hodnotu počáteční jistiny po použití série sazeb složitého úroku.
INTRATE = INTRATE ## Vrátí úrokovou sazbu plně investovaného cenného papíru.
IPMT = PLATBA.ÚROK ## Vrátí výšku úroku investice za dané období.
IRR = MÍRA.VÝNOSNOSTI ## Vrátí vnitřní výnosové procento série peněžních toků.
ISPMT = ISPMT ## Vypočte výši úroku z investice zaplaceného během určitého období.
MDURATION = MDURATION ## Vrátí Macauleyho modifikovanou dobu cenného papíru o nominální hodnotě 100 Kč.
MIRR = MOD.MÍRA.VÝNOSNOSTI ## Vrátí vnitřní sazbu výnosu, přičemž kladné a záporné hodnoty peněžních prostředků jsou financovány podle různých sazeb.
NOMINAL = NOMINAL ## Vrátí nominální roční úrokovou sazbu.
NPER = POČET.OBDOBÍ ## Vrátí počet období pro investici.
NPV = ČISTÁ.SOUČHODNOTA ## Vrátí čistou současnou hodnotu investice vypočítanou na základě série pravidelných peněžních toků a diskontní sazby.
ODDFPRICE = ODDFPRICE ## Vrátí cenu cenného papíru o nominální hodnotě 100 Kč s odlišným prvním obdobím.
ODDFYIELD = ODDFYIELD ## Vrátí výnos cenného papíru s odlišným prvním obdobím.
ODDLPRICE = ODDLPRICE ## Vrátí cenu cenného papíru o nominální hodnotě 100 Kč s odlišným posledním obdobím.
ODDLYIELD = ODDLYIELD ## Vrátí výnos cenného papíru s odlišným posledním obdobím.
PMT = PLATBA ## Vrátí hodnotu pravidelné splátky anuity.
PPMT = PLATBA.ZÁKLAD ## Vrátí hodnotu splátky jistiny pro zadanou investici za dané období.
PRICE = PRICE ## Vrátí cenu cenného papíru o nominální hodnotě 100 Kč, ze kterého je úrok placen v pravidelných termínech.
PRICEDISC = PRICEDISC ## Vrátí cenu diskontního cenného papíru o nominální hodnotě 100 Kč.
PRICEMAT = PRICEMAT ## Vrátí cenu cenného papíru o nominální hodnotě 100 Kč, ze kterého je úrok placen k datu splatnosti.
PV = SOUČHODNOTA ## Vrátí současnou hodnotu investice.
RATE = ÚROKOVÁ.MÍRA ## Vrátí úrokovou sazbu vztaženou na období anuity.
RECEIVED = RECEIVED ## Vrátí částku obdrženou k datu splatnosti plně investovaného cenného papíru.
SLN = ODPIS.LIN ## Vrátí přímé odpisy aktiva pro jedno období.
SYD = ODPIS.NELIN ## Vrátí směrné číslo ročních odpisů aktiva pro zadané období.
TBILLEQ = TBILLEQ ## Vrátí výnos směnky státní pokladny ekvivalentní výnosu obligace.
TBILLPRICE = TBILLPRICE ## Vrátí cenu směnky státní pokladny o nominální hodnotě 100 Kč.
TBILLYIELD = TBILLYIELD ## Vrátí výnos směnky státní pokladny.
VDB = ODPIS.ZA.INT ## Vrátí odpis aktiva pro určité období nebo část období pomocí degresivní metody odpisu.
XIRR = XIRR ## Vrátí vnitřní výnosnost pro harmonogram peněžních toků, který nemusí být nutně periodický.
XNPV = XNPV ## Vrátí čistou současnou hodnotu pro harmonogram peněžních toků, který nemusí být nutně periodický.
YIELD = YIELD ## Vrátí výnos cenného papíru, ze kterého je úrok placen v pravidelných termínech.
YIELDDISC = YIELDDISC ## Vrátí roční výnos diskontního cenného papíru, například směnky státní pokladny.
YIELDMAT = YIELDMAT ## Vrátí roční výnos cenného papíru, ze kterého je úrok placen k datu splatnosti.
##
## Information functions Informační funkce
##
CELL = POLÍČKO ## Vrátí informace o formátování, umístění nebo obsahu buňky.
ERROR.TYPE = CHYBA.TYP ## Vrátí číslo odpovídající typu chyby.
INFO = O.PROSTŘEDÍ ## Vrátí informace o aktuálním pracovním prostředí.
ISBLANK = JE.PRÁZDNÉ ## Vrátí hodnotu PRAVDA, pokud se argument hodnota odkazuje na prázdnou buňku.
ISERR = JE.CHYBA ## Vrátí hodnotu PRAVDA, pokud je argument hodnota libovolná chybová hodnota (kromě #N/A).
ISERROR = JE.CHYBHODN ## Vrátí hodnotu PRAVDA, pokud je argument hodnota libovolná chybová hodnota.
ISEVEN = ISEVEN ## Vrátí hodnotu PRAVDA, pokud je číslo sudé.
ISLOGICAL = JE.LOGHODN ## Vrátí hodnotu PRAVDA, pokud je argument hodnota logická hodnota.
ISNA = JE.NEDEF ## Vrátí hodnotu PRAVDA, pokud je argument hodnota chybová hodnota #N/A.
ISNONTEXT = JE.NETEXT ## Vrátí hodnotu PRAVDA, pokud argument hodnota není text.
ISNUMBER = JE.ČÍSLO ## Vrátí hodnotu PRAVDA, pokud je argument hodnota číslo.
ISODD = ISODD ## Vrátí hodnotu PRAVDA, pokud je číslo liché.
ISREF = JE.ODKAZ ## Vrátí hodnotu PRAVDA, pokud je argument hodnota odkaz.
ISTEXT = JE.TEXT ## Vrátí hodnotu PRAVDA, pokud je argument hodnota text.
N = N ## Vrátí hodnotu převedenou na číslo.
NA = NEDEF ## Vrátí chybovou hodnotu #N/A.
TYPE = TYP ## Vrátí číslo označující datový typ hodnoty.
##
## Logical functions Logické funkce
##
AND = A ## Vrátí hodnotu PRAVDA, mají-li všechny argumenty hodnotu PRAVDA.
FALSE = NEPRAVDA ## Vrátí logickou hodnotu NEPRAVDA.
IF = KDYŽ ## Určí, který logický test má proběhnout.
IFERROR = IFERROR ## Pokud je vzorec vyhodnocen jako chyba, vrátí zadanou hodnotu. V opačném případě vrátí výsledek vzorce.
NOT = NE ## Provede logickou negaci argumentu funkce.
OR = NEBO ## Vrátí hodnotu PRAVDA, je-li alespoň jeden argument roven hodnotě PRAVDA.
TRUE = PRAVDA ## Vrátí logickou hodnotu PRAVDA.
##
## Lookup and reference functions Vyhledávací funkce
##
ADDRESS = ODKAZ ## Vrátí textový odkaz na jednu buňku listu.
AREAS = POČET.BLOKŮ ## Vrátí počet oblastí v odkazu.
CHOOSE = ZVOLIT ## Zvolí hodnotu ze seznamu hodnot.
COLUMN = SLOUPEC ## Vrátí číslo sloupce odkazu.
COLUMNS = SLOUPCE ## Vrátí počet sloupců v odkazu.
HLOOKUP = VVYHLEDAT ## Prohledá horní řádek matice a vrátí hodnotu určené buňky.
HYPERLINK = HYPERTEXTOVÝ.ODKAZ ## Vytvoří zástupce nebo odkaz, který otevře dokument uložený na síťovém serveru, v síti intranet nebo Internet.
INDEX = INDEX ## Pomocí rejstříku zvolí hodnotu z odkazu nebo matice.
INDIRECT = NEPŘÍMÝ.ODKAZ ## Vrátí odkaz určený textovou hodnotou.
LOOKUP = VYHLEDAT ## Vyhledá hodnoty ve vektoru nebo matici.
MATCH = POZVYHLEDAT ## Vyhledá hodnoty v odkazu nebo matici.
OFFSET = POSUN ## Vrátí posun odkazu od zadaného odkazu.
ROW = ŘÁDEK ## Vrátí číslo řádku odkazu.
ROWS = ŘÁDKY ## Vrátí počet řádků v odkazu.
RTD = RTD ## Načte data reálného času z programu, který podporuje automatizaci modelu COM (Automatizace: Způsob práce s objekty určité aplikace z jiné aplikace nebo nástroje pro vývoj. Automatizace (dříve nazývaná automatizace OLE) je počítačovým standardem a je funkcí modelu COM (Component Object Model).).
TRANSPOSE = TRANSPOZICE ## Vrátí transponovanou matici.
VLOOKUP = SVYHLEDAT ## Prohledá první sloupec matice, přesune kurzor v řádku a vrátí hodnotu buňky.
##
## Math and trigonometry functions Matematické a trigonometrické funkce
##
ABS = ABS ## Vrátí absolutní hodnotu čísla.
ACOS = ARCCOS ## Vrátí arkuskosinus čísla.
ACOSH = ARCCOSH ## Vrátí hyperbolický arkuskosinus čísla.
ASIN = ARCSIN ## Vrátí arkussinus čísla.
ASINH = ARCSINH ## Vrátí hyperbolický arkussinus čísla.
ATAN = ARCTG ## Vrátí arkustangens čísla.
ATAN2 = ARCTG2 ## Vrátí arkustangens x-ové a y-ové souřadnice.
ATANH = ARCTGH ## Vrátí hyperbolický arkustangens čísla.
CEILING = ZAOKR.NAHORU ## Zaokrouhlí číslo na nejbližší celé číslo nebo na nejbližší násobek zadané hodnoty.
COMBIN = KOMBINACE ## Vrátí počet kombinací pro daný počet položek.
COS = COS ## Vrátí kosinus čísla.
COSH = COSH ## Vrátí hyperbolický kosinus čísla.
DEGREES = DEGREES ## Převede radiány na stupně.
EVEN = ZAOKROUHLIT.NA.SUDÉ ## Zaokrouhlí číslo nahoru na nejbližší celé sudé číslo.
EXP = EXP ## Vrátí základ přirozeného logaritmu e umocněný na zadané číslo.
FACT = FAKTORIÁL ## Vrátí faktoriál čísla.
FACTDOUBLE = FACTDOUBLE ## Vrátí dvojitý faktoriál čísla.
FLOOR = ZAOKR.DOLŮ ## Zaokrouhlí číslo dolů, směrem k nule.
GCD = GCD ## Vrátí největší společný dělitel.
INT = CELÁ.ČÁST ## Zaokrouhlí číslo dolů na nejbližší celé číslo.
LCM = LCM ## Vrátí nejmenší společný násobek.
LN = LN ## Vrátí přirozený logaritmus čísla.
LOG = LOGZ ## Vrátí logaritmus čísla při zadaném základu.
LOG10 = LOG ## Vrátí dekadický logaritmus čísla.
MDETERM = DETERMINANT ## Vrátí determinant matice.
MINVERSE = INVERZE ## Vrátí inverzní matici.
MMULT = SOUČIN.MATIC ## Vrátí součin dvou matic.
MOD = MOD ## Vrátí zbytek po dělení.
MROUND = MROUND ## Vrátí číslo zaokrouhlené na požadovaný násobek.
MULTINOMIAL = MULTINOMIAL ## Vrátí mnohočlen z množiny čísel.
ODD = ZAOKROUHLIT.NA.LICHÉ ## Zaokrouhlí číslo nahoru na nejbližší celé liché číslo.
PI = PI ## Vrátí hodnotu čísla pí.
POWER = POWER ## Umocní číslo na zadanou mocninu.
PRODUCT = SOUČIN ## Vynásobí argumenty funkce.
QUOTIENT = QUOTIENT ## Vrátí celou část dělení.
RADIANS = RADIANS ## Převede stupně na radiány.
RAND = NÁHČÍSLO ## Vrátí náhodné číslo mezi 0 a 1.
RANDBETWEEN = RANDBETWEEN ## Vrátí náhodné číslo mezi zadanými čísly.
ROMAN = ROMAN ## Převede arabskou číslici na římskou ve formátu textu.
ROUND = ZAOKROUHLIT ## Zaokrouhlí číslo na zadaný počet číslic.
ROUNDDOWN = ROUNDDOWN ## Zaokrouhlí číslo dolů, směrem k nule.
ROUNDUP = ROUNDUP ## Zaokrouhlí číslo nahoru, směrem od nuly.
SERIESSUM = SERIESSUM ## Vrátí součet mocninné řady určené podle vzorce.
SIGN = SIGN ## Vrátí znaménko čísla.
SIN = SIN ## Vrátí sinus daného úhlu.
SINH = SINH ## Vrátí hyperbolický sinus čísla.
SQRT = ODMOCNINA ## Vrátí kladnou druhou odmocninu.
SQRTPI = SQRTPI ## Vrátí druhou odmocninu výrazu (číslo * pí).
SUBTOTAL = SUBTOTAL ## Vrátí souhrn v seznamu nebo databázi.
SUM = SUMA ## Sečte argumenty funkce.
SUMIF = SUMIF ## Sečte buňky vybrané podle zadaných kritérií.
SUMIFS = SUMIFS ## Sečte buňky určené více zadanými podmínkami.
SUMPRODUCT = SOUČIN.SKALÁRNÍ ## Vrátí součet součinů odpovídajících prvků matic.
SUMSQ = SUMA.ČTVERCŮ ## Vrátí součet čtverců argumentů.
SUMX2MY2 = SUMX2MY2 ## Vrátí součet rozdílu čtverců odpovídajících hodnot ve dvou maticích.
SUMX2PY2 = SUMX2PY2 ## Vrátí součet součtu čtverců odpovídajících hodnot ve dvou maticích.
SUMXMY2 = SUMXMY2 ## Vrátí součet čtverců rozdílů odpovídajících hodnot ve dvou maticích.
TAN = TGTG ## Vrátí tangens čísla.
TANH = TGH ## Vrátí hyperbolický tangens čísla.
TRUNC = USEKNOUT ## Zkrátí číslo na celé číslo.
##
## Statistical functions Statistické funkce
##
AVEDEV = PRŮMODCHYLKA ## Vrátí průměrnou hodnotu absolutních odchylek datových bodů od jejich střední hodnoty.
AVERAGE = PRŮMĚR ## Vrátí průměrnou hodnotu argumentů.
AVERAGEA = AVERAGEA ## Vrátí průměrnou hodnotu argumentů včetně čísel, textu a logických hodnot.
AVERAGEIF = AVERAGEIF ## Vrátí průměrnou hodnotu (aritmetický průměr) všech buněk v oblasti, které vyhovují příslušné podmínce.
AVERAGEIFS = AVERAGEIFS ## Vrátí průměrnou hodnotu (aritmetický průměr) všech buněk vyhovujících několika podmínkám.
BETADIST = BETADIST ## Vrátí hodnotu součtového rozdělení beta.
BETAINV = BETAINV ## Vrátí inverzní hodnotu součtového rozdělení pro zadané rozdělení beta.
BINOMDIST = BINOMDIST ## Vrátí hodnotu binomického rozdělení pravděpodobnosti jednotlivých veličin.
CHIDIST = CHIDIST ## Vrátí jednostrannou pravděpodobnost rozdělení chí-kvadrát.
CHIINV = CHIINV ## Vrátí hodnotu funkce inverzní k distribuční funkci jednostranné pravděpodobnosti rozdělení chí-kvadrát.
CHITEST = CHITEST ## Vrátí test nezávislosti.
CONFIDENCE = CONFIDENCE ## Vrátí interval spolehlivosti pro střední hodnotu základního souboru.
CORREL = CORREL ## Vrátí korelační koeficient mezi dvěma množinami dat.
COUNT = POČET ## Vrátí počet čísel v seznamu argumentů.
COUNTA = POČET2 ## Vrátí počet hodnot v seznamu argumentů.
COUNTBLANK = COUNTBLANK ## Spočítá počet prázdných buněk v oblasti.
COUNTIF = COUNTIF ## Spočítá buňky v oblasti, které odpovídají zadaným kritériím.
COUNTIFS = COUNTIFS ## Spočítá buňky v oblasti, které odpovídají více kritériím.
COVAR = COVAR ## Vrátí hodnotu kovariance, průměrnou hodnotu součinů párových odchylek
CRITBINOM = CRITBINOM ## Vrátí nejmenší hodnotu, pro kterou má součtové binomické rozdělení hodnotu větší nebo rovnu hodnotě kritéria.
DEVSQ = DEVSQ ## Vrátí součet čtverců odchylek.
EXPONDIST = EXPONDIST ## Vrátí hodnotu exponenciálního rozdělení.
FDIST = FDIST ## Vrátí hodnotu rozdělení pravděpodobnosti F.
FINV = FINV ## Vrátí hodnotu inverzní funkce k distribuční funkci rozdělení F.
FISHER = FISHER ## Vrátí hodnotu Fisherovy transformace.
FISHERINV = FISHERINV ## Vrátí hodnotu inverzní funkce k Fisherově transformaci.
FORECAST = FORECAST ## Vrátí hodnotu lineárního trendu.
FREQUENCY = ČETNOSTI ## Vrátí četnost rozdělení jako svislou matici.
FTEST = FTEST ## Vrátí výsledek F-testu.
GAMMADIST = GAMMADIST ## Vrátí hodnotu rozdělení gama.
GAMMAINV = GAMMAINV ## Vrátí hodnotu inverzní funkce k distribuční funkci součtového rozdělení gama.
GAMMALN = GAMMALN ## Vrátí přirozený logaritmus funkce gama, Γ(x).
GEOMEAN = GEOMEAN ## Vrátí geometrický průměr.
GROWTH = LOGLINTREND ## Vrátí hodnoty exponenciálního trendu.
HARMEAN = HARMEAN ## Vrátí harmonický průměr.
HYPGEOMDIST = HYPGEOMDIST ## Vrátí hodnotu hypergeometrického rozdělení.
INTERCEPT = INTERCEPT ## Vrátí úsek lineární regresní čáry.
KURT = KURT ## Vrátí hodnotu excesu množiny dat.
LARGE = LARGE ## Vrátí k-tou největší hodnotu množiny dat.
LINEST = LINREGRESE ## Vrátí parametry lineárního trendu.
LOGEST = LOGLINREGRESE ## Vrátí parametry exponenciálního trendu.
LOGINV = LOGINV ## Vrátí inverzní funkci k distribuční funkci logaritmicko-normálního rozdělení.
LOGNORMDIST = LOGNORMDIST ## Vrátí hodnotu součtového logaritmicko-normálního rozdělení.
MAX = MAX ## Vrátí maximální hodnotu seznamu argumentů.
MAXA = MAXA ## Vrátí maximální hodnotu seznamu argumentů včetně čísel, textu a logických hodnot.
MEDIAN = MEDIAN ## Vrátí střední hodnotu zadaných čísel.
MIN = MIN ## Vrátí minimální hodnotu seznamu argumentů.
MINA = MINA ## Vrátí nejmenší hodnotu v seznamu argumentů včetně čísel, textu a logických hodnot.
MODE = MODE ## Vrátí hodnotu, která se v množině dat vyskytuje nejčastěji.
NEGBINOMDIST = NEGBINOMDIST ## Vrátí hodnotu negativního binomického rozdělení.
NORMDIST = NORMDIST ## Vrátí hodnotu normálního součtového rozdělení.
NORMINV = NORMINV ## Vrátí inverzní funkci k funkci normálního součtového rozdělení.
NORMSDIST = NORMSDIST ## Vrátí hodnotu standardního normálního součtového rozdělení.
NORMSINV = NORMSINV ## Vrátí inverzní funkci k funkci standardního normálního součtového rozdělení.
PEARSON = PEARSON ## Vrátí Pearsonův výsledný momentový korelační koeficient.
PERCENTILE = PERCENTIL ## Vrátí hodnotu k-tého percentilu hodnot v oblasti.
PERCENTRANK = PERCENTRANK ## Vrátí pořadí hodnoty v množině dat vyjádřené procentuální částí množiny dat.
PERMUT = PERMUTACE ## Vrátí počet permutací pro zadaný počet objektů.
POISSON = POISSON ## Vrátí hodnotu distribuční funkce Poissonova rozdělení.
PROB = PROB ## Vrátí pravděpodobnost výskytu hodnot v oblasti mezi dvěma mezními hodnotami.
QUARTILE = QUARTIL ## Vrátí hodnotu kvartilu množiny dat.
RANK = RANK ## Vrátí pořadí čísla v seznamu čísel.
RSQ = RKQ ## Vrátí druhou mocninu Pearsonova výsledného momentového korelačního koeficientu.
SKEW = SKEW ## Vrátí zešikmení rozdělení.
SLOPE = SLOPE ## Vrátí směrnici lineární regresní čáry.
SMALL = SMALL ## Vrátí k-tou nejmenší hodnotu množiny dat.
STANDARDIZE = STANDARDIZE ## Vrátí normalizovanou hodnotu.
STDEV = SMODCH.VÝBĚR ## Vypočte směrodatnou odchylku výběru.
STDEVA = STDEVA ## Vypočte směrodatnou odchylku výběru včetně čísel, textu a logických hodnot.
STDEVP = SMODCH ## Vypočte směrodatnou odchylku základního souboru.
STDEVPA = STDEVPA ## Vypočte směrodatnou odchylku základního souboru včetně čísel, textu a logických hodnot.
STEYX = STEYX ## Vrátí standardní chybu předpovězené hodnoty y pro každou hodnotu x v regresi.
TDIST = TDIST ## Vrátí hodnotu Studentova t-rozdělení.
TINV = TINV ## Vrátí inverzní funkci k distribuční funkci Studentova t-rozdělení.
TREND = LINTREND ## Vrátí hodnoty lineárního trendu.
TRIMMEAN = TRIMMEAN ## Vrátí střední hodnotu vnitřní části množiny dat.
TTEST = TTEST ## Vrátí pravděpodobnost spojenou se Studentovým t-testem.
VAR = VAR.VÝBĚR ## Vypočte rozptyl výběru.
VARA = VARA ## Vypočte rozptyl výběru včetně čísel, textu a logických hodnot.
VARP = VAR ## Vypočte rozptyl základního souboru.
VARPA = VARPA ## Vypočte rozptyl základního souboru včetně čísel, textu a logických hodnot.
WEIBULL = WEIBULL ## Vrátí hodnotu Weibullova rozdělení.
ZTEST = ZTEST ## Vrátí jednostrannou P-hodnotu z-testu.
##
## Text functions Textové funkce
##
ASC = ASC ## Změní znaky s plnou šířkou (dvoubajtové)v řetězci znaků na znaky s poloviční šířkou (jednobajtové).
BAHTTEXT = BAHTTEXT ## Převede číslo na text ve formátu, měny ß (baht).
CHAR = ZNAK ## Vrátí znak určený číslem kódu.
CLEAN = VYČISTIT ## Odebere z textu všechny netisknutelné znaky.
CODE = KÓD ## Vrátí číselný kód prvního znaku zadaného textového řetězce.
CONCATENATE = CONCATENATE ## Spojí několik textových položek do jedné.
DOLLAR = KČ ## Převede číslo na text ve formátu měny Kč (česká koruna).
EXACT = STEJNÉ ## Zkontroluje, zda jsou dvě textové hodnoty shodné.
FIND = NAJÍT ## Nalezne textovou hodnotu uvnitř jiné (rozlišuje malá a velká písmena).
FINDB = FINDB ## Nalezne textovou hodnotu uvnitř jiné (rozlišuje malá a velká písmena).
FIXED = ZAOKROUHLIT.NA.TEXT ## Zformátuje číslo jako text s pevným počtem desetinných míst.
JIS = JIS ## Změní znaky s poloviční šířkou (jednobajtové) v řetězci znaků na znaky s plnou šířkou (dvoubajtové).
LEFT = ZLEVA ## Vrátí první znaky textové hodnoty umístěné nejvíce vlevo.
LEFTB = LEFTB ## Vrátí první znaky textové hodnoty umístěné nejvíce vlevo.
LEN = DÉLKA ## Vrátí počet znaků textového řetězce.
LENB = LENB ## Vrátí počet znaků textového řetězce.
LOWER = MALÁ ## Převede text na malá písmena.
MID = ČÁST ## Vrátí určitý počet znaků textového řetězce počínaje zadaným místem.
MIDB = MIDB ## Vrátí určitý počet znaků textového řetězce počínaje zadaným místem.
PHONETIC = ZVUKOVÉ ## Extrahuje fonetické znaky (furigana) z textového řetězce.
PROPER = VELKÁ2 ## Převede první písmeno každého slova textové hodnoty na velké.
REPLACE = NAHRADIT ## Nahradí znaky uvnitř textu.
REPLACEB = NAHRADITB ## Nahradí znaky uvnitř textu.
REPT = OPAKOVAT ## Zopakuje text podle zadaného počtu opakování.
RIGHT = ZPRAVA ## Vrátí první znaky textové hodnoty umístěné nejvíce vpravo.
RIGHTB = RIGHTB ## Vrátí první znaky textové hodnoty umístěné nejvíce vpravo.
SEARCH = HLEDAT ## Nalezne textovou hodnotu uvnitř jiné (malá a velká písmena nejsou rozlišována).
SEARCHB = SEARCHB ## Nalezne textovou hodnotu uvnitř jiné (malá a velká písmena nejsou rozlišována).
SUBSTITUTE = DOSADIT ## V textovém řetězci nahradí starý text novým.
T = T ## Převede argumenty na text.
TEXT = HODNOTA.NA.TEXT ## Zformátuje číslo a převede ho na text.
TRIM = PROČISTIT ## Odstraní z textu mezery.
UPPER = VELKÁ ## Převede text na velká písmena.
VALUE = HODNOTA ## Převede textový argument na číslo.
PK ! )t* * PHPExcel/locale/cs/confignu [ ##
## PHPExcel
##
## Copyright (c) 2006 - 2013 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
##
## @category PHPExcel
## @package PHPExcel_Settings
## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
## @version 1.8.0, 2014-03-02
##
##
ArgumentSeparator = ;
##
## (For future use)
##
currencySymbol = Kč
##
## Excel Error Codes (For future use)
##
NULL = #NULL!
DIV0 = #DIV/0!
VALUE = #HODNOTA!
REF = #REF!
NAME = #NÁZEV?
NUM = #NUM!
NA = #N/A
PK ! _ PHPExcel/locale/it/functionsnu [ ##
## PHPExcel
##
## Copyright (c) 2006 - 2013 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
##
## @category PHPExcel
## @package PHPExcel_Calculation
## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
## @version 1.8.0, 2014-03-02
##
## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/
##
##
##
## Add-in and Automation functions Funzioni di automazione e dei componenti aggiuntivi
##
GETPIVOTDATA = INFO.DATI.TAB.PIVOT ## Restituisce i dati memorizzati in un rapporto di tabella pivot
##
## Cube functions Funzioni cubo
##
CUBEKPIMEMBER = MEMBRO.KPI.CUBO ## Restituisce il nome, la proprietà e la misura di un indicatore di prestazioni chiave (KPI) e visualizza il nome e la proprietà nella cella. Un KPI è una misura quantificabile, ad esempio l'utile lordo mensile o il fatturato trimestrale dei dipendenti, utilizzata per il monitoraggio delle prestazioni di un'organizzazione.
CUBEMEMBER = MEMBRO.CUBO ## Restituisce un membro o una tupla in una gerarchia di cubi. Consente di verificare l'esistenza del membro o della tupla nel cubo.
CUBEMEMBERPROPERTY = PROPRIETÀ.MEMBRO.CUBO ## Restituisce il valore di una proprietà di un membro del cubo. Consente di verificare l'esistenza di un nome di membro all'interno del cubo e di restituire la proprietà specificata per tale membro.
CUBERANKEDMEMBER = MEMBRO.CUBO.CON.RANGO ## Restituisce l'n-esimo membro o il membro ordinato di un insieme. Consente di restituire uno o più elementi in un insieme, ad esempio l'agente di vendita migliore o i primi 10 studenti.
CUBESET = SET.CUBO ## Definisce un insieme di tuple o membri calcolati mediante l'invio di un'espressione di insieme al cubo sul server. In questo modo l'insieme viene creato e restituito a Microsoft Office Excel.
CUBESETCOUNT = CONTA.SET.CUBO ## Restituisce il numero di elementi di un insieme.
CUBEVALUE = VALORE.CUBO ## Restituisce un valore aggregato da un cubo.
##
## Database functions Funzioni di database
##
DAVERAGE = DB.MEDIA ## Restituisce la media di voci del database selezionate
DCOUNT = DB.CONTA.NUMERI ## Conta le celle di un database contenenti numeri
DCOUNTA = DB.CONTA.VALORI ## Conta le celle non vuote in un database
DGET = DB.VALORI ## Estrae da un database un singolo record che soddisfa i criteri specificati
DMAX = DB.MAX ## Restituisce il valore massimo dalle voci selezionate in un database
DMIN = DB.MIN ## Restituisce il valore minimo dalle voci di un database selezionate
DPRODUCT = DB.PRODOTTO ## Moltiplica i valori in un determinato campo di record che soddisfano i criteri del database
DSTDEV = DB.DEV.ST ## Restituisce una stima della deviazione standard sulla base di un campione di voci di un database selezionate
DSTDEVP = DB.DEV.ST.POP ## Calcola la deviazione standard sulla base di tutte le voci di un database selezionate
DSUM = DB.SOMMA ## Aggiunge i numeri nel campo colonna di record del database che soddisfa determinati criteri
DVAR = DB.VAR ## Restituisce una stima della varianza sulla base di un campione da voci di un database selezionate
DVARP = DB.VAR.POP ## Calcola la varianza sulla base di tutte le voci di un database selezionate
##
## Date and time functions Funzioni data e ora
##
DATE = DATA ## Restituisce il numero seriale di una determinata data
DATEVALUE = DATA.VALORE ## Converte una data sotto forma di testo in un numero seriale
DAY = GIORNO ## Converte un numero seriale in un giorno del mese
DAYS360 = GIORNO360 ## Calcola il numero di giorni compreso tra due date basandosi su un anno di 360 giorni
EDATE = DATA.MESE ## Restituisce il numero seriale della data che rappresenta il numero di mesi prima o dopo la data di inizio
EOMONTH = FINE.MESE ## Restituisce il numero seriale dell'ultimo giorno del mese, prima o dopo un determinato numero di mesi
HOUR = ORA ## Converte un numero seriale in un'ora
MINUTE = MINUTO ## Converte un numero seriale in un minuto
MONTH = MESE ## Converte un numero seriale in un mese
NETWORKDAYS = GIORNI.LAVORATIVI.TOT ## Restituisce il numero di tutti i giorni lavorativi compresi fra due date
NOW = ADESSO ## Restituisce il numero seriale della data e dell'ora corrente
SECOND = SECONDO ## Converte un numero seriale in un secondo
TIME = ORARIO ## Restituisce il numero seriale di una determinata ora
TIMEVALUE = ORARIO.VALORE ## Converte un orario in forma di testo in un numero seriale
TODAY = OGGI ## Restituisce il numero seriale relativo alla data odierna
WEEKDAY = GIORNO.SETTIMANA ## Converte un numero seriale in un giorno della settimana
WEEKNUM = NUM.SETTIMANA ## Converte un numero seriale in un numero che rappresenta la posizione numerica di una settimana nell'anno
WORKDAY = GIORNO.LAVORATIVO ## Restituisce il numero della data prima o dopo un determinato numero di giorni lavorativi
YEAR = ANNO ## Converte un numero seriale in un anno
YEARFRAC = FRAZIONE.ANNO ## Restituisce la frazione dell'anno che rappresenta il numero dei giorni compresi tra una data_ iniziale e una data_finale
##
## Engineering functions Funzioni ingegneristiche
##
BESSELI = BESSEL.I ## Restituisce la funzione di Bessel modificata In(x)
BESSELJ = BESSEL.J ## Restituisce la funzione di Bessel Jn(x)
BESSELK = BESSEL.K ## Restituisce la funzione di Bessel modificata Kn(x)
BESSELY = BESSEL.Y ## Restituisce la funzione di Bessel Yn(x)
BIN2DEC = BINARIO.DECIMALE ## Converte un numero binario in decimale
BIN2HEX = BINARIO.HEX ## Converte un numero binario in esadecimale
BIN2OCT = BINARIO.OCT ## Converte un numero binario in ottale
COMPLEX = COMPLESSO ## Converte i coefficienti reali e immaginari in numeri complessi
CONVERT = CONVERTI ## Converte un numero da un sistema di misura in un altro
DEC2BIN = DECIMALE.BINARIO ## Converte un numero decimale in binario
DEC2HEX = DECIMALE.HEX ## Converte un numero decimale in esadecimale
DEC2OCT = DECIMALE.OCT ## Converte un numero decimale in ottale
DELTA = DELTA ## Verifica se due valori sono uguali
ERF = FUNZ.ERRORE ## Restituisce la funzione di errore
ERFC = FUNZ.ERRORE.COMP ## Restituisce la funzione di errore complementare
GESTEP = SOGLIA ## Verifica se un numero è maggiore del valore di soglia
HEX2BIN = HEX.BINARIO ## Converte un numero esadecimale in binario
HEX2DEC = HEX.DECIMALE ## Converte un numero esadecimale in decimale
HEX2OCT = HEX.OCT ## Converte un numero esadecimale in ottale
IMABS = COMP.MODULO ## Restituisce il valore assoluto (modulo) di un numero complesso
IMAGINARY = COMP.IMMAGINARIO ## Restituisce il coefficiente immaginario di un numero complesso
IMARGUMENT = COMP.ARGOMENTO ## Restituisce l'argomento theta, un angolo espresso in radianti
IMCONJUGATE = COMP.CONIUGATO ## Restituisce il complesso coniugato del numero complesso
IMCOS = COMP.COS ## Restituisce il coseno di un numero complesso
IMDIV = COMP.DIV ## Restituisce il quoziente di due numeri complessi
IMEXP = COMP.EXP ## Restituisce il valore esponenziale di un numero complesso
IMLN = COMP.LN ## Restituisce il logaritmo naturale di un numero complesso
IMLOG10 = COMP.LOG10 ## Restituisce il logaritmo in base 10 di un numero complesso
IMLOG2 = COMP.LOG2 ## Restituisce un logaritmo in base 2 di un numero complesso
IMPOWER = COMP.POTENZA ## Restituisce il numero complesso elevato a una potenza intera
IMPRODUCT = COMP.PRODOTTO ## Restituisce il prodotto di numeri complessi compresi tra 2 e 29
IMREAL = COMP.PARTE.REALE ## Restituisce il coefficiente reale di un numero complesso
IMSIN = COMP.SEN ## Restituisce il seno di un numero complesso
IMSQRT = COMP.RADQ ## Restituisce la radice quadrata di un numero complesso
IMSUB = COMP.DIFF ## Restituisce la differenza fra due numeri complessi
IMSUM = COMP.SOMMA ## Restituisce la somma di numeri complessi
OCT2BIN = OCT.BINARIO ## Converte un numero ottale in binario
OCT2DEC = OCT.DECIMALE ## Converte un numero ottale in decimale
OCT2HEX = OCT.HEX ## Converte un numero ottale in esadecimale
##
## Financial functions Funzioni finanziarie
##
ACCRINT = INT.MATURATO.PER ## Restituisce l'interesse maturato di un titolo che paga interessi periodici
ACCRINTM = INT.MATURATO.SCAD ## Restituisce l'interesse maturato di un titolo che paga interessi alla scadenza
AMORDEGRC = AMMORT.DEGR ## Restituisce l'ammortamento per ogni periodo contabile utilizzando un coefficiente di ammortamento
AMORLINC = AMMORT.PER ## Restituisce l'ammortamento per ogni periodo contabile
COUPDAYBS = GIORNI.CED.INIZ.LIQ ## Restituisce il numero dei giorni che vanno dall'inizio del periodo di durata della cedola alla data di liquidazione
COUPDAYS = GIORNI.CED ## Restituisce il numero dei giorni relativi al periodo della cedola che contiene la data di liquidazione
COUPDAYSNC = GIORNI.CED.NUOVA ## Restituisce il numero di giorni che vanno dalla data di liquidazione alla data della cedola successiva
COUPNCD = DATA.CED.SUCC ## Restituisce un numero che rappresenta la data della cedola successiva alla data di liquidazione
COUPNUM = NUM.CED ## Restituisce il numero di cedole pagabili fra la data di liquidazione e la data di scadenza
COUPPCD = DATA.CED.PREC ## Restituisce un numero che rappresenta la data della cedola precedente alla data di liquidazione
CUMIPMT = INT.CUMUL ## Restituisce l'interesse cumulativo pagato fra due periodi
CUMPRINC = CAP.CUM ## Restituisce il capitale cumulativo pagato per estinguere un debito fra due periodi
DB = DB ## Restituisce l'ammortamento di un bene per un periodo specificato utilizzando il metodo di ammortamento a quote fisse decrescenti
DDB = AMMORT ## Restituisce l'ammortamento di un bene per un periodo specificato utilizzando il metodo di ammortamento a doppie quote decrescenti o altri metodi specificati
DISC = TASSO.SCONTO ## Restituisce il tasso di sconto per un titolo
DOLLARDE = VALUTA.DEC ## Converte un prezzo valuta, espresso come frazione, in prezzo valuta, espresso come numero decimale
DOLLARFR = VALUTA.FRAZ ## Converte un prezzo valuta, espresso come numero decimale, in prezzo valuta, espresso come frazione
DURATION = DURATA ## Restituisce la durata annuale di un titolo con i pagamenti di interesse periodico
EFFECT = EFFETTIVO ## Restituisce l'effettivo tasso di interesse annuo
FV = VAL.FUT ## Restituisce il valore futuro di un investimento
FVSCHEDULE = VAL.FUT.CAPITALE ## Restituisce il valore futuro di un capitale iniziale dopo aver applicato una serie di tassi di interesse composti
INTRATE = TASSO.INT ## Restituisce il tasso di interesse per un titolo interamente investito
IPMT = INTERESSI ## Restituisce il valore degli interessi per un investimento relativo a un periodo specifico
IRR = TIR.COST ## Restituisce il tasso di rendimento interno per una serie di flussi di cassa
ISPMT = INTERESSE.RATA ## Calcola l'interesse di un investimento pagato durante un periodo specifico
MDURATION = DURATA.M ## Restituisce la durata Macauley modificata per un titolo con un valore presunto di € 100
MIRR = TIR.VAR ## Restituisce il tasso di rendimento interno in cui i flussi di cassa positivi e negativi sono finanziati a tassi differenti
NOMINAL = NOMINALE ## Restituisce il tasso di interesse nominale annuale
NPER = NUM.RATE ## Restituisce un numero di periodi relativi a un investimento
NPV = VAN ## Restituisce il valore attuale netto di un investimento basato su una serie di flussi di cassa periodici e sul tasso di sconto
ODDFPRICE = PREZZO.PRIMO.IRR ## Restituisce il prezzo di un titolo dal valore nominale di € 100 avente il primo periodo di durata irregolare
ODDFYIELD = REND.PRIMO.IRR ## Restituisce il rendimento di un titolo avente il primo periodo di durata irregolare
ODDLPRICE = PREZZO.ULTIMO.IRR ## Restituisce il prezzo di un titolo dal valore nominale di € 100 avente l'ultimo periodo di durata irregolare
ODDLYIELD = REND.ULTIMO.IRR ## Restituisce il rendimento di un titolo avente l'ultimo periodo di durata irregolare
PMT = RATA ## Restituisce il pagamento periodico di una rendita annua
PPMT = P.RATA ## Restituisce il pagamento sul capitale di un investimento per un dato periodo
PRICE = PREZZO ## Restituisce il prezzo di un titolo dal valore nominale di € 100 che paga interessi periodici
PRICEDISC = PREZZO.SCONT ## Restituisce il prezzo di un titolo scontato dal valore nominale di € 100
PRICEMAT = PREZZO.SCAD ## Restituisce il prezzo di un titolo dal valore nominale di € 100 che paga gli interessi alla scadenza
PV = VA ## Restituisce il valore attuale di un investimento
RATE = TASSO ## Restituisce il tasso di interesse per un periodo di un'annualità
RECEIVED = RICEV.SCAD ## Restituisce l'ammontare ricevuto alla scadenza di un titolo interamente investito
SLN = AMMORT.COST ## Restituisce l'ammortamento a quote costanti di un bene per un singolo periodo
SYD = AMMORT.ANNUO ## Restituisce l'ammortamento a somma degli anni di un bene per un periodo specificato
TBILLEQ = BOT.EQUIV ## Restituisce il rendimento equivalente ad un'obbligazione per un Buono ordinario del Tesoro
TBILLPRICE = BOT.PREZZO ## Restituisce il prezzo di un Buono del Tesoro dal valore nominale di € 100
TBILLYIELD = BOT.REND ## Restituisce il rendimento di un Buono del Tesoro
VDB = AMMORT.VAR ## Restituisce l'ammortamento di un bene per un periodo specificato o parziale utilizzando il metodo a doppie quote proporzionali ai valori residui
XIRR = TIR.X ## Restituisce il tasso di rendimento interno di un impiego di flussi di cassa
XNPV = VAN.X ## Restituisce il valore attuale netto di un impiego di flussi di cassa non necessariamente periodici
YIELD = REND ## Restituisce il rendimento di un titolo che frutta interessi periodici
YIELDDISC = REND.TITOLI.SCONT ## Restituisce il rendimento annuale di un titolo scontato, ad esempio un Buono del Tesoro
YIELDMAT = REND.SCAD ## Restituisce il rendimento annuo di un titolo che paga interessi alla scadenza
##
## Information functions Funzioni relative alle informazioni
##
CELL = CELLA ## Restituisce le informazioni sulla formattazione, la posizione o i contenuti di una cella
ERROR.TYPE = ERRORE.TIPO ## Restituisce un numero che corrisponde a un tipo di errore
INFO = INFO ## Restituisce le informazioni sull'ambiente operativo corrente
ISBLANK = VAL.VUOTO ## Restituisce VERO se il valore è vuoto
ISERR = VAL.ERR ## Restituisce VERO se il valore è un valore di errore qualsiasi tranne #N/D
ISERROR = VAL.ERRORE ## Restituisce VERO se il valore è un valore di errore qualsiasi
ISEVEN = VAL.PARI ## Restituisce VERO se il numero è pari
ISLOGICAL = VAL.LOGICO ## Restituisce VERO se il valore è un valore logico
ISNA = VAL.NON.DISP ## Restituisce VERO se il valore è un valore di errore #N/D
ISNONTEXT = VAL.NON.TESTO ## Restituisce VERO se il valore non è in formato testo
ISNUMBER = VAL.NUMERO ## Restituisce VERO se il valore è un numero
ISODD = VAL.DISPARI ## Restituisce VERO se il numero è dispari
ISREF = VAL.RIF ## Restituisce VERO se il valore è un riferimento
ISTEXT = VAL.TESTO ## Restituisce VERO se il valore è in formato testo
N = NUM ## Restituisce un valore convertito in numero
NA = NON.DISP ## Restituisce il valore di errore #N/D
TYPE = TIPO ## Restituisce un numero che indica il tipo di dati relativi a un valore
##
## Logical functions Funzioni logiche
##
AND = E ## Restituisce VERO se tutti gli argomenti sono VERO
FALSE = FALSO ## Restituisce il valore logico FALSO
IF = SE ## Specifica un test logico da eseguire
IFERROR = SE.ERRORE ## Restituisce un valore specificato se una formula fornisce un errore come risultato; in caso contrario, restituisce il risultato della formula
NOT = NON ## Inverte la logica degli argomenti
OR = O ## Restituisce VERO se un argomento qualsiasi è VERO
TRUE = VERO ## Restituisce il valore logico VERO
##
## Lookup and reference functions Funzioni di ricerca e di riferimento
##
ADDRESS = INDIRIZZO ## Restituisce un riferimento come testo in una singola cella di un foglio di lavoro
AREAS = AREE ## Restituisce il numero di aree in un riferimento
CHOOSE = SCEGLI ## Sceglie un valore da un elenco di valori
COLUMN = RIF.COLONNA ## Restituisce il numero di colonna di un riferimento
COLUMNS = COLONNE ## Restituisce il numero di colonne in un riferimento
HLOOKUP = CERCA.ORIZZ ## Effettua una ricerca nella riga superiore di una matrice e restituisce il valore della cella specificata
HYPERLINK = COLLEG.IPERTESTUALE ## Crea un collegamento che apre un documento memorizzato in un server di rete, una rete Intranet o Internet
INDEX = INDICE ## Utilizza un indice per scegliere un valore da un riferimento o da una matrice
INDIRECT = INDIRETTO ## Restituisce un riferimento specificato da un valore testo
LOOKUP = CERCA ## Ricerca i valori in un vettore o in una matrice
MATCH = CONFRONTA ## Ricerca i valori in un riferimento o in una matrice
OFFSET = SCARTO ## Restituisce uno scarto di riferimento da un riferimento dato
ROW = RIF.RIGA ## Restituisce il numero di riga di un riferimento
ROWS = RIGHE ## Restituisce il numero delle righe in un riferimento
RTD = DATITEMPOREALE ## Recupera dati in tempo reale da un programma che supporta l'automazione COM (automazione: Metodo per utilizzare gli oggetti di un'applicazione da un'altra applicazione o da un altro strumento di sviluppo. Precedentemente nota come automazione OLE, l'automazione è uno standard del settore e una caratteristica del modello COM (Component Object Model).)
TRANSPOSE = MATR.TRASPOSTA ## Restituisce la trasposizione di una matrice
VLOOKUP = CERCA.VERT ## Effettua una ricerca nella prima colonna di una matrice e si sposta attraverso la riga per restituire il valore di una cella
##
## Math and trigonometry functions Funzioni matematiche e trigonometriche
##
ABS = ASS ## Restituisce il valore assoluto di un numero.
ACOS = ARCCOS ## Restituisce l'arcocoseno di un numero
ACOSH = ARCCOSH ## Restituisce l'inverso del coseno iperbolico di un numero
ASIN = ARCSEN ## Restituisce l'arcoseno di un numero
ASINH = ARCSENH ## Restituisce l'inverso del seno iperbolico di un numero
ATAN = ARCTAN ## Restituisce l'arcotangente di un numero
ATAN2 = ARCTAN.2 ## Restituisce l'arcotangente delle coordinate x e y specificate
ATANH = ARCTANH ## Restituisce l'inverso della tangente iperbolica di un numero
CEILING = ARROTONDA.ECCESSO ## Arrotonda un numero per eccesso all'intero più vicino o al multiplo più vicino a peso
COMBIN = COMBINAZIONE ## Restituisce il numero di combinazioni possibili per un numero assegnato di elementi
COS = COS ## Restituisce il coseno dell'angolo specificato
COSH = COSH ## Restituisce il coseno iperbolico di un numero
DEGREES = GRADI ## Converte i radianti in gradi
EVEN = PARI ## Arrotonda il valore assoluto di un numero per eccesso al più vicino intero pari
EXP = ESP ## Restituisce il numero e elevato alla potenza di num
FACT = FATTORIALE ## Restituisce il fattoriale di un numero
FACTDOUBLE = FATT.DOPPIO ## Restituisce il fattoriale doppio di un numero
FLOOR = ARROTONDA.DIFETTO ## Arrotonda un numero per difetto al multiplo più vicino a zero
GCD = MCD ## Restituisce il massimo comune divisore
INT = INT ## Arrotonda un numero per difetto al numero intero più vicino
LCM = MCM ## Restituisce il minimo comune multiplo
LN = LN ## Restituisce il logaritmo naturale di un numero
LOG = LOG ## Restituisce il logaritmo di un numero in una specificata base
LOG10 = LOG10 ## Restituisce il logaritmo in base 10 di un numero
MDETERM = MATR.DETERM ## Restituisce il determinante di una matrice
MINVERSE = MATR.INVERSA ## Restituisce l'inverso di una matrice
MMULT = MATR.PRODOTTO ## Restituisce il prodotto di due matrici
MOD = RESTO ## Restituisce il resto della divisione
MROUND = ARROTONDA.MULTIPLO ## Restituisce un numero arrotondato al multiplo desiderato
MULTINOMIAL = MULTINOMIALE ## Restituisce il multinomiale di un insieme di numeri
ODD = DISPARI ## Arrotonda un numero per eccesso al più vicino intero dispari
PI = PI.GRECO ## Restituisce il valore di pi greco
POWER = POTENZA ## Restituisce il risultato di un numero elevato a potenza
PRODUCT = PRODOTTO ## Moltiplica i suoi argomenti
QUOTIENT = QUOZIENTE ## Restituisce la parte intera di una divisione
RADIANS = RADIANTI ## Converte i gradi in radianti
RAND = CASUALE ## Restituisce un numero casuale compreso tra 0 e 1
RANDBETWEEN = CASUALE.TRA ## Restituisce un numero casuale compreso tra i numeri specificati
ROMAN = ROMANO ## Restituisce il numero come numero romano sotto forma di testo
ROUND = ARROTONDA ## Arrotonda il numero al numero di cifre specificato
ROUNDDOWN = ARROTONDA.PER.DIF ## Arrotonda il valore assoluto di un numero per difetto
ROUNDUP = ARROTONDA.PER.ECC ## Arrotonda il valore assoluto di un numero per eccesso
SERIESSUM = SOMMA.SERIE ## Restituisce la somma di una serie di potenze in base alla formula
SIGN = SEGNO ## Restituisce il segno di un numero
SIN = SEN ## Restituisce il seno di un dato angolo
SINH = SENH ## Restituisce il seno iperbolico di un numero
SQRT = RADQ ## Restituisce una radice quadrata
SQRTPI = RADQ.PI.GRECO ## Restituisce la radice quadrata di un numero (numero * pi greco)
SUBTOTAL = SUBTOTALE ## Restituisce un subtotale in un elenco o in un database
SUM = SOMMA ## Somma i suoi argomenti
SUMIF = SOMMA.SE ## Somma le celle specificate da un dato criterio
SUMIFS = SOMMA.PIÙ.SE ## Somma le celle in un intervallo che soddisfano più criteri
SUMPRODUCT = MATR.SOMMA.PRODOTTO ## Restituisce la somma dei prodotti dei componenti corrispondenti della matrice
SUMSQ = SOMMA.Q ## Restituisce la somma dei quadrati degli argomenti
SUMX2MY2 = SOMMA.DIFF.Q ## Restituisce la somma della differenza dei quadrati dei corrispondenti elementi in due matrici
SUMX2PY2 = SOMMA.SOMMA.Q ## Restituisce la somma della somma dei quadrati dei corrispondenti elementi in due matrici
SUMXMY2 = SOMMA.Q.DIFF ## Restituisce la somma dei quadrati delle differenze dei corrispondenti elementi in due matrici
TAN = TAN ## Restituisce la tangente di un numero
TANH = TANH ## Restituisce la tangente iperbolica di un numero
TRUNC = TRONCA ## Tronca la parte decimale di un numero
##
## Statistical functions Funzioni statistiche
##
AVEDEV = MEDIA.DEV ## Restituisce la media delle deviazioni assolute delle coordinate rispetto alla loro media
AVERAGE = MEDIA ## Restituisce la media degli argomenti
AVERAGEA = MEDIA.VALORI ## Restituisce la media degli argomenti, inclusi i numeri, il testo e i valori logici
AVERAGEIF = MEDIA.SE ## Restituisce la media aritmetica di tutte le celle in un intervallo che soddisfano un determinato criterio
AVERAGEIFS = MEDIA.PIÙ.SE ## Restituisce la media aritmetica di tutte le celle che soddisfano più criteri
BETADIST = DISTRIB.BETA ## Restituisce la funzione di distribuzione cumulativa beta
BETAINV = INV.BETA ## Restituisce l'inverso della funzione di distribuzione cumulativa per una distribuzione beta specificata
BINOMDIST = DISTRIB.BINOM ## Restituisce la distribuzione binomiale per il termine individuale
CHIDIST = DISTRIB.CHI ## Restituisce la probabilità a una coda per la distribuzione del chi quadrato
CHIINV = INV.CHI ## Restituisce l'inverso della probabilità ad una coda per la distribuzione del chi quadrato
CHITEST = TEST.CHI ## Restituisce il test per l'indipendenza
CONFIDENCE = CONFIDENZA ## Restituisce l'intervallo di confidenza per una popolazione
CORREL = CORRELAZIONE ## Restituisce il coefficiente di correlazione tra due insiemi di dati
COUNT = CONTA.NUMERI ## Conta la quantità di numeri nell'elenco di argomenti
COUNTA = CONTA.VALORI ## Conta il numero di valori nell'elenco di argomenti
COUNTBLANK = CONTA.VUOTE ## Conta il numero di celle vuote all'interno di un intervallo
COUNTIF = CONTA.SE ## Conta il numero di celle all'interno di un intervallo che soddisfa i criteri specificati
COUNTIFS = CONTA.PIÙ.SE ## Conta il numero di celle in un intervallo che soddisfano più criteri.
COVAR = COVARIANZA ## Calcola la covarianza, la media dei prodotti delle deviazioni accoppiate
CRITBINOM = CRIT.BINOM ## Restituisce il più piccolo valore per il quale la distribuzione cumulativa binomiale risulta maggiore o uguale ad un valore di criterio
DEVSQ = DEV.Q ## Restituisce la somma dei quadrati delle deviazioni
EXPONDIST = DISTRIB.EXP ## Restituisce la distribuzione esponenziale
FDIST = DISTRIB.F ## Restituisce la distribuzione di probabilità F
FINV = INV.F ## Restituisce l'inverso della distribuzione della probabilità F
FISHER = FISHER ## Restituisce la trasformazione di Fisher
FISHERINV = INV.FISHER ## Restituisce l'inverso della trasformazione di Fisher
FORECAST = PREVISIONE ## Restituisce i valori lungo una tendenza lineare
FREQUENCY = FREQUENZA ## Restituisce la distribuzione di frequenza come matrice verticale
FTEST = TEST.F ## Restituisce il risultato di un test F
GAMMADIST = DISTRIB.GAMMA ## Restituisce la distribuzione gamma
GAMMAINV = INV.GAMMA ## Restituisce l'inverso della distribuzione cumulativa gamma
GAMMALN = LN.GAMMA ## Restituisce il logaritmo naturale della funzione gamma, G(x)
GEOMEAN = MEDIA.GEOMETRICA ## Restituisce la media geometrica
GROWTH = CRESCITA ## Restituisce i valori lungo una linea di tendenza esponenziale
HARMEAN = MEDIA.ARMONICA ## Restituisce la media armonica
HYPGEOMDIST = DISTRIB.IPERGEOM ## Restituisce la distribuzione ipergeometrica
INTERCEPT = INTERCETTA ## Restituisce l'intercetta della retta di regressione lineare
KURT = CURTOSI ## Restituisce la curtosi di un insieme di dati
LARGE = GRANDE ## Restituisce il k-esimo valore più grande in un insieme di dati
LINEST = REGR.LIN ## Restituisce i parametri di una tendenza lineare
LOGEST = REGR.LOG ## Restituisce i parametri di una linea di tendenza esponenziale
LOGINV = INV.LOGNORM ## Restituisce l'inverso di una distribuzione lognormale
LOGNORMDIST = DISTRIB.LOGNORM ## Restituisce la distribuzione lognormale cumulativa
MAX = MAX ## Restituisce il valore massimo in un elenco di argomenti
MAXA = MAX.VALORI ## Restituisce il valore massimo in un elenco di argomenti, inclusi i numeri, il testo e i valori logici
MEDIAN = MEDIANA ## Restituisce la mediana dei numeri specificati
MIN = MIN ## Restituisce il valore minimo in un elenco di argomenti
MINA = MIN.VALORI ## Restituisce il più piccolo valore in un elenco di argomenti, inclusi i numeri, il testo e i valori logici
MODE = MODA ## Restituisce il valore più comune in un insieme di dati
NEGBINOMDIST = DISTRIB.BINOM.NEG ## Restituisce la distribuzione binomiale negativa
NORMDIST = DISTRIB.NORM ## Restituisce la distribuzione cumulativa normale
NORMINV = INV.NORM ## Restituisce l'inverso della distribuzione cumulativa normale standard
NORMSDIST = DISTRIB.NORM.ST ## Restituisce la distribuzione cumulativa normale standard
NORMSINV = INV.NORM.ST ## Restituisce l'inverso della distribuzione cumulativa normale
PEARSON = PEARSON ## Restituisce il coefficiente del momento di correlazione di Pearson
PERCENTILE = PERCENTILE ## Restituisce il k-esimo dato percentile di valori in un intervallo
PERCENTRANK = PERCENT.RANGO ## Restituisce il rango di un valore in un insieme di dati come percentuale
PERMUT = PERMUTAZIONE ## Restituisce il numero delle permutazioni per un determinato numero di oggetti
POISSON = POISSON ## Restituisce la distribuzione di Poisson
PROB = PROBABILITÀ ## Calcola la probabilità che dei valori in un intervallo siano compresi tra due limiti
QUARTILE = QUARTILE ## Restituisce il quartile di un insieme di dati
RANK = RANGO ## Restituisce il rango di un numero in un elenco di numeri
RSQ = RQ ## Restituisce la radice quadrata del coefficiente di momento di correlazione di Pearson
SKEW = ASIMMETRIA ## Restituisce il grado di asimmetria di una distribuzione
SLOPE = PENDENZA ## Restituisce la pendenza di una retta di regressione lineare
SMALL = PICCOLO ## Restituisce il k-esimo valore più piccolo in un insieme di dati
STANDARDIZE = NORMALIZZA ## Restituisce un valore normalizzato
STDEV = DEV.ST ## Restituisce una stima della deviazione standard sulla base di un campione
STDEVA = DEV.ST.VALORI ## Restituisce una stima della deviazione standard sulla base di un campione, inclusi i numeri, il testo e i valori logici
STDEVP = DEV.ST.POP ## Calcola la deviazione standard sulla base di un'intera popolazione
STDEVPA = DEV.ST.POP.VALORI ## Calcola la deviazione standard sulla base sull'intera popolazione, inclusi i numeri, il testo e i valori logici
STEYX = ERR.STD.YX ## Restituisce l'errore standard del valore previsto per y per ogni valore x nella regressione
TDIST = DISTRIB.T ## Restituisce la distribuzione t di Student
TINV = INV.T ## Restituisce l'inversa della distribuzione t di Student
TREND = TENDENZA ## Restituisce i valori lungo una linea di tendenza lineare
TRIMMEAN = MEDIA.TRONCATA ## Restituisce la media della parte interna di un insieme di dati
TTEST = TEST.T ## Restituisce la probabilità associata ad un test t di Student
VAR = VAR ## Stima la varianza sulla base di un campione
VARA = VAR.VALORI ## Stima la varianza sulla base di un campione, inclusi i numeri, il testo e i valori logici
VARP = VAR.POP ## Calcola la varianza sulla base dell'intera popolazione
VARPA = VAR.POP.VALORI ## Calcola la deviazione standard sulla base sull'intera popolazione, inclusi i numeri, il testo e i valori logici
WEIBULL = WEIBULL ## Restituisce la distribuzione di Weibull
ZTEST = TEST.Z ## Restituisce il valore di probabilità a una coda per un test z
##
## Text functions Funzioni di testo
##
ASC = ASC ## Modifica le lettere inglesi o il katakana a doppio byte all'interno di una stringa di caratteri in caratteri a singolo byte
BAHTTEXT = BAHTTESTO ## Converte un numero in testo, utilizzando il formato valuta ß (baht)
CHAR = CODICE.CARATT ## Restituisce il carattere specificato dal numero di codice
CLEAN = LIBERA ## Elimina dal testo tutti i caratteri che non è possibile stampare
CODE = CODICE ## Restituisce il codice numerico del primo carattere di una stringa di testo
CONCATENATE = CONCATENA ## Unisce diversi elementi di testo in un unico elemento di testo
DOLLAR = VALUTA ## Converte un numero in testo, utilizzando il formato valuta € (euro)
EXACT = IDENTICO ## Verifica se due valori di testo sono uguali
FIND = TROVA ## Rileva un valore di testo all'interno di un altro (distinzione tra maiuscole e minuscole)
FINDB = TROVA.B ## Rileva un valore di testo all'interno di un altro (distinzione tra maiuscole e minuscole)
FIXED = FISSO ## Formatta un numero come testo con un numero fisso di decimali
JIS = ORDINAMENTO.JIS ## Modifica le lettere inglesi o i caratteri katakana a byte singolo all'interno di una stringa di caratteri in caratteri a byte doppio.
LEFT = SINISTRA ## Restituisce il carattere più a sinistra di un valore di testo
LEFTB = SINISTRA.B ## Restituisce il carattere più a sinistra di un valore di testo
LEN = LUNGHEZZA ## Restituisce il numero di caratteri di una stringa di testo
LENB = LUNB ## Restituisce il numero di caratteri di una stringa di testo
LOWER = MINUSC ## Converte il testo in lettere minuscole
MID = MEDIA ## Restituisce un numero specifico di caratteri di una stringa di testo a partire dalla posizione specificata
MIDB = MEDIA.B ## Restituisce un numero specifico di caratteri di una stringa di testo a partire dalla posizione specificata
PHONETIC = FURIGANA ## Estrae i caratteri fonetici (furigana) da una stringa di testo.
PROPER = MAIUSC.INIZ ## Converte in maiuscolo la prima lettera di ogni parola di un valore di testo
REPLACE = RIMPIAZZA ## Sostituisce i caratteri all'interno di un testo
REPLACEB = SOSTITUISCI.B ## Sostituisce i caratteri all'interno di un testo
REPT = RIPETI ## Ripete un testo per un dato numero di volte
RIGHT = DESTRA ## Restituisce il carattere più a destra di un valore di testo
RIGHTB = DESTRA.B ## Restituisce il carattere più a destra di un valore di testo
SEARCH = RICERCA ## Rileva un valore di testo all'interno di un altro (non è sensibile alle maiuscole e minuscole)
SEARCHB = CERCA.B ## Rileva un valore di testo all'interno di un altro (non è sensibile alle maiuscole e minuscole)
SUBSTITUTE = SOSTITUISCI ## Sostituisce il nuovo testo al testo contenuto in una stringa
T = T ## Converte gli argomenti in testo
TEXT = TESTO ## Formatta un numero e lo converte in testo
TRIM = ANNULLA.SPAZI ## Elimina gli spazi dal testo
UPPER = MAIUSC ## Converte il testo in lettere maiuscole
VALUE = VALORE ## Converte un argomento di testo in numero
PK ! ̞>) ) PHPExcel/locale/it/confignu [ ##
## PHPExcel
##
## Copyright (c) 2006 - 2013 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
##
## @category PHPExcel
## @package PHPExcel_Settings
## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
## @version 1.8.0, 2014-03-02
##
##
ArgumentSeparator = ;
##
## (For future use)
##
currencySymbol = €
##
## Excel Error Codes (For future use)
##
NULL = #NULLO!
DIV0 = #DIV/0!
VALUE = #VALORE!
REF = #RIF!
NAME = #NOME?
NUM = #NUM!
NA = #N/D
PK ! S~ސ ސ PHPExcel/locale/fr/functionsnu [ ##
## PHPExcel
##
## Copyright (c) 2006 - 2013 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
##
## @category PHPExcel
## @package PHPExcel_Calculation
## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
## @version 1.8.0, 2014-03-02
##
## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/
##
##
##
## Add-in and Automation functions Fonctions de complément et d’automatisation
##
GETPIVOTDATA = LIREDONNEESTABCROISDYNAMIQUE ## Renvoie les données stockées dans un rapport de tableau croisé dynamique.
##
## Cube functions Fonctions Cube
##
CUBEKPIMEMBER = MEMBREKPICUBE ## Renvoie un nom, une propriété et une mesure d’indicateur de performance clé et affiche le nom et la propriété dans la cellule. Un indicateur de performance clé est une mesure quantifiable, telle que la marge bénéficiaire brute mensuelle ou la rotation trimestrielle du personnel, utilisée pour évaluer les performances d’une entreprise.
CUBEMEMBER = MEMBRECUBE ## Renvoie un membre ou un uplet dans une hiérarchie de cubes. Utilisez cette fonction pour valider l’existence du membre ou de l’uplet dans le cube.
CUBEMEMBERPROPERTY = PROPRIETEMEMBRECUBE ## Renvoie la valeur d’une propriété de membre du cube. Utilisez cette fonction pour valider l’existence d’un nom de membre dans le cube et pour renvoyer la propriété spécifiée pour ce membre.
CUBERANKEDMEMBER = RANGMEMBRECUBE ## Renvoie le nième membre ou le membre placé à un certain rang dans un ensemble. Utilisez cette fonction pour renvoyer un ou plusieurs éléments d’un ensemble, tels que les meilleurs vendeurs ou les 10 meilleurs étudiants.
CUBESET = JEUCUBE ## Définit un ensemble calculé de membres ou d’uplets en envoyant une expression définie au cube sur le serveur qui crée l’ensemble et le renvoie à Microsoft Office Excel.
CUBESETCOUNT = NBJEUCUBE ## Renvoie le nombre d’éléments dans un jeu.
CUBEVALUE = VALEURCUBE ## Renvoie une valeur d’agrégation issue d’un cube.
##
## Database functions Fonctions de base de données
##
DAVERAGE = BDMOYENNE ## Renvoie la moyenne des entrées de base de données sélectionnées.
DCOUNT = BCOMPTE ## Compte le nombre de cellules d’une base de données qui contiennent des nombres.
DCOUNTA = BDNBVAL ## Compte les cellules non vides d’une base de données.
DGET = BDLIRE ## Extrait d’une base de données un enregistrement unique répondant aux critères spécifiés.
DMAX = BDMAX ## Renvoie la valeur maximale des entrées de base de données sélectionnées.
DMIN = BDMIN ## Renvoie la valeur minimale des entrées de base de données sélectionnées.
DPRODUCT = BDPRODUIT ## Multiplie les valeurs d’un champ particulier des enregistrements d’une base de données, qui répondent aux critères spécifiés.
DSTDEV = BDECARTYPE ## Calcule l’écart type pour un échantillon d’entrées de base de données sélectionnées.
DSTDEVP = BDECARTYPEP ## Calcule l’écart type pour l’ensemble d’une population d’entrées de base de données sélectionnées.
DSUM = BDSOMME ## Ajoute les nombres dans la colonne de champ des enregistrements de la base de données, qui répondent aux critères.
DVAR = BDVAR ## Calcule la variance pour un échantillon d’entrées de base de données sélectionnées.
DVARP = BDVARP ## Calcule la variance pour l’ensemble d’une population d’entrées de base de données sélectionnées.
##
## Date and time functions Fonctions de date et d’heure
##
DATE = DATE ## Renvoie le numéro de série d’une date précise.
DATEVALUE = DATEVAL ## Convertit une date représentée sous forme de texte en numéro de série.
DAY = JOUR ## Convertit un numéro de série en jour du mois.
DAYS360 = JOURS360 ## Calcule le nombre de jours qui séparent deux dates sur la base d’une année de 360 jours.
EDATE = MOIS.DECALER ## Renvoie le numéro séquentiel de la date qui représente une date spécifiée (l’argument date_départ), corrigée en plus ou en moins du nombre de mois indiqué.
EOMONTH = FIN.MOIS ## Renvoie le numéro séquentiel de la date du dernier jour du mois précédant ou suivant la date_départ du nombre de mois indiqué.
HOUR = HEURE ## Convertit un numéro de série en heure.
MINUTE = MINUTE ## Convertit un numéro de série en minute.
MONTH = MOIS ## Convertit un numéro de série en mois.
NETWORKDAYS = NB.JOURS.OUVRES ## Renvoie le nombre de jours ouvrés entiers compris entre deux dates.
NOW = MAINTENANT ## Renvoie le numéro de série de la date et de l’heure du jour.
SECOND = SECONDE ## Convertit un numéro de série en seconde.
TIME = TEMPS ## Renvoie le numéro de série d’une heure précise.
TIMEVALUE = TEMPSVAL ## Convertit une date représentée sous forme de texte en numéro de série.
TODAY = AUJOURDHUI ## Renvoie le numéro de série de la date du jour.
WEEKDAY = JOURSEM ## Convertit un numéro de série en jour de la semaine.
WEEKNUM = NO.SEMAINE ## Convertit un numéro de série en un numéro représentant l’ordre de la semaine dans l’année.
WORKDAY = SERIE.JOUR.OUVRE ## Renvoie le numéro de série de la date avant ou après le nombre de jours ouvrés spécifiés.
YEAR = ANNEE ## Convertit un numéro de série en année.
YEARFRAC = FRACTION.ANNEE ## Renvoie la fraction de l’année représentant le nombre de jours entre la date de début et la date de fin.
##
## Engineering functions Fonctions d’ingénierie
##
BESSELI = BESSELI ## Renvoie la fonction Bessel modifiée In(x).
BESSELJ = BESSELJ ## Renvoie la fonction Bessel Jn(x).
BESSELK = BESSELK ## Renvoie la fonction Bessel modifiée Kn(x).
BESSELY = BESSELY ## Renvoie la fonction Bessel Yn(x).
BIN2DEC = BINDEC ## Convertit un nombre binaire en nombre décimal.
BIN2HEX = BINHEX ## Convertit un nombre binaire en nombre hexadécimal.
BIN2OCT = BINOCT ## Convertit un nombre binaire en nombre octal.
COMPLEX = COMPLEXE ## Convertit des coefficients réel et imaginaire en un nombre complexe.
CONVERT = CONVERT ## Convertit un nombre d’une unité de mesure à une autre.
DEC2BIN = DECBIN ## Convertit un nombre décimal en nombre binaire.
DEC2HEX = DECHEX ## Convertit un nombre décimal en nombre hexadécimal.
DEC2OCT = DECOCT ## Convertit un nombre décimal en nombre octal.
DELTA = DELTA ## Teste l’égalité de deux nombres.
ERF = ERF ## Renvoie la valeur de la fonction d’erreur.
ERFC = ERFC ## Renvoie la valeur de la fonction d’erreur complémentaire.
GESTEP = SUP.SEUIL ## Teste si un nombre est supérieur à une valeur de seuil.
HEX2BIN = HEXBIN ## Convertit un nombre hexadécimal en nombre binaire.
HEX2DEC = HEXDEC ## Convertit un nombre hexadécimal en nombre décimal.
HEX2OCT = HEXOCT ## Convertit un nombre hexadécimal en nombre octal.
IMABS = COMPLEXE.MODULE ## Renvoie la valeur absolue (module) d’un nombre complexe.
IMAGINARY = COMPLEXE.IMAGINAIRE ## Renvoie le coefficient imaginaire d’un nombre complexe.
IMARGUMENT = COMPLEXE.ARGUMENT ## Renvoie l’argument thêta, un angle exprimé en radians.
IMCONJUGATE = COMPLEXE.CONJUGUE ## Renvoie le nombre complexe conjugué d’un nombre complexe.
IMCOS = IMCOS ## Renvoie le cosinus d’un nombre complexe.
IMDIV = COMPLEXE.DIV ## Renvoie le quotient de deux nombres complexes.
IMEXP = COMPLEXE.EXP ## Renvoie la fonction exponentielle d’un nombre complexe.
IMLN = COMPLEXE.LN ## Renvoie le logarithme népérien d’un nombre complexe.
IMLOG10 = COMPLEXE.LOG10 ## Calcule le logarithme en base 10 d’un nombre complexe.
IMLOG2 = COMPLEXE.LOG2 ## Calcule le logarithme en base 2 d’un nombre complexe.
IMPOWER = COMPLEXE.PUISSANCE ## Renvoie un nombre complexe élevé à une puissance entière.
IMPRODUCT = COMPLEXE.PRODUIT ## Renvoie le produit de plusieurs nombres complexes.
IMREAL = COMPLEXE.REEL ## Renvoie le coefficient réel d’un nombre complexe.
IMSIN = COMPLEXE.SIN ## Renvoie le sinus d’un nombre complexe.
IMSQRT = COMPLEXE.RACINE ## Renvoie la racine carrée d’un nombre complexe.
IMSUB = COMPLEXE.DIFFERENCE ## Renvoie la différence entre deux nombres complexes.
IMSUM = COMPLEXE.SOMME ## Renvoie la somme de plusieurs nombres complexes.
OCT2BIN = OCTBIN ## Convertit un nombre octal en nombre binaire.
OCT2DEC = OCTDEC ## Convertit un nombre octal en nombre décimal.
OCT2HEX = OCTHEX ## Convertit un nombre octal en nombre hexadécimal.
##
## Financial functions Fonctions financières
##
ACCRINT = INTERET.ACC ## Renvoie l’intérêt couru non échu d’un titre dont l’intérêt est perçu périodiquement.
ACCRINTM = INTERET.ACC.MAT ## Renvoie l’intérêt couru non échu d’un titre dont l’intérêt est perçu à l’échéance.
AMORDEGRC = AMORDEGRC ## Renvoie l’amortissement correspondant à chaque période comptable en utilisant un coefficient d’amortissement.
AMORLINC = AMORLINC ## Renvoie l’amortissement d’un bien à la fin d’une période fiscale donnée.
COUPDAYBS = NB.JOURS.COUPON.PREC ## Renvoie le nombre de jours entre le début de la période de coupon et la date de liquidation.
COUPDAYS = NB.JOURS.COUPONS ## Renvoie le nombre de jours pour la période du coupon contenant la date de liquidation.
COUPDAYSNC = NB.JOURS.COUPON.SUIV ## Renvoie le nombre de jours entre la date de liquidation et la date du coupon suivant la date de liquidation.
COUPNCD = DATE.COUPON.SUIV ## Renvoie la première date de coupon ultérieure à la date de règlement.
COUPNUM = NB.COUPONS ## Renvoie le nombre de coupons dus entre la date de règlement et la date d’échéance.
COUPPCD = DATE.COUPON.PREC ## Renvoie la date de coupon précédant la date de règlement.
CUMIPMT = CUMUL.INTER ## Renvoie l’intérêt cumulé payé sur un emprunt entre deux périodes.
CUMPRINC = CUMUL.PRINCPER ## Renvoie le montant cumulé des remboursements du capital d’un emprunt effectués entre deux périodes.
DB = DB ## Renvoie l’amortissement d’un bien pour une période spécifiée en utilisant la méthode de l’amortissement dégressif à taux fixe.
DDB = DDB ## Renvoie l’amortissement d’un bien pour toute période spécifiée, en utilisant la méthode de l’amortissement dégressif à taux double ou selon un coefficient à spécifier.
DISC = TAUX.ESCOMPTE ## Calcule le taux d’escompte d’une transaction.
DOLLARDE = PRIX.DEC ## Convertit un prix en euros, exprimé sous forme de fraction, en un prix en euros exprimé sous forme de nombre décimal.
DOLLARFR = PRIX.FRAC ## Convertit un prix en euros, exprimé sous forme de nombre décimal, en un prix en euros exprimé sous forme de fraction.
DURATION = DUREE ## Renvoie la durée, en années, d’un titre dont l’intérêt est perçu périodiquement.
EFFECT = TAUX.EFFECTIF ## Renvoie le taux d’intérêt annuel effectif.
FV = VC ## Renvoie la valeur future d’un investissement.
FVSCHEDULE = VC.PAIEMENTS ## Calcule la valeur future d’un investissement en appliquant une série de taux d’intérêt composites.
INTRATE = TAUX.INTERET ## Affiche le taux d’intérêt d’un titre totalement investi.
IPMT = INTPER ## Calcule le montant des intérêts d’un investissement pour une période donnée.
IRR = TRI ## Calcule le taux de rentabilité interne d’un investissement pour une succession de trésoreries.
ISPMT = ISPMT ## Calcule le montant des intérêts d’un investissement pour une période donnée.
MDURATION = DUREE.MODIFIEE ## Renvoie la durée de Macauley modifiée pour un titre ayant une valeur nominale hypothétique de 100_euros.
MIRR = TRIM ## Calcule le taux de rentabilité interne lorsque les paiements positifs et négatifs sont financés à des taux différents.
NOMINAL = TAUX.NOMINAL ## Calcule le taux d’intérêt nominal annuel.
NPER = NPM ## Renvoie le nombre de versements nécessaires pour rembourser un emprunt.
NPV = VAN ## Calcule la valeur actuelle nette d’un investissement basé sur une série de décaissements et un taux d’escompte.
ODDFPRICE = PRIX.PCOUPON.IRREG ## Renvoie le prix par tranche de valeur nominale de 100 euros d’un titre dont la première période de coupon est irrégulière.
ODDFYIELD = REND.PCOUPON.IRREG ## Renvoie le taux de rendement d’un titre dont la première période de coupon est irrégulière.
ODDLPRICE = PRIX.DCOUPON.IRREG ## Renvoie le prix par tranche de valeur nominale de 100 euros d’un titre dont la première période de coupon est irrégulière.
ODDLYIELD = REND.DCOUPON.IRREG ## Renvoie le taux de rendement d’un titre dont la dernière période de coupon est irrégulière.
PMT = VPM ## Calcule le paiement périodique d’un investissement donné.
PPMT = PRINCPER ## Calcule, pour une période donnée, la part de remboursement du principal d’un investissement.
PRICE = PRIX.TITRE ## Renvoie le prix d’un titre rapportant des intérêts périodiques, pour une valeur nominale de 100 euros.
PRICEDISC = VALEUR.ENCAISSEMENT ## Renvoie la valeur d’encaissement d’un escompte commercial, pour une valeur nominale de 100 euros.
PRICEMAT = PRIX.TITRE.ECHEANCE ## Renvoie le prix d’un titre dont la valeur nominale est 100 euros et qui rapporte des intérêts à l’échéance.
PV = PV ## Calcule la valeur actuelle d’un investissement.
RATE = TAUX ## Calcule le taux d’intérêt par période pour une annuité.
RECEIVED = VALEUR.NOMINALE ## Renvoie la valeur nominale à échéance d’un effet de commerce.
SLN = AMORLIN ## Calcule l’amortissement linéaire d’un bien pour une période donnée.
SYD = SYD ## Calcule l’amortissement d’un bien pour une période donnée sur la base de la méthode américaine Sum-of-Years Digits (amortissement dégressif à taux décroissant appliqué à une valeur constante).
TBILLEQ = TAUX.ESCOMPTE.R ## Renvoie le taux d’escompte rationnel d’un bon du Trésor.
TBILLPRICE = PRIX.BON.TRESOR ## Renvoie le prix d’un bon du Trésor d’une valeur nominale de 100 euros.
TBILLYIELD = RENDEMENT.BON.TRESOR ## Calcule le taux de rendement d’un bon du Trésor.
VDB = VDB ## Renvoie l’amortissement d’un bien pour une période spécifiée ou partielle en utilisant une méthode de l’amortissement dégressif à taux fixe.
XIRR = TRI.PAIEMENTS ## Calcule le taux de rentabilité interne d’un ensemble de paiements non périodiques.
XNPV = VAN.PAIEMENTS ## Renvoie la valeur actuelle nette d’un ensemble de paiements non périodiques.
YIELD = RENDEMENT.TITRE ## Calcule le rendement d’un titre rapportant des intérêts périodiquement.
YIELDDISC = RENDEMENT.SIMPLE ## Calcule le taux de rendement d’un emprunt à intérêt simple (par exemple, un bon du Trésor).
YIELDMAT = RENDEMENT.TITRE.ECHEANCE ## Renvoie le rendement annuel d’un titre qui rapporte des intérêts à l’échéance.
##
## Information functions Fonctions d’information
##
CELL = CELLULE ## Renvoie des informations sur la mise en forme, l’emplacement et le contenu d’une cellule.
ERROR.TYPE = TYPE.ERREUR ## Renvoie un nombre correspondant à un type d’erreur.
INFO = INFORMATIONS ## Renvoie des informations sur l’environnement d’exploitation actuel.
ISBLANK = ESTVIDE ## Renvoie VRAI si l’argument valeur est vide.
ISERR = ESTERR ## Renvoie VRAI si l’argument valeur fait référence à une valeur d’erreur, sauf #N/A.
ISERROR = ESTERREUR ## Renvoie VRAI si l’argument valeur fait référence à une valeur d’erreur.
ISEVEN = EST.PAIR ## Renvoie VRAI si le chiffre est pair.
ISLOGICAL = ESTLOGIQUE ## Renvoie VRAI si l’argument valeur fait référence à une valeur logique.
ISNA = ESTNA ## Renvoie VRAI si l’argument valeur fait référence à la valeur d’erreur #N/A.
ISNONTEXT = ESTNONTEXTE ## Renvoie VRAI si l’argument valeur ne se présente pas sous forme de texte.
ISNUMBER = ESTNUM ## Renvoie VRAI si l’argument valeur représente un nombre.
ISODD = EST.IMPAIR ## Renvoie VRAI si le chiffre est impair.
ISREF = ESTREF ## Renvoie VRAI si l’argument valeur est une référence.
ISTEXT = ESTTEXTE ## Renvoie VRAI si l’argument valeur se présente sous forme de texte.
N = N ## Renvoie une valeur convertie en nombre.
NA = NA ## Renvoie la valeur d’erreur #N/A.
TYPE = TYPE ## Renvoie un nombre indiquant le type de données d’une valeur.
##
## Logical functions Fonctions logiques
##
AND = ET ## Renvoie VRAI si tous ses arguments sont VRAI.
FALSE = FAUX ## Renvoie la valeur logique FAUX.
IF = SI ## Spécifie un test logique à effectuer.
IFERROR = SIERREUR ## Renvoie une valeur que vous spécifiez si une formule génère une erreur ; sinon, elle renvoie le résultat de la formule.
NOT = NON ## Inverse la logique de cet argument.
OR = OU ## Renvoie VRAI si un des arguments est VRAI.
TRUE = VRAI ## Renvoie la valeur logique VRAI.
##
## Lookup and reference functions Fonctions de recherche et de référence
##
ADDRESS = ADRESSE ## Renvoie une référence sous forme de texte à une seule cellule d’une feuille de calcul.
AREAS = ZONES ## Renvoie le nombre de zones dans une référence.
CHOOSE = CHOISIR ## Choisit une valeur dans une liste.
COLUMN = COLONNE ## Renvoie le numéro de colonne d’une référence.
COLUMNS = COLONNES ## Renvoie le nombre de colonnes dans une référence.
HLOOKUP = RECHERCHEH ## Effectue une recherche dans la première ligne d’une matrice et renvoie la valeur de la cellule indiquée.
HYPERLINK = LIEN_HYPERTEXTE ## Crée un raccourci ou un renvoi qui ouvre un document stocké sur un serveur réseau, sur un réseau Intranet ou sur Internet.
INDEX = INDEX ## Utilise un index pour choisir une valeur provenant d’une référence ou d’une matrice.
INDIRECT = INDIRECT ## Renvoie une référence indiquée par une valeur de texte.
LOOKUP = RECHERCHE ## Recherche des valeurs dans un vecteur ou une matrice.
MATCH = EQUIV ## Recherche des valeurs dans une référence ou une matrice.
OFFSET = DECALER ## Renvoie une référence décalée par rapport à une référence donnée.
ROW = LIGNE ## Renvoie le numéro de ligne d’une référence.
ROWS = LIGNES ## Renvoie le nombre de lignes dans une référence.
RTD = RTD ## Extrait les données en temps réel à partir d’un programme prenant en charge l’automation COM (Automation : utilisation des objets d'une application à partir d'une autre application ou d'un autre outil de développement. Autrefois appelée OLE Automation, Automation est une norme industrielle et une fonctionnalité du modèle d'objet COM (Component Object Model).).
TRANSPOSE = TRANSPOSE ## Renvoie la transposition d’une matrice.
VLOOKUP = RECHERCHEV ## Effectue une recherche dans la première colonne d’une matrice et se déplace sur la ligne pour renvoyer la valeur d’une cellule.
##
## Math and trigonometry functions Fonctions mathématiques et trigonométriques
##
ABS = ABS ## Renvoie la valeur absolue d’un nombre.
ACOS = ACOS ## Renvoie l’arccosinus d’un nombre.
ACOSH = ACOSH ## Renvoie le cosinus hyperbolique inverse d’un nombre.
ASIN = ASIN ## Renvoie l’arcsinus d’un nombre.
ASINH = ASINH ## Renvoie le sinus hyperbolique inverse d’un nombre.
ATAN = ATAN ## Renvoie l’arctangente d’un nombre.
ATAN2 = ATAN2 ## Renvoie l’arctangente des coordonnées x et y.
ATANH = ATANH ## Renvoie la tangente hyperbolique inverse d’un nombre.
CEILING = PLAFOND ## Arrondit un nombre au nombre entier le plus proche ou au multiple le plus proche de l’argument précision en s’éloignant de zéro.
COMBIN = COMBIN ## Renvoie le nombre de combinaisons que l’on peut former avec un nombre donné d’objets.
COS = COS ## Renvoie le cosinus d’un nombre.
COSH = COSH ## Renvoie le cosinus hyperbolique d’un nombre.
DEGREES = DEGRES ## Convertit des radians en degrés.
EVEN = PAIR ## Arrondit un nombre au nombre entier pair le plus proche en s’éloignant de zéro.
EXP = EXP ## Renvoie e élevé à la puissance d’un nombre donné.
FACT = FACT ## Renvoie la factorielle d’un nombre.
FACTDOUBLE = FACTDOUBLE ## Renvoie la factorielle double d’un nombre.
FLOOR = PLANCHER ## Arrondit un nombre en tendant vers 0 (zéro).
GCD = PGCD ## Renvoie le plus grand commun diviseur.
INT = ENT ## Arrondit un nombre à l’entier immédiatement inférieur.
LCM = PPCM ## Renvoie le plus petit commun multiple.
LN = LN ## Renvoie le logarithme népérien d’un nombre.
LOG = LOG ## Renvoie le logarithme d’un nombre dans la base spécifiée.
LOG10 = LOG10 ## Calcule le logarithme en base 10 d’un nombre.
MDETERM = DETERMAT ## Renvoie le déterminant d’une matrice.
MINVERSE = INVERSEMAT ## Renvoie la matrice inverse d’une matrice.
MMULT = PRODUITMAT ## Renvoie le produit de deux matrices.
MOD = MOD ## Renvoie le reste d’une division.
MROUND = ARRONDI.AU.MULTIPLE ## Donne l’arrondi d’un nombre au multiple spécifié.
MULTINOMIAL = MULTINOMIALE ## Calcule la multinomiale d’un ensemble de nombres.
ODD = IMPAIR ## Renvoie le nombre, arrondi à la valeur du nombre entier impair le plus proche en s’éloignant de zéro.
PI = PI ## Renvoie la valeur de pi.
POWER = PUISSANCE ## Renvoie la valeur du nombre élevé à une puissance.
PRODUCT = PRODUIT ## Multiplie ses arguments.
QUOTIENT = QUOTIENT ## Renvoie la partie entière du résultat d’une division.
RADIANS = RADIANS ## Convertit des degrés en radians.
RAND = ALEA ## Renvoie un nombre aléatoire compris entre 0 et 1.
RANDBETWEEN = ALEA.ENTRE.BORNES ## Renvoie un nombre aléatoire entre les nombres que vous spécifiez.
ROMAN = ROMAIN ## Convertit des chiffres arabes en chiffres romains, sous forme de texte.
ROUND = ARRONDI ## Arrondit un nombre au nombre de chiffres indiqué.
ROUNDDOWN = ARRONDI.INF ## Arrondit un nombre en tendant vers 0 (zéro).
ROUNDUP = ARRONDI.SUP ## Arrondit un nombre à l’entier supérieur, en s’éloignant de zéro.
SERIESSUM = SOMME.SERIES ## Renvoie la somme d’une série géométrique en s’appuyant sur la formule suivante :
SIGN = SIGNE ## Renvoie le signe d’un nombre.
SIN = SIN ## Renvoie le sinus d’un angle donné.
SINH = SINH ## Renvoie le sinus hyperbolique d’un nombre.
SQRT = RACINE ## Renvoie la racine carrée d’un nombre.
SQRTPI = RACINE.PI ## Renvoie la racine carrée de (nombre * pi).
SUBTOTAL = SOUS.TOTAL ## Renvoie un sous-total dans une liste ou une base de données.
SUM = SOMME ## Calcule la somme de ses arguments.
SUMIF = SOMME.SI ## Additionne les cellules spécifiées si elles répondent à un critère donné.
SUMIFS = SOMME.SI.ENS ## Ajoute les cellules d’une plage qui répondent à plusieurs critères.
SUMPRODUCT = SOMMEPROD ## Multiplie les valeurs correspondantes des matrices spécifiées et calcule la somme de ces produits.
SUMSQ = SOMME.CARRES ## Renvoie la somme des carrés des arguments.
SUMX2MY2 = SOMME.X2MY2 ## Renvoie la somme de la différence des carrés des valeurs correspondantes de deux matrices.
SUMX2PY2 = SOMME.X2PY2 ## Renvoie la somme de la somme des carrés des valeurs correspondantes de deux matrices.
SUMXMY2 = SOMME.XMY2 ## Renvoie la somme des carrés des différences entre les valeurs correspondantes de deux matrices.
TAN = TAN ## Renvoie la tangente d’un nombre.
TANH = TANH ## Renvoie la tangente hyperbolique d’un nombre.
TRUNC = TRONQUE ## Renvoie la partie entière d’un nombre.
##
## Statistical functions Fonctions statistiques
##
AVEDEV = ECART.MOYEN ## Renvoie la moyenne des écarts absolus observés dans la moyenne des points de données.
AVERAGE = MOYENNE ## Renvoie la moyenne de ses arguments.
AVERAGEA = AVERAGEA ## Renvoie la moyenne de ses arguments, nombres, texte et valeurs logiques inclus.
AVERAGEIF = MOYENNE.SI ## Renvoie la moyenne (arithmétique) de toutes les cellules d’une plage qui répondent à des critères donnés.
AVERAGEIFS = MOYENNE.SI.ENS ## Renvoie la moyenne (arithmétique) de toutes les cellules qui répondent à plusieurs critères.
BETADIST = LOI.BETA ## Renvoie la fonction de distribution cumulée.
BETAINV = BETA.INVERSE ## Renvoie l’inverse de la fonction de distribution cumulée pour une distribution bêta spécifiée.
BINOMDIST = LOI.BINOMIALE ## Renvoie la probabilité d’une variable aléatoire discrète suivant la loi binomiale.
CHIDIST = LOI.KHIDEUX ## Renvoie la probabilité unilatérale de la distribution khi-deux.
CHIINV = KHIDEUX.INVERSE ## Renvoie l’inverse de la probabilité unilatérale de la distribution khi-deux.
CHITEST = TEST.KHIDEUX ## Renvoie le test d’indépendance.
CONFIDENCE = INTERVALLE.CONFIANCE ## Renvoie l’intervalle de confiance pour une moyenne de population.
CORREL = COEFFICIENT.CORRELATION ## Renvoie le coefficient de corrélation entre deux séries de données.
COUNT = NB ## Détermine les nombres compris dans la liste des arguments.
COUNTA = NBVAL ## Détermine le nombre de valeurs comprises dans la liste des arguments.
COUNTBLANK = NB.VIDE ## Compte le nombre de cellules vides dans une plage.
COUNTIF = NB.SI ## Compte le nombre de cellules qui répondent à un critère donné dans une plage.
COUNTIFS = NB.SI.ENS ## Compte le nombre de cellules à l’intérieur d’une plage qui répondent à plusieurs critères.
COVAR = COVARIANCE ## Renvoie la covariance, moyenne des produits des écarts pour chaque série d’observations.
CRITBINOM = CRITERE.LOI.BINOMIALE ## Renvoie la plus petite valeur pour laquelle la distribution binomiale cumulée est inférieure ou égale à une valeur de critère.
DEVSQ = SOMME.CARRES.ECARTS ## Renvoie la somme des carrés des écarts.
EXPONDIST = LOI.EXPONENTIELLE ## Renvoie la distribution exponentielle.
FDIST = LOI.F ## Renvoie la distribution de probabilité F.
FINV = INVERSE.LOI.F ## Renvoie l’inverse de la distribution de probabilité F.
FISHER = FISHER ## Renvoie la transformation de Fisher.
FISHERINV = FISHER.INVERSE ## Renvoie l’inverse de la transformation de Fisher.
FORECAST = PREVISION ## Calcule une valeur par rapport à une tendance linéaire.
FREQUENCY = FREQUENCE ## Calcule la fréquence d’apparition des valeurs dans une plage de valeurs, puis renvoie des nombres sous forme de matrice verticale.
FTEST = TEST.F ## Renvoie le résultat d’un test F.
GAMMADIST = LOI.GAMMA ## Renvoie la probabilité d’une variable aléatoire suivant une loi Gamma.
GAMMAINV = LOI.GAMMA.INVERSE ## Renvoie, pour une probabilité donnée, la valeur d’une variable aléatoire suivant une loi Gamma.
GAMMALN = LNGAMMA ## Renvoie le logarithme népérien de la fonction Gamma, G(x)
GEOMEAN = MOYENNE.GEOMETRIQUE ## Renvoie la moyenne géométrique.
GROWTH = CROISSANCE ## Calcule des valeurs par rapport à une tendance exponentielle.
HARMEAN = MOYENNE.HARMONIQUE ## Renvoie la moyenne harmonique.
HYPGEOMDIST = LOI.HYPERGEOMETRIQUE ## Renvoie la probabilité d’une variable aléatoire discrète suivant une loi hypergéométrique.
INTERCEPT = ORDONNEE.ORIGINE ## Renvoie l’ordonnée à l’origine d’une droite de régression linéaire.
KURT = KURTOSIS ## Renvoie le kurtosis d’une série de données.
LARGE = GRANDE.VALEUR ## Renvoie la k-ième plus grande valeur d’une série de données.
LINEST = DROITEREG ## Renvoie les paramètres d’une tendance linéaire.
LOGEST = LOGREG ## Renvoie les paramètres d’une tendance exponentielle.
LOGINV = LOI.LOGNORMALE.INVERSE ## Renvoie l’inverse de la probabilité pour une variable aléatoire suivant la loi lognormale.
LOGNORMDIST = LOI.LOGNORMALE ## Renvoie la probabilité d’une variable aléatoire continue suivant une loi lognormale.
MAX = MAX ## Renvoie la valeur maximale contenue dans une liste d’arguments.
MAXA = MAXA ## Renvoie la valeur maximale d’une liste d’arguments, nombres, texte et valeurs logiques inclus.
MEDIAN = MEDIANE ## Renvoie la valeur médiane des nombres donnés.
MIN = MIN ## Renvoie la valeur minimale contenue dans une liste d’arguments.
MINA = MINA ## Renvoie la plus petite valeur d’une liste d’arguments, nombres, texte et valeurs logiques inclus.
MODE = MODE ## Renvoie la valeur la plus courante d’une série de données.
NEGBINOMDIST = LOI.BINOMIALE.NEG ## Renvoie la probabilité d’une variable aléatoire discrète suivant une loi binomiale négative.
NORMDIST = LOI.NORMALE ## Renvoie la probabilité d’une variable aléatoire continue suivant une loi normale.
NORMINV = LOI.NORMALE.INVERSE ## Renvoie, pour une probabilité donnée, la valeur d’une variable aléatoire suivant une loi normale standard.
NORMSDIST = LOI.NORMALE.STANDARD ## Renvoie la probabilité d’une variable aléatoire continue suivant une loi normale standard.
NORMSINV = LOI.NORMALE.STANDARD.INVERSE ## Renvoie l’inverse de la distribution cumulée normale standard.
PEARSON = PEARSON ## Renvoie le coefficient de corrélation d’échantillonnage de Pearson.
PERCENTILE = CENTILE ## Renvoie le k-ième centile des valeurs d’une plage.
PERCENTRANK = RANG.POURCENTAGE ## Renvoie le rang en pourcentage d’une valeur d’une série de données.
PERMUT = PERMUTATION ## Renvoie le nombre de permutations pour un nombre donné d’objets.
POISSON = LOI.POISSON ## Renvoie la probabilité d’une variable aléatoire suivant une loi de Poisson.
PROB = PROBABILITE ## Renvoie la probabilité que des valeurs d’une plage soient comprises entre deux limites.
QUARTILE = QUARTILE ## Renvoie le quartile d’une série de données.
RANK = RANG ## Renvoie le rang d’un nombre contenu dans une liste.
RSQ = COEFFICIENT.DETERMINATION ## Renvoie la valeur du coefficient de détermination R^2 d’une régression linéaire.
SKEW = COEFFICIENT.ASYMETRIE ## Renvoie l’asymétrie d’une distribution.
SLOPE = PENTE ## Renvoie la pente d’une droite de régression linéaire.
SMALL = PETITE.VALEUR ## Renvoie la k-ième plus petite valeur d’une série de données.
STANDARDIZE = CENTREE.REDUITE ## Renvoie une valeur centrée réduite.
STDEV = ECARTYPE ## Évalue l’écart type d’une population en se basant sur un échantillon de cette population.
STDEVA = STDEVA ## Évalue l’écart type d’une population en se basant sur un échantillon de cette population, nombres, texte et valeurs logiques inclus.
STDEVP = ECARTYPEP ## Calcule l’écart type d’une population à partir de la population entière.
STDEVPA = STDEVPA ## Calcule l’écart type d’une population à partir de l’ensemble de la population, nombres, texte et valeurs logiques inclus.
STEYX = ERREUR.TYPE.XY ## Renvoie l’erreur type de la valeur y prévue pour chaque x de la régression.
TDIST = LOI.STUDENT ## Renvoie la probabilité d’une variable aléatoire suivant une loi T de Student.
TINV = LOI.STUDENT.INVERSE ## Renvoie, pour une probabilité donnée, la valeur d’une variable aléatoire suivant une loi T de Student.
TREND = TENDANCE ## Renvoie des valeurs par rapport à une tendance linéaire.
TRIMMEAN = MOYENNE.REDUITE ## Renvoie la moyenne de l’intérieur d’une série de données.
TTEST = TEST.STUDENT ## Renvoie la probabilité associée à un test T de Student.
VAR = VAR ## Calcule la variance sur la base d’un échantillon.
VARA = VARA ## Estime la variance d’une population en se basant sur un échantillon de cette population, nombres, texte et valeurs logiques incluses.
VARP = VAR.P ## Calcule la variance sur la base de l’ensemble de la population.
VARPA = VARPA ## Calcule la variance d’une population en se basant sur la population entière, nombres, texte et valeurs logiques inclus.
WEIBULL = LOI.WEIBULL ## Renvoie la probabilité d’une variable aléatoire suivant une loi de Weibull.
ZTEST = TEST.Z ## Renvoie la valeur de probabilité unilatérale d’un test z.
##
## Text functions Fonctions de texte
##
ASC = ASC ## Change les caractères anglais ou katakana à pleine chasse (codés sur deux octets) à l’intérieur d’une chaîne de caractères en caractères à demi-chasse (codés sur un octet).
BAHTTEXT = BAHTTEXT ## Convertit un nombre en texte en utilisant le format monétaire ß (baht).
CHAR = CAR ## Renvoie le caractère spécifié par le code numérique.
CLEAN = EPURAGE ## Supprime tous les caractères de contrôle du texte.
CODE = CODE ## Renvoie le numéro de code du premier caractère du texte.
CONCATENATE = CONCATENER ## Assemble plusieurs éléments textuels de façon à n’en former qu’un seul.
DOLLAR = EURO ## Convertit un nombre en texte en utilisant le format monétaire € (euro).
EXACT = EXACT ## Vérifie si deux valeurs de texte sont identiques.
FIND = TROUVE ## Trouve un valeur textuelle dans une autre, en respectant la casse.
FINDB = TROUVERB ## Trouve un valeur textuelle dans une autre, en respectant la casse.
FIXED = CTXT ## Convertit un nombre au format texte avec un nombre de décimales spécifié.
JIS = JIS ## Change les caractères anglais ou katakana à demi-chasse (codés sur un octet) à l’intérieur d’une chaîne de caractères en caractères à à pleine chasse (codés sur deux octets).
LEFT = GAUCHE ## Renvoie des caractères situés à l’extrême gauche d’une chaîne de caractères.
LEFTB = GAUCHEB ## Renvoie des caractères situés à l’extrême gauche d’une chaîne de caractères.
LEN = NBCAR ## Renvoie le nombre de caractères contenus dans une chaîne de texte.
LENB = LENB ## Renvoie le nombre de caractères contenus dans une chaîne de texte.
LOWER = MINUSCULE ## Convertit le texte en minuscules.
MID = STXT ## Renvoie un nombre déterminé de caractères d’une chaîne de texte à partir de la position que vous indiquez.
MIDB = STXTB ## Renvoie un nombre déterminé de caractères d’une chaîne de texte à partir de la position que vous indiquez.
PHONETIC = PHONETIQUE ## Extrait les caractères phonétiques (furigana) d’une chaîne de texte.
PROPER = NOMPROPRE ## Met en majuscules la première lettre de chaque mot dans une chaîne textuelle.
REPLACE = REMPLACER ## Remplace des caractères dans un texte.
REPLACEB = REMPLACERB ## Remplace des caractères dans un texte.
REPT = REPT ## Répète un texte un certain nombre de fois.
RIGHT = DROITE ## Renvoie des caractères situés à l’extrême droite d’une chaîne de caractères.
RIGHTB = DROITEB ## Renvoie des caractères situés à l’extrême droite d’une chaîne de caractères.
SEARCH = CHERCHE ## Trouve un texte dans un autre texte (sans respecter la casse).
SEARCHB = CHERCHERB ## Trouve un texte dans un autre texte (sans respecter la casse).
SUBSTITUTE = SUBSTITUE ## Remplace l’ancien texte d’une chaîne de caractères par un nouveau.
T = T ## Convertit ses arguments en texte.
TEXT = TEXTE ## Convertit un nombre au format texte.
TRIM = SUPPRESPACE ## Supprime les espaces du texte.
UPPER = MAJUSCULE ## Convertit le texte en majuscules.
VALUE = CNUM ## Convertit un argument textuel en nombre
PK ! ˣ) ) PHPExcel/locale/fr/confignu [ ##
## PHPExcel
##
## Copyright (c) 2006 - 2013 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
##
## @category PHPExcel
## @package PHPExcel_Settings
## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
## @version 1.8.0, 2014-03-02
##
##
ArgumentSeparator = ;
##
## (For future use)
##
currencySymbol = €
##
## Excel Error Codes (For future use)
##
NULL = #NUL!
DIV0 = #DIV/0!
VALUE = #VALEUR!
REF = #REF!
NAME = #NOM?
NUM = #NOMBRE!
NA = #N/A
PK ! >kUv Uv PHPExcel/locale/sv/functionsnu [ ##
## Add-in and Automation functions Tilläggs- och automatiseringsfunktioner
##
GETPIVOTDATA = HÄMTA.PIVOTDATA ## Returnerar data som lagrats i en pivottabellrapport
##
## Cube functions Kubfunktioner
##
CUBEKPIMEMBER = KUBKPIMEDLEM ## Returnerar namn, egenskap och mått för en KPI och visar namnet och egenskapen i cellen. En KPI, eller prestandaindikator, är ett kvantifierbart mått, t.ex. månatlig bruttovinst eller personalomsättning per kvartal, som används för att analysera ett företags resultat.
CUBEMEMBER = KUBMEDLEM ## Returnerar en medlem eller ett par i en kubhierarki. Används för att verifiera att medlemmen eller paret finns i kuben.
CUBEMEMBERPROPERTY = KUBMEDLEMSEGENSKAP ## Returnerar värdet för en medlemsegenskap i kuben. Används för att verifiera att ett medlemsnamn finns i kuben, samt för att returnera den angivna egenskapen för medlemmen.
CUBERANKEDMEMBER = KUBRANGORDNADMEDLEM ## Returnerar den n:te, eller rangordnade, medlemmen i en uppsättning. Används för att returnera ett eller flera element i en uppsättning, till exempelvis den bästa försäljaren eller de tio bästa eleverna.
CUBESET = KUBINSTÄLLNING ## Definierar en beräknad uppsättning medlemmar eller par genom att skicka ett bestämt uttryck till kuben på servern, som skapar uppsättningen och sedan returnerar den till Microsoft Office Excel.
CUBESETCOUNT = KUBINSTÄLLNINGANTAL ## Returnerar antalet objekt i en uppsättning.
CUBEVALUE = KUBVÄRDE ## Returnerar ett mängdvärde från en kub.
##
## Database functions Databasfunktioner
##
DAVERAGE = DMEDEL ## Returnerar medelvärdet av databasposterna
DCOUNT = DANTAL ## Räknar antalet celler som innehåller tal i en databas
DCOUNTA = DANTALV ## Räknar ifyllda celler i en databas
DGET = DHÄMTA ## Hämtar en enstaka post från en databas som uppfyller de angivna villkoren
DMAX = DMAX ## Returnerar det största värdet från databasposterna
DMIN = DMIN ## Returnerar det minsta värdet från databasposterna
DPRODUCT = DPRODUKT ## Multiplicerar värdena i ett visst fält i poster som uppfyller villkoret
DSTDEV = DSTDAV ## Uppskattar standardavvikelsen baserat på ett urval av databasposterna
DSTDEVP = DSTDAVP ## Beräknar standardavvikelsen utifrån hela populationen av valda databasposter
DSUM = DSUMMA ## Summerar talen i kolumnfält i databasposter som uppfyller villkoret
DVAR = DVARIANS ## Uppskattar variansen baserat på ett urval av databasposterna
DVARP = DVARIANSP ## Beräknar variansen utifrån hela populationen av valda databasposter
##
## Date and time functions Tid- och datumfunktioner
##
DATE = DATUM ## Returnerar ett serienummer för ett visst datum
DATEVALUE = DATUMVÄRDE ## Konverterar ett datum i textformat till ett serienummer
DAY = DAG ## Konverterar ett serienummer till dag i månaden
DAYS360 = DAGAR360 ## Beräknar antalet dagar mellan två datum baserat på ett 360-dagarsår
EDATE = EDATUM ## Returnerar serienumret för ett datum som infaller ett visst antal månader före eller efter startdatumet
EOMONTH = SLUTMÅNAD ## Returnerar serienumret för sista dagen i månaden ett visst antal månader tidigare eller senare
HOUR = TIMME ## Konverterar ett serienummer till en timme
MINUTE = MINUT ## Konverterar ett serienummer till en minut
MONTH = MÅNAD ## Konverterar ett serienummer till en månad
NETWORKDAYS = NETTOARBETSDAGAR ## Returnerar antalet hela arbetsdagar mellan två datum
NOW = NU ## Returnerar serienumret för dagens datum och aktuell tid
SECOND = SEKUND ## Konverterar ett serienummer till en sekund
TIME = KLOCKSLAG ## Returnerar serienumret för en viss tid
TIMEVALUE = TIDVÄRDE ## Konverterar en tid i textformat till ett serienummer
TODAY = IDAG ## Returnerar serienumret för dagens datum
WEEKDAY = VECKODAG ## Konverterar ett serienummer till en dag i veckan
WEEKNUM = VECKONR ## Konverterar ett serienummer till ett veckonummer
WORKDAY = ARBETSDAGAR ## Returnerar serienumret för ett datum ett visst antal arbetsdagar tidigare eller senare
YEAR = ÅR ## Konverterar ett serienummer till ett år
YEARFRAC = ÅRDEL ## Returnerar en del av ett år som representerar antalet hela dagar mellan start- och slutdatum
##
## Engineering functions Tekniska funktioner
##
BESSELI = BESSELI ## Returnerar den modifierade Bessel-funktionen In(x)
BESSELJ = BESSELJ ## Returnerar Bessel-funktionen Jn(x)
BESSELK = BESSELK ## Returnerar den modifierade Bessel-funktionen Kn(x)
BESSELY = BESSELY ## Returnerar Bessel-funktionen Yn(x)
BIN2DEC = BIN.TILL.DEC ## Omvandlar ett binärt tal till decimalt
BIN2HEX = BIN.TILL.HEX ## Omvandlar ett binärt tal till hexadecimalt
BIN2OCT = BIN.TILL.OKT ## Omvandlar ett binärt tal till oktalt
COMPLEX = KOMPLEX ## Omvandlar reella och imaginära koefficienter till ett komplext tal
CONVERT = KONVERTERA ## Omvandlar ett tal från ett måttsystem till ett annat
DEC2BIN = DEC.TILL.BIN ## Omvandlar ett decimalt tal till binärt
DEC2HEX = DEC.TILL.HEX ## Omvandlar ett decimalt tal till hexadecimalt
DEC2OCT = DEC.TILL.OKT ## Omvandlar ett decimalt tal till oktalt
DELTA = DELTA ## Testar om två värden är lika
ERF = FELF ## Returnerar felfunktionen
ERFC = FELFK ## Returnerar den komplementära felfunktionen
GESTEP = SLSTEG ## Testar om ett tal är större än ett tröskelvärde
HEX2BIN = HEX.TILL.BIN ## Omvandlar ett hexadecimalt tal till binärt
HEX2DEC = HEX.TILL.DEC ## Omvandlar ett hexadecimalt tal till decimalt
HEX2OCT = HEX.TILL.OKT ## Omvandlar ett hexadecimalt tal till oktalt
IMABS = IMABS ## Returnerar absolutvärdet (modulus) för ett komplext tal
IMAGINARY = IMAGINÄR ## Returnerar den imaginära koefficienten för ett komplext tal
IMARGUMENT = IMARGUMENT ## Returnerar det komplexa talets argument, en vinkel uttryckt i radianer
IMCONJUGATE = IMKONJUGAT ## Returnerar det komplexa talets konjugat
IMCOS = IMCOS ## Returnerar cosinus för ett komplext tal
IMDIV = IMDIV ## Returnerar kvoten för två komplexa tal
IMEXP = IMEUPPHÖJT ## Returnerar exponenten för ett komplext tal
IMLN = IMLN ## Returnerar den naturliga logaritmen för ett komplext tal
IMLOG10 = IMLOG10 ## Returnerar 10-logaritmen för ett komplext tal
IMLOG2 = IMLOG2 ## Returnerar 2-logaritmen för ett komplext tal
IMPOWER = IMUPPHÖJT ## Returnerar ett komplext tal upphöjt till en exponent
IMPRODUCT = IMPRODUKT ## Returnerar produkten av komplexa tal
IMREAL = IMREAL ## Returnerar den reella koefficienten för ett komplext tal
IMSIN = IMSIN ## Returnerar sinus för ett komplext tal
IMSQRT = IMROT ## Returnerar kvadratroten av ett komplext tal
IMSUB = IMDIFF ## Returnerar differensen mellan två komplexa tal
IMSUM = IMSUM ## Returnerar summan av komplexa tal
OCT2BIN = OKT.TILL.BIN ## Omvandlar ett oktalt tal till binärt
OCT2DEC = OKT.TILL.DEC ## Omvandlar ett oktalt tal till decimalt
OCT2HEX = OKT.TILL.HEX ## Omvandlar ett oktalt tal till hexadecimalt
##
## Financial functions Finansiella funktioner
##
ACCRINT = UPPLRÄNTA ## Returnerar den upplupna räntan för värdepapper med periodisk ränta
ACCRINTM = UPPLOBLRÄNTA ## Returnerar den upplupna räntan för ett värdepapper som ger avkastning på förfallodagen
AMORDEGRC = AMORDEGRC ## Returnerar avskrivningen för varje redovisningsperiod med hjälp av en avskrivningskoefficient
AMORLINC = AMORLINC ## Returnerar avskrivningen för varje redovisningsperiod
COUPDAYBS = KUPDAGBB ## Returnerar antal dagar från början av kupongperioden till likviddagen
COUPDAYS = KUPDAGARS ## Returnerar antalet dagar i kupongperioden som innehåller betalningsdatumet
COUPDAYSNC = KUPDAGNK ## Returnerar antalet dagar från betalningsdatumet till nästa kupongdatum
COUPNCD = KUPNKD ## Returnerar nästa kupongdatum efter likviddagen
COUPNUM = KUPANT ## Returnerar kuponger som förfaller till betalning mellan likviddagen och förfallodagen
COUPPCD = KUPFKD ## Returnerar föregående kupongdatum före likviddagen
CUMIPMT = KUMRÄNTA ## Returnerar den ackumulerade räntan som betalats mellan två perioder
CUMPRINC = KUMPRIS ## Returnerar det ackumulerade kapitalbeloppet som betalats på ett lån mellan två perioder
DB = DB ## Returnerar avskrivningen för en tillgång under en angiven tid enligt metoden för fast degressiv avskrivning
DDB = DEGAVSKR ## Returnerar en tillgångs värdeminskning under en viss period med hjälp av dubbel degressiv avskrivning eller någon annan metod som du anger
DISC = DISK ## Returnerar diskonteringsräntan för ett värdepapper
DOLLARDE = DECTAL ## Omvandlar ett pris uttryckt som ett bråk till ett decimaltal
DOLLARFR = BRÅK ## Omvandlar ett pris i kronor uttryckt som ett decimaltal till ett bråk
DURATION = LÖPTID ## Returnerar den årliga löptiden för en säkerhet med periodiska räntebetalningar
EFFECT = EFFRÄNTA ## Returnerar den årliga effektiva räntesatsen
FV = SLUTVÄRDE ## Returnerar det framtida värdet på en investering
FVSCHEDULE = FÖRRÄNTNING ## Returnerar det framtida värdet av ett begynnelsekapital beräknat på olika räntenivåer
INTRATE = ÅRSRÄNTA ## Returnerar räntesatsen för ett betalt värdepapper
IPMT = RBETALNING ## Returnerar räntedelen av en betalning för en given period
IRR = IR ## Returnerar internräntan för en serie betalningar
ISPMT = RALÅN ## Beräknar räntan som har betalats under en specifik betalningsperiod
MDURATION = MLÖPTID ## Returnerar den modifierade Macauley-löptiden för ett värdepapper med det antagna nominella värdet 100 kr
MIRR = MODIR ## Returnerar internräntan där positiva och negativa betalningar finansieras med olika räntor
NOMINAL = NOMRÄNTA ## Returnerar den årliga nominella räntesatsen
NPER = PERIODER ## Returnerar antalet perioder för en investering
NPV = NETNUVÄRDE ## Returnerar nuvärdet av en serie periodiska betalningar vid en given diskonteringsränta
ODDFPRICE = UDDAFPRIS ## Returnerar priset per 100 kr nominellt värde för ett värdepapper med en udda första period
ODDFYIELD = UDDAFAVKASTNING ## Returnerar avkastningen för en säkerhet med en udda första period
ODDLPRICE = UDDASPRIS ## Returnerar priset per 100 kr nominellt värde för ett värdepapper med en udda sista period
ODDLYIELD = UDDASAVKASTNING ## Returnerar avkastningen för en säkerhet med en udda sista period
PMT = BETALNING ## Returnerar den periodiska betalningen för en annuitet
PPMT = AMORT ## Returnerar amorteringsdelen av en annuitetsbetalning för en given period
PRICE = PRIS ## Returnerar priset per 100 kr nominellt värde för ett värdepapper som ger periodisk ränta
PRICEDISC = PRISDISK ## Returnerar priset per 100 kr nominellt värde för ett diskonterat värdepapper
PRICEMAT = PRISFÖRF ## Returnerar priset per 100 kr nominellt värde för ett värdepapper som ger ränta på förfallodagen
PV = PV ## Returnerar nuvärdet av en serie lika stora periodiska betalningar
RATE = RÄNTA ## Returnerar räntesatsen per period i en annuitet
RECEIVED = BELOPP ## Returnerar beloppet som utdelas på förfallodagen för ett betalat värdepapper
SLN = LINAVSKR ## Returnerar den linjära avskrivningen för en tillgång under en period
SYD = ÅRSAVSKR ## Returnerar den årliga avskrivningssumman för en tillgång under en angiven period
TBILLEQ = SSVXEKV ## Returnerar avkastningen motsvarande en obligation för en statsskuldväxel
TBILLPRICE = SSVXPRIS ## Returnerar priset per 100 kr nominellt värde för en statsskuldväxel
TBILLYIELD = SSVXRÄNTA ## Returnerar avkastningen för en statsskuldväxel
VDB = VDEGRAVSKR ## Returnerar avskrivningen för en tillgång under en angiven period (med degressiv avskrivning)
XIRR = XIRR ## Returnerar internräntan för en serie betalningar som inte nödvändigtvis är periodiska
XNPV = XNUVÄRDE ## Returnerar det nuvarande nettovärdet för en serie betalningar som inte nödvändigtvis är periodiska
YIELD = NOMAVK ## Returnerar avkastningen för ett värdepapper som ger periodisk ränta
YIELDDISC = NOMAVKDISK ## Returnerar den årliga avkastningen för diskonterade värdepapper, exempelvis en statsskuldväxel
YIELDMAT = NOMAVKFÖRF ## Returnerar den årliga avkastningen för ett värdepapper som ger ränta på förfallodagen
##
## Information functions Informationsfunktioner
##
CELL = CELL ## Returnerar information om formatering, plats och innehåll i en cell
ERROR.TYPE = FEL.TYP ## Returnerar ett tal som motsvarar ett felvärde
INFO = INFO ## Returnerar information om operativsystemet
ISBLANK = ÄRREF ## Returnerar SANT om värdet är tomt
ISERR = Ä ## Returnerar SANT om värdet är ett felvärde annat än #SAKNAS!
ISERROR = ÄRFEL ## Returnerar SANT om värdet är ett felvärde
ISEVEN = ÄRJÄMN ## Returnerar SANT om talet är jämnt
ISLOGICAL = ÄREJTEXT ## Returnerar SANT om värdet är ett logiskt värde
ISNA = ÄRLOGISK ## Returnerar SANT om värdet är felvärdet #SAKNAS!
ISNONTEXT = ÄRSAKNAD ## Returnerar SANT om värdet inte är text
ISNUMBER = ÄRTAL ## Returnerar SANT om värdet är ett tal
ISODD = ÄRUDDA ## Returnerar SANT om talet är udda
ISREF = ÄRTOM ## Returnerar SANT om värdet är en referens
ISTEXT = ÄRTEXT ## Returnerar SANT om värdet är text
N = N ## Returnerar ett värde omvandlat till ett tal
NA = SAKNAS ## Returnerar felvärdet #SAKNAS!
TYPE = VÄRDETYP ## Returnerar ett tal som anger värdets datatyp
##
## Logical functions Logiska funktioner
##
AND = OCH ## Returnerar SANT om alla argument är sanna
FALSE = FALSKT ## Returnerar det logiska värdet FALSKT
IF = OM ## Anger vilket logiskt test som ska utföras
IFERROR = OMFEL ## Returnerar ett värde som du anger om en formel utvärderar till ett fel; annars returneras resultatet av formeln
NOT = ICKE ## Inverterar logiken för argumenten
OR = ELLER ## Returnerar SANT om något argument är SANT
TRUE = SANT ## Returnerar det logiska värdet SANT
##
## Lookup and reference functions Sök- och referensfunktioner
##
ADDRESS = ADRESS ## Returnerar en referens som text till en enstaka cell i ett kalkylblad
AREAS = OMRÅDEN ## Returnerar antalet områden i en referens
CHOOSE = VÄLJ ## Väljer ett värde i en lista över värden
COLUMN = KOLUMN ## Returnerar kolumnnumret för en referens
COLUMNS = KOLUMNER ## Returnerar antalet kolumner i en referens
HLOOKUP = LETAKOLUMN ## Söker i den översta raden i en matris och returnerar värdet för angiven cell
HYPERLINK = HYPERLÄNK ## Skapar en genväg eller ett hopp till ett dokument i nätverket, i ett intranät eller på Internet
INDEX = INDEX ## Använder ett index för ett välja ett värde i en referens eller matris
INDIRECT = INDIREKT ## Returnerar en referens som anges av ett textvärde
LOOKUP = LETAUPP ## Letar upp värden i en vektor eller matris
MATCH = PASSA ## Letar upp värden i en referens eller matris
OFFSET = FÖRSKJUTNING ## Returnerar en referens förskjuten i förhållande till en given referens
ROW = RAD ## Returnerar radnumret för en referens
ROWS = RADER ## Returnerar antalet rader i en referens
RTD = RTD ## Hämtar realtidsdata från ett program som stöder COM-automation (Automation: Ett sätt att arbeta med ett programs objekt från ett annat program eller utvecklingsverktyg. Detta kallades tidigare för OLE Automation, och är en branschstandard och ingår i Component Object Model (COM).)
TRANSPOSE = TRANSPONERA ## Transponerar en matris
VLOOKUP = LETARAD ## Letar i den första kolumnen i en matris och flyttar över raden för att returnera värdet för en cell
##
## Math and trigonometry functions Matematiska och trigonometriska funktioner
##
ABS = ABS ## Returnerar absolutvärdet av ett tal
ACOS = ARCCOS ## Returnerar arcus cosinus för ett tal
ACOSH = ARCCOSH ## Returnerar inverterad hyperbolisk cosinus för ett tal
ASIN = ARCSIN ## Returnerar arcus cosinus för ett tal
ASINH = ARCSINH ## Returnerar hyperbolisk arcus sinus för ett tal
ATAN = ARCTAN ## Returnerar arcus tangens för ett tal
ATAN2 = ARCTAN2 ## Returnerar arcus tangens för en x- och en y- koordinat
ATANH = ARCTANH ## Returnerar hyperbolisk arcus tangens för ett tal
CEILING = RUNDA.UPP ## Avrundar ett tal till närmaste heltal eller närmaste signifikanta multipel
COMBIN = KOMBIN ## Returnerar antalet kombinationer för ett givet antal objekt
COS = COS ## Returnerar cosinus för ett tal
COSH = COSH ## Returnerar hyperboliskt cosinus för ett tal
DEGREES = GRADER ## Omvandlar radianer till grader
EVEN = JÄMN ## Avrundar ett tal uppåt till närmaste heltal
EXP = EXP ## Returnerar e upphöjt till ett givet tal
FACT = FAKULTET ## Returnerar fakulteten för ett tal
FACTDOUBLE = DUBBELFAKULTET ## Returnerar dubbelfakulteten för ett tal
FLOOR = RUNDA.NED ## Avrundar ett tal nedåt mot noll
GCD = SGD ## Returnerar den största gemensamma nämnaren
INT = HELTAL ## Avrundar ett tal nedåt till närmaste heltal
LCM = MGM ## Returnerar den minsta gemensamma multipeln
LN = LN ## Returnerar den naturliga logaritmen för ett tal
LOG = LOG ## Returnerar logaritmen för ett tal för en given bas
LOG10 = LOG10 ## Returnerar 10-logaritmen för ett tal
MDETERM = MDETERM ## Returnerar matrisen som är avgörandet av en matris
MINVERSE = MINVERT ## Returnerar matrisinversen av en matris
MMULT = MMULT ## Returnerar matrisprodukten av två matriser
MOD = REST ## Returnerar resten vid en division
MROUND = MAVRUNDA ## Returnerar ett tal avrundat till en given multipel
MULTINOMIAL = MULTINOMIAL ## Returnerar multinomialen för en uppsättning tal
ODD = UDDA ## Avrundar ett tal uppåt till närmaste udda heltal
PI = PI ## Returnerar värdet pi
POWER = UPPHÖJT.TILL ## Returnerar resultatet av ett tal upphöjt till en exponent
PRODUCT = PRODUKT ## Multiplicerar argumenten
QUOTIENT = KVOT ## Returnerar heltalsdelen av en division
RADIANS = RADIANER ## Omvandlar grader till radianer
RAND = SLUMP ## Returnerar ett slumptal mellan 0 och 1
RANDBETWEEN = SLUMP.MELLAN ## Returnerar ett slumptal mellan de tal som du anger
ROMAN = ROMERSK ## Omvandlar vanliga (arabiska) siffror till romerska som text
ROUND = AVRUNDA ## Avrundar ett tal till ett angivet antal siffror
ROUNDDOWN = AVRUNDA.NEDÅT ## Avrundar ett tal nedåt mot noll
ROUNDUP = AVRUNDA.UPPÅT ## Avrundar ett tal uppåt, från noll
SERIESSUM = SERIESUMMA ## Returnerar summan av en potensserie baserat på formeln
SIGN = TECKEN ## Returnerar tecknet för ett tal
SIN = SIN ## Returnerar sinus för en given vinkel
SINH = SINH ## Returnerar hyperbolisk sinus för ett tal
SQRT = ROT ## Returnerar den positiva kvadratroten
SQRTPI = ROTPI ## Returnerar kvadratroten för (tal * pi)
SUBTOTAL = DELSUMMA ## Returnerar en delsumma i en lista eller databas
SUM = SUMMA ## Summerar argumenten
SUMIF = SUMMA.OM ## Summerar celler enligt ett angivet villkor
SUMIFS = SUMMA.OMF ## Lägger till cellerna i ett område som uppfyller flera kriterier
SUMPRODUCT = PRODUKTSUMMA ## Returnerar summan av produkterna i motsvarande matriskomponenter
SUMSQ = KVADRATSUMMA ## Returnerar summan av argumentens kvadrater
SUMX2MY2 = SUMMAX2MY2 ## Returnerar summan av differensen mellan kvadraterna för motsvarande värden i två matriser
SUMX2PY2 = SUMMAX2PY2 ## Returnerar summan av summan av kvadraterna av motsvarande värden i två matriser
SUMXMY2 = SUMMAXMY2 ## Returnerar summan av kvadraten av skillnaden mellan motsvarande värden i två matriser
TAN = TAN ## Returnerar tangens för ett tal
TANH = TANH ## Returnerar hyperbolisk tangens för ett tal
TRUNC = AVKORTA ## Avkortar ett tal till ett heltal
##
## Statistical functions Statistiska funktioner
##
AVEDEV = MEDELAVV ## Returnerar medelvärdet för datapunkters absoluta avvikelse från deras medelvärde
AVERAGE = MEDEL ## Returnerar medelvärdet av argumenten
AVERAGEA = AVERAGEA ## Returnerar medelvärdet av argumenten, inklusive tal, text och logiska värden
AVERAGEIF = MEDELOM ## Returnerar medelvärdet (aritmetiskt medelvärde) för alla celler i ett område som uppfyller ett givet kriterium
AVERAGEIFS = MEDELOMF ## Returnerar medelvärdet (det aritmetiska medelvärdet) för alla celler som uppfyller flera villkor.
BETADIST = BETAFÖRD ## Returnerar den kumulativa betafördelningsfunktionen
BETAINV = BETAINV ## Returnerar inversen till den kumulativa fördelningsfunktionen för en viss betafördelning
BINOMDIST = BINOMFÖRD ## Returnerar den individuella binomialfördelningen
CHIDIST = CHI2FÖRD ## Returnerar den ensidiga sannolikheten av c2-fördelningen
CHIINV = CHI2INV ## Returnerar inversen av chi2-fördelningen
CHITEST = CHI2TEST ## Returnerar oberoendetesten
CONFIDENCE = KONFIDENS ## Returnerar konfidensintervallet för en populations medelvärde
CORREL = KORREL ## Returnerar korrelationskoefficienten mellan två datamängder
COUNT = ANTAL ## Räknar hur många tal som finns bland argumenten
COUNTA = ANTALV ## Räknar hur många värden som finns bland argumenten
COUNTBLANK = ANTAL.TOMMA ## Räknar antalet tomma celler i ett område
COUNTIF = ANTAL.OM ## Räknar antalet celler i ett område som uppfyller angivna villkor.
COUNTIFS = ANTAL.OMF ## Räknar antalet celler i ett område som uppfyller flera villkor.
COVAR = KOVAR ## Returnerar kovariansen, d.v.s. medelvärdet av produkterna för parade avvikelser
CRITBINOM = KRITBINOM ## Returnerar det minsta värdet för vilket den kumulativa binomialfördelningen är mindre än eller lika med ett villkorsvärde
DEVSQ = KVADAVV ## Returnerar summan av kvadrater på avvikelser
EXPONDIST = EXPONFÖRD ## Returnerar exponentialfördelningen
FDIST = FFÖRD ## Returnerar F-sannolikhetsfördelningen
FINV = FINV ## Returnerar inversen till F-sannolikhetsfördelningen
FISHER = FISHER ## Returnerar Fisher-transformationen
FISHERINV = FISHERINV ## Returnerar inversen till Fisher-transformationen
FORECAST = PREDIKTION ## Returnerar ett värde längs en linjär trendlinje
FREQUENCY = FREKVENS ## Returnerar en frekvensfördelning som en lodrät matris
FTEST = FTEST ## Returnerar resultatet av en F-test
GAMMADIST = GAMMAFÖRD ## Returnerar gammafördelningen
GAMMAINV = GAMMAINV ## Returnerar inversen till den kumulativa gammafördelningen
GAMMALN = GAMMALN ## Returnerar den naturliga logaritmen för gammafunktionen, G(x)
GEOMEAN = GEOMEDEL ## Returnerar det geometriska medelvärdet
GROWTH = EXPTREND ## Returnerar värden längs en exponentiell trend
HARMEAN = HARMMEDEL ## Returnerar det harmoniska medelvärdet
HYPGEOMDIST = HYPGEOMFÖRD ## Returnerar den hypergeometriska fördelningen
INTERCEPT = SKÄRNINGSPUNKT ## Returnerar skärningspunkten för en linjär regressionslinje
KURT = TOPPIGHET ## Returnerar toppigheten av en mängd data
LARGE = STÖRSTA ## Returnerar det n:te största värdet i en mängd data
LINEST = REGR ## Returnerar parametrar till en linjär trendlinje
LOGEST = EXPREGR ## Returnerar parametrarna i en exponentiell trend
LOGINV = LOGINV ## Returnerar inversen till den lognormala fördelningen
LOGNORMDIST = LOGNORMFÖRD ## Returnerar den kumulativa lognormala fördelningen
MAX = MAX ## Returnerar det största värdet i en lista av argument
MAXA = MAXA ## Returnerar det största värdet i en lista av argument, inklusive tal, text och logiska värden
MEDIAN = MEDIAN ## Returnerar medianen för angivna tal
MIN = MIN ## Returnerar det minsta värdet i en lista med argument
MINA = MINA ## Returnerar det minsta värdet i en lista över argument, inklusive tal, text och logiska värden
MODE = TYPVÄRDE ## Returnerar det vanligaste värdet i en datamängd
NEGBINOMDIST = NEGBINOMFÖRD ## Returnerar den negativa binomialfördelningen
NORMDIST = NORMFÖRD ## Returnerar den kumulativa normalfördelningen
NORMINV = NORMINV ## Returnerar inversen till den kumulativa normalfördelningen
NORMSDIST = NORMSFÖRD ## Returnerar den kumulativa standardnormalfördelningen
NORMSINV = NORMSINV ## Returnerar inversen till den kumulativa standardnormalfördelningen
PEARSON = PEARSON ## Returnerar korrelationskoefficienten till Pearsons momentprodukt
PERCENTILE = PERCENTIL ## Returnerar den n:te percentilen av värden i ett område
PERCENTRANK = PROCENTRANG ## Returnerar procentrangen för ett värde i en datamängd
PERMUT = PERMUT ## Returnerar antal permutationer för ett givet antal objekt
POISSON = POISSON ## Returnerar Poisson-fördelningen
PROB = SANNOLIKHET ## Returnerar sannolikheten att värden i ett område ligger mellan två gränser
QUARTILE = KVARTIL ## Returnerar kvartilen av en mängd data
RANK = RANG ## Returnerar rangordningen för ett tal i en lista med tal
RSQ = RKV ## Returnerar kvadraten av Pearsons produktmomentkorrelationskoefficient
SKEW = SNEDHET ## Returnerar snedheten för en fördelning
SLOPE = LUTNING ## Returnerar lutningen på en linjär regressionslinje
SMALL = MINSTA ## Returnerar det n:te minsta värdet i en mängd data
STANDARDIZE = STANDARDISERA ## Returnerar ett normaliserat värde
STDEV = STDAV ## Uppskattar standardavvikelsen baserat på ett urval
STDEVA = STDEVA ## Uppskattar standardavvikelsen baserat på ett urval, inklusive tal, text och logiska värden
STDEVP = STDAVP ## Beräknar standardavvikelsen baserat på hela populationen
STDEVPA = STDEVPA ## Beräknar standardavvikelsen baserat på hela populationen, inklusive tal, text och logiska värden
STEYX = STDFELYX ## Returnerar standardfelet för ett förutspått y-värde för varje x-värde i regressionen
TDIST = TFÖRD ## Returnerar Students t-fördelning
TINV = TINV ## Returnerar inversen till Students t-fördelning
TREND = TREND ## Returnerar värden längs en linjär trend
TRIMMEAN = TRIMMEDEL ## Returnerar medelvärdet av mittpunkterna i en datamängd
TTEST = TTEST ## Returnerar sannolikheten beräknad ur Students t-test
VAR = VARIANS ## Uppskattar variansen baserat på ett urval
VARA = VARA ## Uppskattar variansen baserat på ett urval, inklusive tal, text och logiska värden
VARP = VARIANSP ## Beräknar variansen baserat på hela populationen
VARPA = VARPA ## Beräknar variansen baserat på hela populationen, inklusive tal, text och logiska värden
WEIBULL = WEIBULL ## Returnerar Weibull-fördelningen
ZTEST = ZTEST ## Returnerar det ensidiga sannolikhetsvärdet av ett z-test
##
## Text functions Textfunktioner
##
ASC = ASC ## Ändrar helbredds (dubbel byte) engelska bokstäver eller katakana inom en teckensträng till tecken med halvt breddsteg (enkel byte)
BAHTTEXT = BAHTTEXT ## Omvandlar ett tal till text med valutaformatet ß (baht)
CHAR = TECKENKOD ## Returnerar tecknet som anges av kod
CLEAN = STÄDA ## Tar bort alla icke utskrivbara tecken i en text
CODE = KOD ## Returnerar en numerisk kod för det första tecknet i en textsträng
CONCATENATE = SAMMANFOGA ## Sammanfogar flera textdelar till en textsträng
DOLLAR = VALUTA ## Omvandlar ett tal till text med valutaformat
EXACT = EXAKT ## Kontrollerar om två textvärden är identiska
FIND = HITTA ## Hittar en text i en annan (skiljer på gemener och versaler)
FINDB = HITTAB ## Hittar en text i en annan (skiljer på gemener och versaler)
FIXED = FASTTAL ## Formaterar ett tal som text med ett fast antal decimaler
JIS = JIS ## Ändrar halvbredds (enkel byte) engelska bokstäver eller katakana inom en teckensträng till tecken med helt breddsteg (dubbel byte)
LEFT = VÄNSTER ## Returnerar tecken längst till vänster i en sträng
LEFTB = VÄNSTERB ## Returnerar tecken längst till vänster i en sträng
LEN = LÄNGD ## Returnerar antalet tecken i en textsträng
LENB = LÄNGDB ## Returnerar antalet tecken i en textsträng
LOWER = GEMENER ## Omvandlar text till gemener
MID = EXTEXT ## Returnerar angivet antal tecken från en text med början vid den position som du anger
MIDB = EXTEXTB ## Returnerar angivet antal tecken från en text med början vid den position som du anger
PHONETIC = PHONETIC ## Returnerar de fonetiska (furigana) tecknen i en textsträng
PROPER = INITIAL ## Ändrar första bokstaven i varje ord i ett textvärde till versal
REPLACE = ERSÄTT ## Ersätter tecken i text
REPLACEB = ERSÄTTB ## Ersätter tecken i text
REPT = REP ## Upprepar en text ett bestämt antal gånger
RIGHT = HÖGER ## Returnerar tecken längst till höger i en sträng
RIGHTB = HÖGERB ## Returnerar tecken längst till höger i en sträng
SEARCH = SÖK ## Hittar ett textvärde i ett annat (skiljer inte på gemener och versaler)
SEARCHB = SÖKB ## Hittar ett textvärde i ett annat (skiljer inte på gemener och versaler)
SUBSTITUTE = BYT.UT ## Ersätter gammal text med ny text i en textsträng
T = T ## Omvandlar argumenten till text
TEXT = TEXT ## Formaterar ett tal och omvandlar det till text
TRIM = RENSA ## Tar bort blanksteg från text
UPPER = VERSALER ## Omvandlar text till versaler
VALUE = TEXTNUM ## Omvandlar ett textargument till ett tal
PK ! U=B B PHPExcel/locale/sv/confignu [ ##
## PHPExcel
##
## Copyright (c) 2006 - 2013 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
##
## @category PHPExcel
## @package PHPExcel_Settings
## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
## @version 1.8.0, 2014-03-02
##
##
ArgumentSeparator = ;
##
## (For future use)
##
currencySymbol = kr
##
## Excel Error Codes (For future use)
##
NULL = #Skärning!
DIV0 = #Division/0!
VALUE = #Värdefel!
REF = #Referens!
NAME = #Namn?
NUM = #Ogiltigt!
NA = #Saknas!
PK ! ZO( PHPExcel/locale/fi/functionsnu [ ##
## PHPExcel
##
## Copyright (c) 2006 - 2013 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
##
## @category PHPExcel
## @package PHPExcel_Calculation
## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
## @version 1.8.0, 2014-03-02
##
## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/
##
##
##
## Add-in and Automation functions Apuohjelma- ja automaatiofunktiot
##
GETPIVOTDATA = NOUDA.PIVOT.TIEDOT ## Palauttaa pivot-taulukkoraporttiin tallennettuja tietoja.
##
## Cube functions Kuutiofunktiot
##
CUBEKPIMEMBER = KUUTIOKPIJÄSEN ## Palauttaa suorituskykyilmaisimen (KPI) nimen, ominaisuuden sekä mitan ja näyttää nimen sekä ominaisuuden solussa. KPI on mitattavissa oleva suure, kuten kuukauden bruttotuotto tai vuosineljänneksen työntekijäkohtainen liikevaihto, joiden avulla tarkkaillaan organisaation suorituskykyä.
CUBEMEMBER = KUUTIONJÄSEN ## Palauttaa kuutiohierarkian jäsenen tai monikon. Tällä funktiolla voit tarkistaa, että jäsen tai monikko on olemassa kuutiossa.
CUBEMEMBERPROPERTY = KUUTIONJÄSENENOMINAISUUS ## Palauttaa kuution jäsenominaisuuden arvon. Tällä funktiolla voit tarkistaa, että nimi on olemassa kuutiossa, ja palauttaa tämän jäsenen määritetyn ominaisuuden.
CUBERANKEDMEMBER = KUUTIONLUOKITELTUJÄSEN ## Palauttaa joukon n:nnen jäsenen. Tällä funktiolla voit palauttaa joukosta elementtejä, kuten parhaan myyjän tai 10 parasta opiskelijaa.
CUBESET = KUUTIOJOUKKO ## Määrittää lasketun jäsen- tai monikkojoukon lähettämällä joukon lausekkeita palvelimessa olevalle kuutiolle. Palvelin luo joukon ja palauttaa sen Microsoft Office Excelille.
CUBESETCOUNT = KUUTIOJOUKKOJENMÄÄRÄ ## Palauttaa joukon kohteiden määrän.
CUBEVALUE = KUUTIONARVO ## Palauttaa koostetun arvon kuutiosta.
##
## Database functions Tietokantafunktiot
##
DAVERAGE = TKESKIARVO ## Palauttaa valittujen tietokantamerkintöjen keskiarvon.
DCOUNT = TLASKE ## Laskee tietokannan lukuja sisältävien solujen määrän.
DCOUNTA = TLASKEA ## Laskee tietokannan tietoja sisältävien solujen määrän.
DGET = TNOUDA ## Hakee määritettyjä ehtoja vastaavan tietueen tietokannasta.
DMAX = TMAKS ## Palauttaa suurimman arvon tietokannasta valittujen arvojen joukosta.
DMIN = TMIN ## Palauttaa pienimmän arvon tietokannasta valittujen arvojen joukosta.
DPRODUCT = TTULO ## Kertoo määritetyn ehdon täyttävien tietokannan tietueiden tietyssä kentässä olevat arvot.
DSTDEV = TKESKIHAJONTA ## Laskee keskihajonnan tietokannasta valituista arvoista muodostuvan otoksen perusteella.
DSTDEVP = TKESKIHAJONTAP ## Laskee keskihajonnan tietokannasta valittujen arvojen koko populaation perusteella.
DSUM = TSUMMA ## Lisää luvut määritetyn ehdon täyttävien tietokannan tietueiden kenttäsarakkeeseen.
DVAR = TVARIANSSI ## Laskee varianssin tietokannasta valittujen arvojen otoksen perusteella.
DVARP = TVARIANSSIP ## Laskee varianssin tietokannasta valittujen arvojen koko populaation perusteella.
##
## Date and time functions Päivämäärä- ja aikafunktiot
##
DATE = PÄIVÄYS ## Palauttaa annetun päivämäärän järjestysluvun.
DATEVALUE = PÄIVÄYSARVO ## Muuntaa tekstimuodossa olevan päivämäärän järjestysluvuksi.
DAY = PÄIVÄ ## Muuntaa järjestysluvun kuukauden päiväksi.
DAYS360 = PÄIVÄT360 ## Laskee kahden päivämäärän välisten päivien määrän käyttäen perustana 360-päiväistä vuotta.
EDATE = PÄIVÄ.KUUKAUSI ## Palauttaa järjestyslukuna päivämäärän, joka poikkeaa aloituspäivän päivämäärästä annetun kuukausimäärän verran joko eteen- tai taaksepäin.
EOMONTH = KUUKAUSI.LOPPU ## Palauttaa järjestyslukuna sen kuukauden viimeisen päivämäärän, joka poikkeaa annetun kuukausimäärän verran eteen- tai taaksepäin.
HOUR = TUNNIT ## Muuntaa järjestysluvun tunneiksi.
MINUTE = MINUUTIT ## Muuntaa järjestysluvun minuuteiksi.
MONTH = KUUKAUSI ## Muuntaa järjestysluvun kuukausiksi.
NETWORKDAYS = TYÖPÄIVÄT ## Palauttaa kahden päivämäärän välissä olevien täysien työpäivien määrän.
NOW = NYT ## Palauttaa kuluvan päivämäärän ja ajan järjestysnumeron.
SECOND = SEKUNNIT ## Muuntaa järjestysluvun sekunneiksi.
TIME = AIKA ## Palauttaa annetun kellonajan järjestysluvun.
TIMEVALUE = AIKA_ARVO ## Muuntaa tekstimuodossa olevan kellonajan järjestysluvuksi.
TODAY = TÄMÄ.PÄIVÄ ## Palauttaa kuluvan päivän päivämäärän järjestysluvun.
WEEKDAY = VIIKONPÄIVÄ ## Muuntaa järjestysluvun viikonpäiväksi.
WEEKNUM = VIIKKO.NRO ## Muuntaa järjestysluvun luvuksi, joka ilmaisee viikon järjestysluvun vuoden alusta laskettuna.
WORKDAY = TYÖPÄIVÄ ## Palauttaa järjestysluvun päivämäärälle, joka sijaitsee annettujen työpäivien verran eteen tai taaksepäin.
YEAR = VUOSI ## Muuntaa järjestysluvun vuosiksi.
YEARFRAC = VUOSI.OSA ## Palauttaa määritettyjen päivämäärien (aloituspäivä ja lopetuspäivä) välisen osan vuodesta.
##
## Engineering functions Tekniset funktiot
##
BESSELI = BESSELI ## Palauttaa muunnetun Bessel-funktion In(x).
BESSELJ = BESSELJ ## Palauttaa Bessel-funktion Jn(x).
BESSELK = BESSELK ## Palauttaa muunnetun Bessel-funktion Kn(x).
BESSELY = BESSELY ## Palauttaa Bessel-funktion Yn(x).
BIN2DEC = BINDES ## Muuntaa binaariluvun desimaaliluvuksi.
BIN2HEX = BINHEKSA ## Muuntaa binaariluvun heksadesimaaliluvuksi.
BIN2OCT = BINOKT ## Muuntaa binaariluvun oktaaliluvuksi.
COMPLEX = KOMPLEKSI ## Muuntaa reaali- ja imaginaariosien kertoimet kompleksiluvuksi.
CONVERT = MUUNNA ## Muuntaa luvun toisen mittajärjestelmän mukaiseksi.
DEC2BIN = DESBIN ## Muuntaa desimaaliluvun binaariluvuksi.
DEC2HEX = DESHEKSA ## Muuntaa kymmenjärjestelmän luvun heksadesimaaliluvuksi.
DEC2OCT = DESOKT ## Muuntaa kymmenjärjestelmän luvun oktaaliluvuksi.
DELTA = SAMA.ARVO ## Tarkistaa, ovatko kaksi arvoa yhtä suuria.
ERF = VIRHEFUNKTIO ## Palauttaa virhefunktion.
ERFC = VIRHEFUNKTIO.KOMPLEMENTTI ## Palauttaa komplementtivirhefunktion.
GESTEP = RAJA ## Testaa, onko luku suurempi kuin kynnysarvo.
HEX2BIN = HEKSABIN ## Muuntaa heksadesimaaliluvun binaariluvuksi.
HEX2DEC = HEKSADES ## Muuntaa heksadesimaaliluvun desimaaliluvuksi.
HEX2OCT = HEKSAOKT ## Muuntaa heksadesimaaliluvun oktaaliluvuksi.
IMABS = KOMPLEKSI.ITSEISARVO ## Palauttaa kompleksiluvun itseisarvon (moduluksen).
IMAGINARY = KOMPLEKSI.IMAG ## Palauttaa kompleksiluvun imaginaariosan kertoimen.
IMARGUMENT = KOMPLEKSI.ARG ## Palauttaa theeta-argumentin, joka on radiaaneina annettu kulma.
IMCONJUGATE = KOMPLEKSI.KONJ ## Palauttaa kompleksiluvun konjugaattiluvun.
IMCOS = KOMPLEKSI.COS ## Palauttaa kompleksiluvun kosinin.
IMDIV = KOMPLEKSI.OSAM ## Palauttaa kahden kompleksiluvun osamäärän.
IMEXP = KOMPLEKSI.EKSP ## Palauttaa kompleksiluvun eksponentin.
IMLN = KOMPLEKSI.LN ## Palauttaa kompleksiluvun luonnollisen logaritmin.
IMLOG10 = KOMPLEKSI.LOG10 ## Palauttaa kompleksiluvun kymmenkantaisen logaritmin.
IMLOG2 = KOMPLEKSI.LOG2 ## Palauttaa kompleksiluvun kaksikantaisen logaritmin.
IMPOWER = KOMPLEKSI.POT ## Palauttaa kokonaislukupotenssiin korotetun kompleksiluvun.
IMPRODUCT = KOMPLEKSI.TULO ## Palauttaa kompleksilukujen tulon.
IMREAL = KOMPLEKSI.REAALI ## Palauttaa kompleksiluvun reaaliosan kertoimen.
IMSIN = KOMPLEKSI.SIN ## Palauttaa kompleksiluvun sinin.
IMSQRT = KOMPLEKSI.NELIÖJ ## Palauttaa kompleksiluvun neliöjuuren.
IMSUB = KOMPLEKSI.EROTUS ## Palauttaa kahden kompleksiluvun erotuksen.
IMSUM = KOMPLEKSI.SUM ## Palauttaa kompleksilukujen summan.
OCT2BIN = OKTBIN ## Muuntaa oktaaliluvun binaariluvuksi.
OCT2DEC = OKTDES ## Muuntaa oktaaliluvun desimaaliluvuksi.
OCT2HEX = OKTHEKSA ## Muuntaa oktaaliluvun heksadesimaaliluvuksi.
##
## Financial functions Rahoitusfunktiot
##
ACCRINT = KERTYNYT.KORKO ## Laskee arvopaperille kertyneen koron, kun korko kertyy säännöllisin väliajoin.
ACCRINTM = KERTYNYT.KORKO.LOPUSSA ## Laskee arvopaperille kertyneen koron, kun korko maksetaan eräpäivänä.
AMORDEGRC = AMORDEGRC ## Laskee kunkin laskentakauden poiston poistokerrointa käyttämällä.
AMORLINC = AMORLINC ## Palauttaa kunkin laskentakauden poiston.
COUPDAYBS = KORKOPÄIVÄT.ALUSTA ## Palauttaa koronmaksukauden aloituspäivän ja tilityspäivän välisen ajanjakson päivien määrän.
COUPDAYS = KORKOPÄIVÄT ## Palauttaa päivien määrän koronmaksukaudelta, johon tilityspäivä kuuluu.
COUPDAYSNC = KORKOPÄIVÄT.SEURAAVA ## Palauttaa tilityspäivän ja seuraavan koronmaksupäivän välisen ajanjakson päivien määrän.
COUPNCD = KORKOMAKSU.SEURAAVA ## Palauttaa tilityspäivän jälkeisen seuraavan koronmaksupäivän.
COUPNUM = KORKOPÄIVÄJAKSOT ## Palauttaa arvopaperin ostopäivän ja erääntymispäivän välisten koronmaksupäivien määrän.
COUPPCD = KORKOPÄIVÄ.EDELLINEN ## Palauttaa tilityspäivää edeltävän koronmaksupäivän.
CUMIPMT = MAKSETTU.KORKO ## Palauttaa kahden jakson välisenä aikana kertyneen koron.
CUMPRINC = MAKSETTU.LYHENNYS ## Palauttaa lainalle kahden jakson välisenä aikana kertyneen lyhennyksen.
DB = DB ## Palauttaa kauden kirjanpidollisen poiston amerikkalaisen DB-menetelmän (Fixed-declining balance) mukaan.
DDB = DDB ## Palauttaa kauden kirjanpidollisen poiston amerikkalaisen DDB-menetelmän (Double-Declining Balance) tai jonkin muun määrittämäsi menetelmän mukaan.
DISC = DISKONTTOKORKO ## Palauttaa arvopaperin diskonttokoron.
DOLLARDE = VALUUTTA.DES ## Muuntaa murtolukuna ilmoitetun valuuttamäärän desimaaliluvuksi.
DOLLARFR = VALUUTTA.MURTO ## Muuntaa desimaalilukuna ilmaistun valuuttamäärän murtoluvuksi.
DURATION = KESTO ## Palauttaa keston arvopaperille, jonka koronmaksu tapahtuu säännöllisesti.
EFFECT = KORKO.EFEKT ## Palauttaa todellisen vuosikoron.
FV = TULEVA.ARVO ## Palauttaa sijoituksen tulevan arvon.
FVSCHEDULE = TULEVA.ARVO.ERIKORKO ## Palauttaa pääoman tulevan arvon, kun pääomalle on kertynyt korkoa vaihtelevasti.
INTRATE = KORKO.ARVOPAPERI ## Palauttaa arvopaperin korkokannan täysin sijoitetulle arvopaperille.
IPMT = IPMT ## Laskee sijoitukselle tai lainalle tiettynä ajanjaksona kertyvän koron.
IRR = SISÄINEN.KORKO ## Laskee sisäisen korkokannan kassavirrasta muodostuvalle sarjalle.
ISPMT = ONMAKSU ## Laskee sijoituksen maksetun koron tietyllä jaksolla.
MDURATION = KESTO.MUUNN ## Palauttaa muunnetun Macauley-keston arvopaperille, jonka oletettu nimellisarvo on 100 euroa.
MIRR = MSISÄINEN ## Palauttaa sisäisen korkokannan, kun positiivisten ja negatiivisten kassavirtojen rahoituskorko on erilainen.
NOMINAL = KORKO.VUOSI ## Palauttaa vuosittaisen nimelliskoron.
NPER = NJAKSO ## Palauttaa sijoituksen jaksojen määrän.
NPV = NNA ## Palauttaa sijoituksen nykyarvon toistuvista kassavirroista muodostuvan sarjan ja diskonttokoron perusteella.
ODDFPRICE = PARITON.ENS.NIMELLISARVO ## Palauttaa arvopaperin hinnan tilanteessa, jossa ensimmäinen jakso on pariton.
ODDFYIELD = PARITON.ENS.TUOTTO ## Palauttaa arvopaperin tuoton tilanteessa, jossa ensimmäinen jakso on pariton.
ODDLPRICE = PARITON.VIIM.NIMELLISARVO ## Palauttaa arvopaperin hinnan tilanteessa, jossa viimeinen jakso on pariton.
ODDLYIELD = PARITON.VIIM.TUOTTO ## Palauttaa arvopaperin tuoton tilanteessa, jossa viimeinen jakso on pariton.
PMT = MAKSU ## Palauttaa annuiteetin kausittaisen maksuerän.
PPMT = PPMT ## Laskee sijoitukselle tai lainalle tiettynä ajanjaksona maksettavan lyhennyksen.
PRICE = HINTA ## Palauttaa hinnan 100 euron nimellisarvoa kohden arvopaperille, jonka korko maksetaan säännöllisin väliajoin.
PRICEDISC = HINTA.DISK ## Palauttaa diskontatun arvopaperin hinnan 100 euron nimellisarvoa kohden.
PRICEMAT = HINTA.LUNASTUS ## Palauttaa hinnan 100 euron nimellisarvoa kohden arvopaperille, jonka korko maksetaan erääntymispäivänä.
PV = NA ## Palauttaa sijoituksen nykyarvon.
RATE = KORKO ## Palauttaa annuiteetin kausittaisen korkokannan.
RECEIVED = SAATU.HINTA ## Palauttaa arvopaperin tuoton erääntymispäivänä kokonaan maksetulle sijoitukselle.
SLN = STP ## Palauttaa sijoituksen tasapoiston yhdeltä jaksolta.
SYD = VUOSIPOISTO ## Palauttaa sijoituksen vuosipoiston annettuna kautena amerikkalaisen SYD-menetelmän (Sum-of-Year's Digits) avulla.
TBILLEQ = OBLIG.TUOTTOPROS ## Palauttaa valtion obligaation tuoton vastaavana joukkovelkakirjan tuottona.
TBILLPRICE = OBLIG.HINTA ## Palauttaa obligaation hinnan 100 euron nimellisarvoa kohden.
TBILLYIELD = OBLIG.TUOTTO ## Palauttaa obligaation tuoton.
VDB = VDB ## Palauttaa annetun kauden tai kauden osan kirjanpidollisen poiston amerikkalaisen DB-menetelmän (Fixed-declining balance) mukaan.
XIRR = SISÄINEN.KORKO.JAKSOTON ## Palauttaa sisäisen korkokannan kassavirtojen sarjoille, jotka eivät välttämättä ole säännöllisiä.
XNPV = NNA.JAKSOTON ## Palauttaa nettonykyarvon kassavirtasarjalle, joka ei välttämättä ole kausittainen.
YIELD = TUOTTO ## Palauttaa tuoton arvopaperille, jonka korko maksetaan säännöllisin väliajoin.
YIELDDISC = TUOTTO.DISK ## Palauttaa diskontatun arvopaperin, kuten obligaation, vuosittaisen tuoton.
YIELDMAT = TUOTTO.ERÄP ## Palauttaa erääntymispäivänään korkoa tuottavan arvopaperin vuosittaisen tuoton.
##
## Information functions Erikoisfunktiot
##
CELL = SOLU ## Palauttaa tietoja solun muotoilusta, sijainnista ja sisällöstä.
ERROR.TYPE = VIRHEEN.LAJI ## Palauttaa virhetyyppiä vastaavan luvun.
INFO = KUVAUS ## Palauttaa tietoja nykyisestä käyttöympäristöstä.
ISBLANK = ONTYHJÄ ## Palauttaa arvon TOSI, jos arvo on tyhjä.
ISERR = ONVIRH ## Palauttaa arvon TOSI, jos arvo on mikä tahansa virhearvo paitsi arvo #PUUTTUU!.
ISERROR = ONVIRHE ## Palauttaa arvon TOSI, jos arvo on mikä tahansa virhearvo.
ISEVEN = ONPARILLINEN ## Palauttaa arvon TOSI, jos arvo on parillinen.
ISLOGICAL = ONTOTUUS ## Palauttaa arvon TOSI, jos arvo on mikä tahansa looginen arvo.
ISNA = ONPUUTTUU ## Palauttaa arvon TOSI, jos virhearvo on #PUUTTUU!.
ISNONTEXT = ONEI_TEKSTI ## Palauttaa arvon TOSI, jos arvo ei ole teksti.
ISNUMBER = ONLUKU ## Palauttaa arvon TOSI, jos arvo on luku.
ISODD = ONPARITON ## Palauttaa arvon TOSI, jos arvo on pariton.
ISREF = ONVIITT ## Palauttaa arvon TOSI, jos arvo on viittaus.
ISTEXT = ONTEKSTI ## Palauttaa arvon TOSI, jos arvo on teksti.
N = N ## Palauttaa arvon luvuksi muunnettuna.
NA = PUUTTUU ## Palauttaa virhearvon #PUUTTUU!.
TYPE = TYYPPI ## Palauttaa luvun, joka ilmaisee arvon tietotyypin.
##
## Logical functions Loogiset funktiot
##
AND = JA ## Palauttaa arvon TOSI, jos kaikkien argumenttien arvo on TOSI.
FALSE = EPÄTOSI ## Palauttaa totuusarvon EPÄTOSI.
IF = JOS ## Määrittää suoritettavan loogisen testin.
IFERROR = JOSVIRHE ## Palauttaa määrittämäsi arvon, jos kaavan tulos on virhe; muussa tapauksessa palauttaa kaavan tuloksen.
NOT = EI ## Kääntää argumentin loogisen arvon.
OR = TAI ## Palauttaa arvon TOSI, jos minkä tahansa argumentin arvo on TOSI.
TRUE = TOSI ## Palauttaa totuusarvon TOSI.
##
## Lookup and reference functions Haku- ja viitefunktiot
##
ADDRESS = OSOITE ## Palauttaa laskentataulukon soluun osoittavan viittauksen tekstinä.
AREAS = ALUEET ## Palauttaa viittauksessa olevien alueiden määrän.
CHOOSE = VALITSE.INDEKSI ## Valitsee arvon arvoluettelosta.
COLUMN = SARAKE ## Palauttaa viittauksen sarakenumeron.
COLUMNS = SARAKKEET ## Palauttaa viittauksessa olevien sarakkeiden määrän.
HLOOKUP = VHAKU ## Suorittaa haun matriisin ylimmältä riviltä ja palauttaa määritetyn solun arvon.
HYPERLINK = HYPERLINKKI ## Luo pikakuvakkeen tai tekstin, joka avaa verkkopalvelimeen, intranetiin tai Internetiin tallennetun tiedoston.
INDEX = INDEKSI ## Valitsee arvon viittauksesta tai matriisista indeksin mukaan.
INDIRECT = EPÄSUORA ## Palauttaa tekstiarvona ilmaistun viittauksen.
LOOKUP = HAKU ## Etsii arvoja vektorista tai matriisista.
MATCH = VASTINE ## Etsii arvoja viittauksesta tai matriisista.
OFFSET = SIIRTYMÄ ## Palauttaa annetun viittauksen siirtymän.
ROW = RIVI ## Palauttaa viittauksen rivinumeron.
ROWS = RIVIT ## Palauttaa viittauksessa olevien rivien määrän.
RTD = RTD ## Noutaa COM-automaatiota (automaatio: Tapa käsitellä sovelluksen objekteja toisesta sovelluksesta tai kehitystyökalusta. Automaatio, jota aiemmin kutsuttiin OLE-automaatioksi, on teollisuusstandardi ja COM-mallin (Component Object Model) ominaisuus.) tukevasta ohjelmasta reaaliaikaisia tietoja.
TRANSPOSE = TRANSPONOI ## Palauttaa matriisin käänteismatriisin.
VLOOKUP = PHAKU ## Suorittaa haun matriisin ensimmäisestä sarakkeesta ja palauttaa rivillä olevan solun arvon.
##
## Math and trigonometry functions Matemaattiset ja trigonometriset funktiot
##
ABS = ITSEISARVO ## Palauttaa luvun itseisarvon.
ACOS = ACOS ## Palauttaa luvun arkuskosinin.
ACOSH = ACOSH ## Palauttaa luvun käänteisen hyperbolisen kosinin.
ASIN = ASIN ## Palauttaa luvun arkussinin.
ASINH = ASINH ## Palauttaa luvun käänteisen hyperbolisen sinin.
ATAN = ATAN ## Palauttaa luvun arkustangentin.
ATAN2 = ATAN2 ## Palauttaa arkustangentin x- ja y-koordinaatin perusteella.
ATANH = ATANH ## Palauttaa luvun käänteisen hyperbolisen tangentin.
CEILING = PYÖRISTÄ.KERR.YLÖS ## Pyöristää luvun lähimpään kokonaislukuun tai tarkkuusargumentin lähimpään kerrannaiseen.
COMBIN = KOMBINAATIO ## Palauttaa mahdollisten kombinaatioiden määrän annetulle objektien määrälle.
COS = COS ## Palauttaa luvun kosinin.
COSH = COSH ## Palauttaa luvun hyperbolisen kosinin.
DEGREES = ASTEET ## Muuntaa radiaanit asteiksi.
EVEN = PARILLINEN ## Pyöristää luvun ylöspäin lähimpään parilliseen kokonaislukuun.
EXP = EKSPONENTTI ## Palauttaa e:n korotettuna annetun luvun osoittamaan potenssiin.
FACT = KERTOMA ## Palauttaa luvun kertoman.
FACTDOUBLE = KERTOMA.OSA ## Palauttaa luvun osakertoman.
FLOOR = PYÖRISTÄ.KERR.ALAS ## Pyöristää luvun alaspäin (nollaa kohti).
GCD = SUURIN.YHT.TEKIJÄ ## Palauttaa suurimman yhteisen tekijän.
INT = KOKONAISLUKU ## Pyöristää luvun alaspäin lähimpään kokonaislukuun.
LCM = PIENIN.YHT.JAETTAVA ## Palauttaa pienimmän yhteisen tekijän.
LN = LUONNLOG ## Palauttaa luvun luonnollisen logaritmin.
LOG = LOG ## Laskee luvun logaritmin käyttämällä annettua kantalukua.
LOG10 = LOG10 ## Palauttaa luvun kymmenkantaisen logaritmin.
MDETERM = MDETERM ## Palauttaa matriisin matriisideterminantin.
MINVERSE = MKÄÄNTEINEN ## Palauttaa matriisin käänteismatriisin.
MMULT = MKERRO ## Palauttaa kahden matriisin tulon.
MOD = JAKOJ ## Palauttaa jakolaskun jäännöksen.
MROUND = PYÖRISTÄ.KERR ## Palauttaa luvun pyöristettynä annetun luvun kerrannaiseen.
MULTINOMIAL = MULTINOMI ## Palauttaa lukujoukon multinomin.
ODD = PARITON ## Pyöristää luvun ylöspäin lähimpään parittomaan kokonaislukuun.
PI = PII ## Palauttaa piin arvon.
POWER = POTENSSI ## Palauttaa luvun korotettuna haluttuun potenssiin.
PRODUCT = TULO ## Kertoo annetut argumentit.
QUOTIENT = OSAMÄÄRÄ ## Palauttaa osamäärän kokonaislukuosan.
RADIANS = RADIAANIT ## Muuntaa asteet radiaaneiksi.
RAND = SATUNNAISLUKU ## Palauttaa satunnaisluvun väliltä 0–1.
RANDBETWEEN = SATUNNAISLUKU.VÄLILTÄ ## Palauttaa satunnaisluvun määritettyjen lukujen väliltä.
ROMAN = ROMAN ## Muuntaa arabialaisen numeron tekstimuotoiseksi roomalaiseksi numeroksi.
ROUND = PYÖRISTÄ ## Pyöristää luvun annettuun määrään desimaaleja.
ROUNDDOWN = PYÖRISTÄ.DES.ALAS ## Pyöristää luvun alaspäin (nollaa kohti).
ROUNDUP = PYÖRISTÄ.DES.YLÖS ## Pyöristää luvun ylöspäin (poispäin nollasta).
SERIESSUM = SARJA.SUMMA ## Palauttaa kaavaan perustuvan potenssisarjan arvon.
SIGN = ETUMERKKI ## Palauttaa luvun etumerkin.
SIN = SIN ## Palauttaa annetun kulman sinin.
SINH = SINH ## Palauttaa luvun hyperbolisen sinin.
SQRT = NELIÖJUURI ## Palauttaa positiivisen neliöjuuren.
SQRTPI = NELIÖJUURI.PII ## Palauttaa tulon (luku * pii) neliöjuuren.
SUBTOTAL = VÄLISUMMA ## Palauttaa luettelon tai tietokannan välisumman.
SUM = SUMMA ## Laskee yhteen annetut argumentit.
SUMIF = SUMMA.JOS ## Laskee ehdot täyttävien solujen summan.
SUMIFS = SUMMA.JOS.JOUKKO ## Laskee yhteen solualueen useita ehtoja vastaavat solut.
SUMPRODUCT = TULOJEN.SUMMA ## Palauttaa matriisin toisiaan vastaavien osien tulojen summan.
SUMSQ = NELIÖSUMMA ## Palauttaa argumenttien neliöiden summan.
SUMX2MY2 = NELIÖSUMMIEN.EROTUS ## Palauttaa kahden matriisin toisiaan vastaavien arvojen laskettujen neliösummien erotuksen.
SUMX2PY2 = NELIÖSUMMIEN.SUMMA ## Palauttaa kahden matriisin toisiaan vastaavien arvojen neliösummien summan.
SUMXMY2 = EROTUSTEN.NELIÖSUMMA ## Palauttaa kahden matriisin toisiaan vastaavien arvojen erotusten neliösumman.
TAN = TAN ## Palauttaa luvun tangentin.
TANH = TANH ## Palauttaa luvun hyperbolisen tangentin.
TRUNC = KATKAISE ## Katkaisee luvun kokonaisluvuksi.
##
## Statistical functions Tilastolliset funktiot
##
AVEDEV = KESKIPOIKKEAMA ## Palauttaa hajontojen itseisarvojen keskiarvon.
AVERAGE = KESKIARVO ## Palauttaa argumenttien keskiarvon.
AVERAGEA = KESKIARVOA ## Palauttaa argumenttien, mukaan lukien lukujen, tekstin ja loogisten arvojen, keskiarvon.
AVERAGEIF = KESKIARVO.JOS ## Palauttaa alueen niiden solujen keskiarvon (aritmeettisen keskiarvon), jotka täyttävät annetut ehdot.
AVERAGEIFS = KESKIARVO.JOS.JOUKKO ## Palauttaa niiden solujen keskiarvon (aritmeettisen keskiarvon), jotka vastaavat useita ehtoja.
BETADIST = BEETAJAKAUMA ## Palauttaa kumulatiivisen beetajakaumafunktion arvon.
BETAINV = BEETAJAKAUMA.KÄÄNT ## Palauttaa määritetyn beetajakauman käänteisen kumulatiivisen jakaumafunktion arvon.
BINOMDIST = BINOMIJAKAUMA ## Palauttaa yksittäisen termin binomijakaumatodennäköisyyden.
CHIDIST = CHIJAKAUMA ## Palauttaa yksisuuntaisen chi-neliön jakauman todennäköisyyden.
CHIINV = CHIJAKAUMA.KÄÄNT ## Palauttaa yksisuuntaisen chi-neliön jakauman todennäköisyyden käänteisarvon.
CHITEST = CHITESTI ## Palauttaa riippumattomuustestin tuloksen.
CONFIDENCE = LUOTTAMUSVÄLI ## Palauttaa luottamusvälin populaation keskiarvolle.
CORREL = KORRELAATIO ## Palauttaa kahden arvojoukon korrelaatiokertoimen.
COUNT = LASKE ## Laskee argumenttiluettelossa olevien lukujen määrän.
COUNTA = LASKE.A ## Laskee argumenttiluettelossa olevien arvojen määrän.
COUNTBLANK = LASKE.TYHJÄT ## Laskee alueella olevien tyhjien solujen määrän.
COUNTIF = LASKE.JOS ## Laskee alueella olevien sellaisten solujen määrän, joiden sisältö vastaa annettuja ehtoja.
COUNTIFS = LASKE.JOS.JOUKKO ## Laskee alueella olevien sellaisten solujen määrän, joiden sisältö vastaa useita ehtoja.
COVAR = KOVARIANSSI ## Palauttaa kovarianssin, joka on keskiarvo havaintoaineiston kunkin pisteparin poikkeamien tuloista.
CRITBINOM = BINOMIJAKAUMA.KRIT ## Palauttaa pienimmän arvon, jossa binomijakauman kertymäfunktion arvo on pienempi tai yhtä suuri kuin vertailuarvo.
DEVSQ = OIKAISTU.NELIÖSUMMA ## Palauttaa keskipoikkeamien neliösumman.
EXPONDIST = EKSPONENTIAALIJAKAUMA ## Palauttaa eksponentiaalijakauman.
FDIST = FJAKAUMA ## Palauttaa F-todennäköisyysjakauman.
FINV = FJAKAUMA.KÄÄNT ## Palauttaa F-todennäköisyysjakauman käänteisfunktion.
FISHER = FISHER ## Palauttaa Fisher-muunnoksen.
FISHERINV = FISHER.KÄÄNT ## Palauttaa käänteisen Fisher-muunnoksen.
FORECAST = ENNUSTE ## Palauttaa lineaarisen trendin arvon.
FREQUENCY = TAAJUUS ## Palauttaa frekvenssijakautuman pystysuuntaisena matriisina.
FTEST = FTESTI ## Palauttaa F-testin tuloksen.
GAMMADIST = GAMMAJAKAUMA ## Palauttaa gammajakauman.
GAMMAINV = GAMMAJAKAUMA.KÄÄNT ## Palauttaa käänteisen gammajakauman kertymäfunktion.
GAMMALN = GAMMALN ## Palauttaa gammafunktion luonnollisen logaritmin G(x).
GEOMEAN = KESKIARVO.GEOM ## Palauttaa geometrisen keskiarvon.
GROWTH = KASVU ## Palauttaa eksponentiaalisen trendin arvon.
HARMEAN = KESKIARVO.HARM ## Palauttaa harmonisen keskiarvon.
HYPGEOMDIST = HYPERGEOM.JAKAUMA ## Palauttaa hypergeometrisen jakauman.
INTERCEPT = LEIKKAUSPISTE ## Palauttaa lineaarisen regressiosuoran leikkauspisteen.
KURT = KURT ## Palauttaa tietoalueen vinous-arvon eli huipukkuuden.
LARGE = SUURI ## Palauttaa tietojoukon k:nneksi suurimman arvon.
LINEST = LINREGR ## Palauttaa lineaarisen trendin parametrit.
LOGEST = LOGREGR ## Palauttaa eksponentiaalisen trendin parametrit.
LOGINV = LOGNORM.JAKAUMA.KÄÄNT ## Palauttaa lognormeeratun jakauman käänteisfunktion.
LOGNORMDIST = LOGNORM.JAKAUMA ## Palauttaa lognormaalisen jakauman kertymäfunktion.
MAX = MAKS ## Palauttaa suurimman arvon argumenttiluettelosta.
MAXA = MAKSA ## Palauttaa argumenttien, mukaan lukien lukujen, tekstin ja loogisten arvojen, suurimman arvon.
MEDIAN = MEDIAANI ## Palauttaa annettujen lukujen mediaanin.
MIN = MIN ## Palauttaa pienimmän arvon argumenttiluettelosta.
MINA = MINA ## Palauttaa argumenttien, mukaan lukien lukujen, tekstin ja loogisten arvojen, pienimmän arvon.
MODE = MOODI ## Palauttaa tietojoukossa useimmin esiintyvän arvon.
NEGBINOMDIST = BINOMIJAKAUMA.NEG ## Palauttaa negatiivisen binomijakauman.
NORMDIST = NORM.JAKAUMA ## Palauttaa normaalijakauman kertymäfunktion.
NORMINV = NORM.JAKAUMA.KÄÄNT ## Palauttaa käänteisen normaalijakauman kertymäfunktion.
NORMSDIST = NORM.JAKAUMA.NORMIT ## Palauttaa normitetun normaalijakauman kertymäfunktion.
NORMSINV = NORM.JAKAUMA.NORMIT.KÄÄNT ## Palauttaa normitetun normaalijakauman kertymäfunktion käänteisarvon.
PEARSON = PEARSON ## Palauttaa Pearsonin tulomomenttikorrelaatiokertoimen.
PERCENTILE = PROSENTTIPISTE ## Palauttaa alueen arvojen k:nnen prosenttipisteen.
PERCENTRANK = PROSENTTIJÄRJESTYS ## Palauttaa tietojoukon arvon prosentuaalisen järjestysluvun.
PERMUT = PERMUTAATIO ## Palauttaa mahdollisten permutaatioiden määrän annetulle objektien määrälle.
POISSON = POISSON ## Palauttaa Poissonin todennäköisyysjakauman.
PROB = TODENNÄKÖISYYS ## Palauttaa todennäköisyyden sille, että arvot ovat tietyltä väliltä.
QUARTILE = NELJÄNNES ## Palauttaa tietoalueen neljänneksen.
RANK = ARVON.MUKAAN ## Palauttaa luvun paikan lukuarvoluettelossa.
RSQ = PEARSON.NELIÖ ## Palauttaa Pearsonin tulomomenttikorrelaatiokertoimen neliön.
SKEW = JAKAUMAN.VINOUS ## Palauttaa jakauman vinouden.
SLOPE = KULMAKERROIN ## Palauttaa lineaarisen regressiosuoran kulmakertoimen.
SMALL = PIENI ## Palauttaa tietojoukon k:nneksi pienimmän arvon.
STANDARDIZE = NORMITA ## Palauttaa normitetun arvon.
STDEV = KESKIHAJONTA ## Laskee populaation keskihajonnan otoksen perusteella.
STDEVA = KESKIHAJONTAA ## Laskee populaation keskihajonnan otoksen perusteella, mukaan lukien luvut, tekstin ja loogiset arvot.
STDEVP = KESKIHAJONTAP ## Laskee normaalijakautuman koko populaation perusteella.
STDEVPA = KESKIHAJONTAPA ## Laskee populaation keskihajonnan koko populaation perusteella, mukaan lukien luvut, tekstin ja totuusarvot.
STEYX = KESKIVIRHE ## Palauttaa regression kutakin x-arvoa vastaavan ennustetun y-arvon keskivirheen.
TDIST = TJAKAUMA ## Palauttaa t-jakautuman.
TINV = TJAKAUMA.KÄÄNT ## Palauttaa käänteisen t-jakauman.
TREND = SUUNTAUS ## Palauttaa lineaarisen trendin arvoja.
TRIMMEAN = KESKIARVO.TASATTU ## Palauttaa tietojoukon tasatun keskiarvon.
TTEST = TTESTI ## Palauttaa t-testiin liittyvän todennäköisyyden.
VAR = VAR ## Arvioi populaation varianssia otoksen perusteella.
VARA = VARA ## Laskee populaation varianssin otoksen perusteella, mukaan lukien luvut, tekstin ja loogiset arvot.
VARP = VARP ## Laskee varianssin koko populaation perusteella.
VARPA = VARPA ## Laskee populaation varianssin koko populaation perusteella, mukaan lukien luvut, tekstin ja totuusarvot.
WEIBULL = WEIBULL ## Palauttaa Weibullin jakauman.
ZTEST = ZTESTI ## Palauttaa z-testin yksisuuntaisen todennäköisyysarvon.
##
## Text functions Tekstifunktiot
##
ASC = ASC ## Muuntaa merkkijonossa olevat englanninkieliset DBCS- tai katakana-merkit SBCS-merkeiksi.
BAHTTEXT = BAHTTEKSTI ## Muuntaa luvun tekstiksi ß (baht) -valuuttamuotoa käyttämällä.
CHAR = MERKKI ## Palauttaa koodin lukua vastaavan merkin.
CLEAN = SIIVOA ## Poistaa tekstistä kaikki tulostumattomat merkit.
CODE = KOODI ## Palauttaa tekstimerkkijonon ensimmäisen merkin numerokoodin.
CONCATENATE = KETJUTA ## Yhdistää useat merkkijonot yhdeksi merkkijonoksi.
DOLLAR = VALUUTTA ## Muuntaa luvun tekstiksi $ (dollari) -valuuttamuotoa käyttämällä.
EXACT = VERTAA ## Tarkistaa, ovatko kaksi tekstiarvoa samanlaiset.
FIND = ETSI ## Etsii tekstiarvon toisen tekstin sisältä (tunnistaa isot ja pienet kirjaimet).
FINDB = ETSIB ## Etsii tekstiarvon toisen tekstin sisältä (tunnistaa isot ja pienet kirjaimet).
FIXED = KIINTEÄ ## Muotoilee luvun tekstiksi, jossa on kiinteä määrä desimaaleja.
JIS = JIS ## Muuntaa merkkijonossa olevat englanninkieliset SBCS- tai katakana-merkit DBCS-merkeiksi.
LEFT = VASEN ## Palauttaa tekstiarvon vasemmanpuoliset merkit.
LEFTB = VASENB ## Palauttaa tekstiarvon vasemmanpuoliset merkit.
LEN = PITUUS ## Palauttaa tekstimerkkijonon merkkien määrän.
LENB = PITUUSB ## Palauttaa tekstimerkkijonon merkkien määrän.
LOWER = PIENET ## Muuntaa tekstin pieniksi kirjaimiksi.
MID = POIMI.TEKSTI ## Palauttaa määritetyn määrän merkkejä merkkijonosta alkaen annetusta kohdasta.
MIDB = POIMI.TEKSTIB ## Palauttaa määritetyn määrän merkkejä merkkijonosta alkaen annetusta kohdasta.
PHONETIC = FONEETTINEN ## Hakee foneettiset (furigana) merkit merkkijonosta.
PROPER = ERISNIMI ## Muuttaa merkkijonon kunkin sanan ensimmäisen kirjaimen isoksi.
REPLACE = KORVAA ## Korvaa tekstissä olevat merkit.
REPLACEB = KORVAAB ## Korvaa tekstissä olevat merkit.
REPT = TOISTA ## Toistaa tekstin annetun määrän kertoja.
RIGHT = OIKEA ## Palauttaa tekstiarvon oikeanpuoliset merkit.
RIGHTB = OIKEAB ## Palauttaa tekstiarvon oikeanpuoliset merkit.
SEARCH = KÄY.LÄPI ## Etsii tekstiarvon toisen tekstin sisältä (isot ja pienet kirjaimet tulkitaan samoiksi merkeiksi).
SEARCHB = KÄY.LÄPIB ## Etsii tekstiarvon toisen tekstin sisältä (isot ja pienet kirjaimet tulkitaan samoiksi merkeiksi).
SUBSTITUTE = VAIHDA ## Korvaa merkkijonossa olevan tekstin toisella.
T = T ## Muuntaa argumentit tekstiksi.
TEXT = TEKSTI ## Muotoilee luvun ja muuntaa sen tekstiksi.
TRIM = POISTA.VÄLIT ## Poistaa välilyönnit tekstistä.
UPPER = ISOT ## Muuntaa tekstin isoiksi kirjaimiksi.
VALUE = ARVO ## Muuntaa tekstiargumentin luvuksi.
PK ! c+]` ` PHPExcel/locale/fi/confignu [ ##
## PHPExcel
##
## Copyright (c) 2006 - 2013 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
##
## @category PHPExcel
## @package PHPExcel_Settings
## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
## @version 1.8.0, 2014-03-02
##
##
ArgumentSeparator = ;
##
## (For future use)
##
currencySymbol = $ # Symbol not known, should it be a € (Euro)?
##
## Excel Error Codes (For future use)
##
NULL = #TYHJÄ!
DIV0 = #JAKO/0!
VALUE = #ARVO!
REF = #VIITTAUS!
NAME = #NIMI?
NUM = #LUKU!
NA = #PUUTTUU
PK ! M
PHPExcel/locale/bg/confignu [ ##
## PHPExcel
##
## Copyright (c) 2006 - 2013 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
##
## @category PHPExcel
## @package PHPExcel_Settings
## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
## @version 1.8.0, 2014-03-02
##
##
ArgumentSeparator = ;
##
## (For future use)
##
currencySymbol = лв
##
## Excel Error Codes (For future use)
##
NULL = #ПРАЗНО!
DIV0 = #ДЕЛ/0!
VALUE = #СТОЙНОСТ!
REF = #РЕФ!
NAME = #ИМЕ?
NUM = #ЧИСЛО!
NA = #Н/Д
PK ! C