You are here

protected function PHPExcel_Writer_PDF_Core::prepareForSave in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/PDF/Core.php \PHPExcel_Writer_PDF_Core::prepareForSave()

Save PHPExcel to PDF file, pre-save

Parameters

string $pFilename Name of the file to save as: @throws PHPExcel_Writer_Exception

3 calls to PHPExcel_Writer_PDF_Core::prepareForSave()
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/PDF/Core.php, line 328

Class

PHPExcel_Writer_PDF_Core
PHPExcel_Writer_PDF_Core

Code

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;
}