ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
PHPExcel_Writer_PDF Class Reference
+ Inheritance diagram for PHPExcel_Writer_PDF:
+ Collaboration diagram for PHPExcel_Writer_PDF:

Public Member Functions

 __construct (PHPExcel $phpExcel)
 Create a new PHPExcel_Writer_PDF.
 save ($pFilename=null)
 Save PHPExcel to file.
 getTempDir ()
 Get temporary storage directory.
 setTempDir ($pValue= '')
 Set temporary storage directory.
- Public Member Functions inherited from PHPExcel_Writer_HTML
 getSheetIndex ()
 Get sheet index.
 setSheetIndex ($pValue=0)
 Set sheet index.
 writeAllSheets ()
 Write all sheets (resets sheetIndex to NULL)
 generateHTMLHeader ($pIncludeStyles=false)
 Generate HTML header.
 generateSheetData ()
 Generate sheet data.
 generateStyles ($generateSurroundingHTML=true)
 Generate CSS styles.
 buildCSS ($generateSurroundingHTML=true)
 Build CSS styles.
 generateHTMLFooter ()
 Generate HTML footer.
 getPreCalculateFormulas ()
 Get Pre-Calculate Formulas.
 setPreCalculateFormulas ($pValue=true)
 Set Pre-Calculate Formulas.
 getImagesRoot ()
 Get images root.
 setImagesRoot ($pValue= '.')
 Set images root.
 getUseInlineCss ()
 Get use inline CSS?
 setUseInlineCss ($pValue=false)
 Set use inline CSS?

Private Attributes

 $_tempDir = ''

Additional Inherited Members

- Protected Attributes inherited from PHPExcel_Writer_HTML
 $_phpExcel
 $_isPdf = false

Detailed Description

Definition at line 66 of file PDF.php.

Constructor & Destructor Documentation

PHPExcel_Writer_PDF::__construct ( PHPExcel  $phpExcel)

Create a new PHPExcel_Writer_PDF.

Parameters
PHPExcel$phpExcelPHPExcel object

Reimplemented from PHPExcel_Writer_HTML.

Definition at line 79 of file PDF.php.

References PHPExcel_Writer_HTML\setUseInlineCss().

{
parent::__construct($phpExcel);
$this->setUseInlineCss(true);
$this->_tempDir = sys_get_temp_dir();
}

+ Here is the call graph for this function:

Member Function Documentation

PHPExcel_Writer_PDF::getTempDir ( )

Get temporary storage directory.

Returns
string

Definition at line 156 of file PDF.php.

References $_tempDir.

{
}
PHPExcel_Writer_PDF::save (   $pFilename = null)

Save PHPExcel to file.

Parameters
string$pFileName
Exceptions
Exception

Reimplemented from PHPExcel_Writer_HTML.

Definition at line 91 of file PDF.php.

References PHPExcel_Writer_HTML\buildCSS(), PHPExcel_Writer_HTML\generateSheetData(), PHPExcel_Calculation\getArrayReturnType(), PHPExcel_Writer_HTML\getSheetIndex(), PHPExcel_Calculation\RETURN_ARRAY_AS_VALUE, and PHPExcel_Calculation\setArrayReturnType().

{
// garbage collect
$this->_phpExcel->garbageCollect();
$saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType();
// Open file
$fileHandle = fopen($pFilename, 'w');
if ($fileHandle === false) {
throw new Exception("Could not open file $pFilename for writing.");
}
// Set PDF
$this->_isPdf = true;
// Build CSS
$this->buildCSS(true);
// Generate HTML
$html = '';
//$html .= $this->generateHTMLHeader(false);
$html .= $this->generateSheetData();
//$html .= $this->generateHTMLFooter();
// Default PDF paper size
$paperSize = 'A4';
$orientation = 'P';
// Check for overrides
if (is_null($this->getSheetIndex())) {
$orientation = $this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() == 'landscape' ? 'L' : 'P';
} else {
$orientation = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() == 'landscape' ? 'L' : 'P';
}
// Create PDF
$pdf = new TCPDF($orientation, 'pt', $paperSize);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->AddPage();
$pdf->SetFont('freesans');
$pdf->writeHTML($html);
// Document info
$pdf->SetTitle($this->_phpExcel->getProperties()->getTitle());
$pdf->SetAuthor($this->_phpExcel->getProperties()->getCreator());
$pdf->SetSubject($this->_phpExcel->getProperties()->getSubject());
$pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords());
$pdf->SetCreator($this->_phpExcel->getProperties()->getCreator());
// Write to file
fwrite($fileHandle, $pdf->output($pFilename, 'S'));
// Close file
fclose($fileHandle);
}

+ Here is the call graph for this function:

PHPExcel_Writer_PDF::setTempDir (   $pValue = '')

Set temporary storage directory.

Parameters
string$pValueTemporary storage directory
Exceptions
ExceptionException when directory does not exist
Returns
PHPExcel_Writer_PDF

Definition at line 167 of file PDF.php.

{
if (is_dir($pValue)) {
$this->_tempDir = $pValue;
} else {
throw new Exception("Directory does not exist: $pValue");
}
return $this;
}

Field Documentation

PHPExcel_Writer_PDF::$_tempDir = ''
private

Definition at line 72 of file PDF.php.

Referenced by getTempDir().


The documentation for this class was generated from the following file: