Feature: Configure PDF Writer margins based on Excel Worksheet Margin Settings values

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@61664 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2010-09-29 14:41:43 +00:00
parent f0131c0282
commit 6364b7a58a
2 changed files with 10 additions and 0 deletions

View File

@ -245,9 +245,11 @@ class PHPExcel_Writer_PDF extends PHPExcel_Writer_HTML implements PHPExcel_Write
if (is_null($this->getSheetIndex())) { if (is_null($this->getSheetIndex())) {
$orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; $orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
$printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize(); $printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize();
$printMargins = $this->_phpExcel->getSheet(0)->getPageMargins();
} else { } else {
$orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; $orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
$printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); $printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
$printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins();
} }
// Override Page Orientation // Override Page Orientation
@ -267,8 +269,15 @@ class PHPExcel_Writer_PDF extends PHPExcel_Writer_HTML implements PHPExcel_Write
// Create PDF // Create PDF
$pdf = new TCPDF($orientation, 'pt', $paperSize); $pdf = new TCPDF($orientation, 'pt', $paperSize);
// 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->setHeaderMargin($printMargins->getHeader() * 72);
// $pdf->setFooterMargin($printMargins->getFooter() * 72);
$pdf->setPrintHeader(false); $pdf->setPrintHeader(false);
$pdf->setPrintFooter(false); $pdf->setPrintFooter(false);
$pdf->AddPage(); $pdf->AddPage();
// Set the appropriate font // Set the appropriate font

View File

@ -32,6 +32,7 @@ Fixed in SVN:
- Feature: (MBaker) Provided a setGenerateSheetNavigationBlock(false); option to suppress generation of the sheet navigation block when writing multiple worksheets to HTML - Feature: (MBaker) Provided a setGenerateSheetNavigationBlock(false); option to suppress generation of the sheet navigation block when writing multiple worksheets to HTML
- Feature: (MBaker) Advanced Value Binder now recognises TRUE/FALSE strings (locale-specific) and converts to boolean - Feature: (MBaker) Advanced Value Binder now recognises TRUE/FALSE strings (locale-specific) and converts to boolean
- Feature: (MBaker) Work item 14301 - PHPExcel_Worksheet->toArray() is returning truncated values - Feature: (MBaker) Work item 14301 - PHPExcel_Worksheet->toArray() is returning truncated values
- Feature: (MBaker) Configure PDF Writer margins based on Excel Worksheet Margin Settings value
- Bugfix: (Progi1984) Workitem 7895 - Excel5 : Formula : Percent - Bugfix: (Progi1984) Workitem 7895 - Excel5 : Formula : Percent
- Bugfix: (MB) Work item 14143 - NA() doesn't propagate in matrix calc - quick fix in JAMA/Matrix.php - Bugfix: (MB) Work item 14143 - NA() doesn't propagate in matrix calc - quick fix in JAMA/Matrix.php
- Bugfix: (Progi1984) Workitem 7895 - Excel5 : Formula : Error constant - Bugfix: (Progi1984) Workitem 7895 - Excel5 : Formula : Error constant