92 $this->_phpExcel = $phpExcel;
101 public function save($pFilename = null) {
103 $sheet = $this->_phpExcel->getSheet($this->_sheetIndex);
111 $fileHandle = fopen($pFilename,
'wb+');
112 if ($fileHandle ===
false) {
113 throw new Exception(
"Could not open file $pFilename for writing.");
116 if ($this->_useBOM) {
118 fwrite($fileHandle,
"\xEF\xBB\xBF");
122 $cellsArray = $sheet->toArray(
'', $this->_preCalculateFormulas);
125 foreach ($cellsArray as
$row) {
152 $this->_delimiter = $pValue;
175 $this->_enclosure = $pValue;
195 $this->_lineEnding = $pValue;
215 $this->_useBOM = $pValue;
235 $this->_sheetIndex = $pValue;
246 private function _writeLine($pFileHandle = null, $pValues = null) {
247 if (is_array($pValues)) {
249 $writeDelimiter =
false;
254 foreach ($pValues as $element) {
256 $element = str_replace($this->_enclosure, $this->_enclosure . $this->_enclosure, $element);
259 if ($writeDelimiter) {
262 $writeDelimiter =
true;
273 fwrite($pFileHandle, $line);
275 throw new Exception(
"Invalid parameters passed.");
295 $this->_preCalculateFormulas = $pValue;