You are here

public function PHPExcel_Writer_HTML::save in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/HTML.php \PHPExcel_Writer_HTML::save()

* Save PHPExcel to file * *

Parameters

string $pFilename: * @throws PHPExcel_Writer_Exception

Overrides PHPExcel_Writer_IWriter::save

3 methods override PHPExcel_Writer_HTML::save()
PHPExcel_Writer_PDF_DomPDF::save in vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/PDF/DomPDF.php
Save PHPExcel to file
PHPExcel_Writer_PDF_mPDF::save in vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/PDF/mPDF.php
Save PHPExcel to file
PHPExcel_Writer_PDF_tcPDF::save in vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/PDF/tcPDF.php
Save PHPExcel to file

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/HTML.php, line 151

Class

PHPExcel_Writer_HTML
PHPExcel_Writer_HTML

Code

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);
  $saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType();
  PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);

  // Build CSS
  $this
    ->buildCSS(!$this->_useInlineCss);

  // Open file
  $fileHandle = fopen($pFilename, 'wb+');
  if ($fileHandle === false) {
    throw new PHPExcel_Writer_Exception("Could not open file {$pFilename} for writing.");
  }

  // Write headers
  fwrite($fileHandle, $this
    ->generateHTMLHeader(!$this->_useInlineCss));

  // Write navigation (tabs)
  if (!$this->_isPdf && $this->_generateSheetNavigationBlock) {
    fwrite($fileHandle, $this
      ->generateNavigation());
  }

  // Write data
  fwrite($fileHandle, $this
    ->generateSheetData());

  // Write footer
  fwrite($fileHandle, $this
    ->generateHTMLFooter());

  // Close file
  fclose($fileHandle);
  PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType);
  PHPExcel_Calculation::getInstance($this->_phpExcel)
    ->getDebugLog()
    ->setWriteDebugLog($saveDebugLog);
}