class PHPExcel_Writer_PDF_tcPDF in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/PDF/tcPDF.php \PHPExcel_Writer_PDF_tcPDF
PHPExcel_Writer_PDF_tcPDF
@category PHPExcel @package PHPExcel_Writer_PDF @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
Hierarchy
- class \PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
- class \PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter
- class \PHPExcel_Writer_PDF_Core
- class \PHPExcel_Writer_PDF_tcPDF implements PHPExcel_Writer_IWriter
- class \PHPExcel_Writer_PDF_Core
- class \PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter
Expanded class hierarchy of PHPExcel_Writer_PDF_tcPDF
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Writer/ PDF/ tcPDF.php, line 45
View source
class PHPExcel_Writer_PDF_tcPDF extends PHPExcel_Writer_PDF_Core implements PHPExcel_Writer_IWriter {
/**
* Create a new PHPExcel_Writer_PDF
*
* @param PHPExcel $phpExcel PHPExcel object
*/
public function __construct(PHPExcel $phpExcel) {
parent::__construct($phpExcel);
}
/**
* Save PHPExcel to file
*
* @param string $pFilename Name of the file to save as
* @throws PHPExcel_Writer_Exception
*/
public function save($pFilename = NULL) {
$fileHandle = parent::prepareForSave($pFilename);
// Default PDF paper size
$paperSize = 'LETTER';
// Letter (8.5 in. by 11 in.)
// Check for paper size and page orientation
if (is_null($this
->getSheetIndex())) {
$orientation = $this->_phpExcel
->getSheet(0)
->getPageSetup()
->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P';
$printPaperSize = $this->_phpExcel
->getSheet(0)
->getPageSetup()
->getPaperSize();
$printMargins = $this->_phpExcel
->getSheet(0)
->getPageMargins();
}
else {
$orientation = $this->_phpExcel
->getSheet($this
->getSheetIndex())
->getPageSetup()
->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P';
$printPaperSize = $this->_phpExcel
->getSheet($this
->getSheetIndex())
->getPageSetup()
->getPaperSize();
$printMargins = $this->_phpExcel
->getSheet($this
->getSheetIndex())
->getPageMargins();
}
// Override Page Orientation
if (!is_null($this
->getOrientation())) {
$orientation = $this
->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P';
}
// Override Paper Size
if (!is_null($this
->getPaperSize())) {
$printPaperSize = $this
->getPaperSize();
}
if (isset(self::$_paperSizes[$printPaperSize])) {
$paperSize = self::$_paperSizes[$printPaperSize];
}
// Create PDF
$pdf = new TCPDF($orientation, 'pt', $paperSize);
$pdf
->setFontSubsetting(FALSE);
// Set margins, converting inches to points (using 72 dpi)
$pdf
->SetMargins($printMargins
->getLeft() * 72, $printMargins
->getTop() * 72, $printMargins
->getRight() * 72);
$pdf
->SetAutoPageBreak(TRUE, $printMargins
->getBottom() * 72);
$pdf
->setPrintHeader(FALSE);
$pdf
->setPrintFooter(FALSE);
$pdf
->AddPage();
// Set the appropriate font
$pdf
->SetFont($this
->getFont());
$pdf
->writeHTML($this
->generateHTMLHeader(FALSE) . $this
->generateSheetData() . $this
->generateHTMLFooter());
// 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'));
parent::restoreStateAfterSave($fileHandle);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PHPExcel_Writer_Abstract:: |
protected | property | * Disk caching directory * * | |
PHPExcel_Writer_Abstract:: |
protected | property | * Write charts that are defined in the workbook? * Identifies whether the Writer should write definitions for any charts that exist in the PHPExcel object; * * | |
PHPExcel_Writer_Abstract:: |
protected | property | * Pre-calculate formulas * Forces PHPExcel to recalculate all formulae in a workbook when saving, so that the pre-calculated values are * immediately available to MS Excel or other office spreadsheet viewer when opening the file * * | 1 |
PHPExcel_Writer_Abstract:: |
protected | property | * Use disk caching where possible? * * | |
PHPExcel_Writer_Abstract:: |
public | function | * Get disk caching directory * * | |
PHPExcel_Writer_Abstract:: |
public | function | * Write charts in workbook? * If this is true, then the Writer will write definitions for any charts that exist in the PHPExcel object. * If false (the default) it will ignore any charts defined in the PHPExcel object. * * | |
PHPExcel_Writer_Abstract:: |
public | function | Get Pre-Calculate Formulas flag * If this is true (the default), then the writer will recalculate all formulae in a workbook when saving, * so that the pre-calculated values are immediately available to MS Excel or other office… | |
PHPExcel_Writer_Abstract:: |
public | function | * Get use disk caching where possible? * * | |
PHPExcel_Writer_Abstract:: |
public | function | * Set write charts in workbook * Set to true, to advise the Writer to include any charts that exist in the PHPExcel object. * Set to false (the default) to ignore charts. * * | |
PHPExcel_Writer_Abstract:: |
public | function | Set Pre-Calculate Formulas * Set to true (the default) to advise the Writer to calculate all formulae on save * Set to false to prevent precalculation of formulae on save. | |
PHPExcel_Writer_Abstract:: |
public | function | * Set use disk caching where possible? * * | |
PHPExcel_Writer_HTML:: |
private | property | * Array of column widths in points * * | |
PHPExcel_Writer_HTML:: |
private | property | * Array of CSS styles * * | |
PHPExcel_Writer_HTML:: |
private | property | * Default font * * | |
PHPExcel_Writer_HTML:: |
private | property | * embed images, or link to images * * | |
PHPExcel_Writer_HTML:: |
private | property | * Generate the Navigation block * * | |
PHPExcel_Writer_HTML:: |
private | property | * Images root * * | |
PHPExcel_Writer_HTML:: |
private | property | * Excel cells that are upper-left corner in a cell merge * * | |
PHPExcel_Writer_HTML:: |
protected | property | * Is the current writer creating PDF? * * | |
PHPExcel_Writer_HTML:: |
private | property | * Excel cells that should not be written as HTML cells * * | |
PHPExcel_Writer_HTML:: |
private | property | * Excel rows that should not be written as HTML rows * * | |
PHPExcel_Writer_HTML:: |
protected | property | * PHPExcel object * * | |
PHPExcel_Writer_HTML:: |
private | property | * Sheet index to write * * | |
PHPExcel_Writer_HTML:: |
private | property | * Flag whether spans have been calculated * * | |
PHPExcel_Writer_HTML:: |
private | property | * Use inline CSS? * * | |
PHPExcel_Writer_HTML:: |
public | function | * Build CSS styles * * | |
PHPExcel_Writer_HTML:: |
public | function | * Add color to formatted string as inline style * * | |
PHPExcel_Writer_HTML:: |
public | function | * Generate HTML footer | |
PHPExcel_Writer_HTML:: |
public | function | * Generate HTML header * * | |
PHPExcel_Writer_HTML:: |
public | function | * Generate sheet tabs * * | |
PHPExcel_Writer_HTML:: |
public | function | * Generate sheet data * * | |
PHPExcel_Writer_HTML:: |
public | function | * Generate CSS styles * * | |
PHPExcel_Writer_HTML:: |
public | function | * Get embed images * * | |
PHPExcel_Writer_HTML:: |
public | function | * Get sheet index * * | |
PHPExcel_Writer_HTML:: |
public | function | * Get images root * * | |
PHPExcel_Writer_HTML:: |
public | function | * Get sheet index * * | |
PHPExcel_Writer_HTML:: |
public | function | * Get use inline CSS? * * | |
PHPExcel_Writer_HTML:: |
public | function | * Set embed images * * | |
PHPExcel_Writer_HTML:: |
public | function | * Set sheet index * * | |
PHPExcel_Writer_HTML:: |
public | function | * Set images root * * | |
PHPExcel_Writer_HTML:: |
public | function | * Set sheet index * * | |
PHPExcel_Writer_HTML:: |
public | function | * Set use inline CSS? * * | |
PHPExcel_Writer_HTML:: |
public | function | * Write all sheets (resets sheetIndex to NULL) | |
PHPExcel_Writer_HTML:: |
private | function | * Takes array where of CSS properties / values and converts to CSS string * * | |
PHPExcel_Writer_HTML:: |
private | function | * Calculate information about HTML colspan and rowspan which is not always the same as Excel's | |
PHPExcel_Writer_HTML:: |
private | function | * Create CSS style * * | |
PHPExcel_Writer_HTML:: |
private | function | * Create CSS style (PHPExcel_Style_Alignment) * * | |
PHPExcel_Writer_HTML:: |
private | function | * Create CSS style (PHPExcel_Style_Border) * * | |
PHPExcel_Writer_HTML:: |
private | function | * Create CSS style (PHPExcel_Style_Borders) * * | |
PHPExcel_Writer_HTML:: |
private | function | * Create CSS style (PHPExcel_Style_Fill) * * | |
PHPExcel_Writer_HTML:: |
private | function | * Create CSS style (PHPExcel_Style_Font) * * | |
PHPExcel_Writer_HTML:: |
private | function | ||
PHPExcel_Writer_HTML:: |
private | function | * Generate row * * | |
PHPExcel_Writer_HTML:: |
private | function | * Generate table footer * * | |
PHPExcel_Writer_HTML:: |
private | function | * Generate table header * * | |
PHPExcel_Writer_HTML:: |
private | function | * Map border style * * | |
PHPExcel_Writer_HTML:: |
private | function | * Map HAlign * * | |
PHPExcel_Writer_HTML:: |
private | function | * Map VAlign * * | |
PHPExcel_Writer_HTML:: |
private | function | ||
PHPExcel_Writer_HTML:: |
private | function | * Generate chart tag in cell * * | |
PHPExcel_Writer_HTML:: |
private | function | * Generate image tag in cell * * | |
PHPExcel_Writer_PDF_Core:: |
protected | property | Font | |
PHPExcel_Writer_PDF_Core:: |
protected | property | Orientation (Over-ride) | |
PHPExcel_Writer_PDF_Core:: |
protected | property | Paper size (Over-ride) | |
PHPExcel_Writer_PDF_Core:: |
protected static | property | Paper Sizes xRef List | |
PHPExcel_Writer_PDF_Core:: |
private | property | Temporary storage for Save Array Return type | |
PHPExcel_Writer_PDF_Core:: |
protected | property | Temporary storage directory | |
PHPExcel_Writer_PDF_Core:: |
public | function | Get Font | |
PHPExcel_Writer_PDF_Core:: |
public | function | Get Orientation | |
PHPExcel_Writer_PDF_Core:: |
public | function | Get Paper Size | |
PHPExcel_Writer_PDF_Core:: |
public | function | Get temporary storage directory | |
PHPExcel_Writer_PDF_Core:: |
protected | function | Save PHPExcel to PDF file, pre-save | |
PHPExcel_Writer_PDF_Core:: |
protected | function | Save PHPExcel to PDF file, post-save | |
PHPExcel_Writer_PDF_Core:: |
public | function | Set font. Examples: 'arialunicid0-chinese-simplified' 'arialunicid0-chinese-traditional' 'arialunicid0-korean' 'arialunicid0-japanese' | |
PHPExcel_Writer_PDF_Core:: |
public | function | Set Orientation | |
PHPExcel_Writer_PDF_Core:: |
public | function | Set Paper Size | |
PHPExcel_Writer_PDF_Core:: |
public | function | Set temporary storage directory | |
PHPExcel_Writer_PDF_tcPDF:: |
public | function |
Save PHPExcel to file Overrides PHPExcel_Writer_HTML:: |
|
PHPExcel_Writer_PDF_tcPDF:: |
public | function |
Create a new PHPExcel_Writer_PDF Overrides PHPExcel_Writer_PDF_Core:: |