/** * @dataProvider providerGeneral */ public function testGeneral($params) { $this->parser->addSheet('Sheet1', 0); $this->parser->addSheet('Sheet2', 1); if (isset($params['correct']) && $params['correct'] === false) { $message = isset($params['error']) ? $params['error'] : ''; $this->setExpectedException('\\Exception', $message); } if (!is_array($params['formula'])) { $params['formula'] = array($params['formula']); } foreach ($params['formula'] as $formula) { $this->parser->getReversePolish($formula); } }
/** * 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..]. * * @param string $name the optional name of the worksheet * @throws \Exception * @return Worksheet */ public function addWorksheet($name = '') { $index = count($this->worksheets); if ($name == '') { $name = 'Sheet' . ($index + 1); } $this->checkSheetName($name); if ($this->hasSheet($name)) { throw new \Exception("Worksheet '{$name}' already exists"); } $worksheet = new Worksheet($name, $index, $this, $this->sst, $this->urlFormat, $this->formulaParser); $this->worksheets[$index] = $worksheet; $this->sheetNames[$index] = $name; if (count($this->worksheets) == 1) { $this->setActiveSheetIndex(0); } // Register worksheet name with parser $this->formulaParser->addSheet($name, $index); $this->formulaParser->addRef($index, $index); return $worksheet; }