/** * Add a new worksheet to the Excel workbook. * If no name is given the name of the worksheet will be Sheeti$i, with * $i in [1..]. * * @access public * @param string $name the optional name of the worksheet * @return mixed reference to a worksheet object on success, PEAR_Error * on failure */ public function addWorksheet($name = '') { $index = count($this->_worksheets); $sheetname = $this->_sheetname; if ($name == '') { $name = $sheetname . ($index + 1); } // Check that sheetname is <= 31 chars (Excel limit before BIFF8). if ($this->_BIFF_version != 0x600) { if (strlen($name) > 31) { return $this->raiseError("Sheetname {$name} must be <= 31 chars"); } } else { if (function_exists('iconv')) { $name = iconv('UTF-8', 'UTF-16LE', $name); } } // Check that the worksheet name doesn't already exist: a fatal Excel error. $total_worksheets = count($this->_worksheets); for ($i = 0; $i < $total_worksheets; $i++) { if ($this->_worksheets[$i]->getName() == $name) { return $this->raiseError("Worksheet '{$name}' already exists"); } } $worksheet = new Spreadsheet_Excel_Writer_Worksheet($this->_BIFF_version, $name, $index, $this->_activesheet, $this->_firstsheet, $this->_str_total, $this->_str_unique, $this->_str_table, $this->_url_format, $this->_parser, $this->_tmp_dir); $this->_worksheets[$index] = $worksheet; // Store ref for iterator $this->_sheetnames[$index] = $name; // Store EXTERNSHEET names $this->_parser->setExtSheet($name, $index); // Register worksheet name with parser return $worksheet; }
/** * Add a new worksheet to the Excel workbook. * If no name is given the name of the worksheet will be Sheeti$i, with * $i in [1..]. * * @access public * @param string $name the optional name of the worksheet * @return mixed reference to a worksheet object on success, PEAR_Error * on failure */ public function addWorksheet($name = '') { $index = count($this->workSheet); $sheetName = $this->sheetName; if ($name == '') { $name = $sheetName . ($index + 1); } // Check that sheetname is <= 31 chars (Excel limit before BIFF8). if ($this->BIFF_version != 0x600) { if (strlen($name) > 31) { return $this->raiseError('Sheetname $name must be <= 31 chars'); } } else { if (function_exists('iconv')) { $name = iconv('UTF-8', 'UTF-16LE', $name); } } // Check that the worksheet name doesn't already exist: a fatal Excel error. $total_worksheets = count($this->workSheet); for ($i = 0; $i < $total_worksheets; ++$i) { if ($this->workSheet[$i]->getName() == $name) { return $this->raiseError("Worksheet '{$name}' already exists"); } } $worksheet = new Spreadsheet_Excel_Writer_Worksheet($this->BIFF_version, $name, $index, $this->activeSheet, $this->firstSheet, $this->totalStringLength, $this->uniqueString, $this->tableOfStrings, $this->urlFormat, $this->parser, $this->temporaryDirectory); $this->workSheet[$index] = $worksheet; // Store ref for iterator $this->sheetNames[$index] = $name; // Store EXTERNSHEET names $this->parser->setExtSheet($name, $index); // Register worksheet name with parser return $worksheet; }
function setFormula2($formula) { // Parse the formula using the parser in Parser.php $error = $this->_parser->parse($formula); if (PEAR::isError($error)) { return $this->_formula2; } $this->_formula2 = $this->_parser->toReversePolish(); if (PEAR::isError($this->_formula2)) { return $this->_formula2; } return true; }