Some work on page margins for HTML Writer, and initial elements for DomPDF PDF Writer
This commit is contained in:
parent
6145cf326b
commit
fb16712e13
|
@ -1016,6 +1016,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
|
|||
|
||||
// Construct HTML
|
||||
$html = '';
|
||||
$html .= $this->_setMargins($pSheet);
|
||||
|
||||
if (!$this->_useInlineCss) {
|
||||
$gridlines = $pSheet->getShowGridLines() ? ' gridlines' : '';
|
||||
|
@ -1495,4 +1496,27 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
|
|||
$this->_spansAreCalculated = true;
|
||||
}
|
||||
|
||||
private function _setMargins(PHPExcel_Worksheet $pSheet) {
|
||||
$htmlPage = '@page { ';
|
||||
$htmlBody = 'body { ';
|
||||
|
||||
$left = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getLeft()) . 'in; ';
|
||||
$htmlPage .= 'left-margin: ' . $left;
|
||||
$htmlBody .= 'left-margin: ' . $left;
|
||||
$right = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getRight()) . 'in; ';
|
||||
$htmlPage .= 'right-margin: ' . $right;
|
||||
$htmlBody .= 'right-margin: ' . $right;
|
||||
$top = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getTop()) . 'in; ';
|
||||
$htmlPage .= 'top-margin: ' . $top;
|
||||
$htmlBody .= 'top-margin: ' . $top;
|
||||
$bottom = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getBottom()) . 'in; ';
|
||||
$htmlPage .= 'bottom-margin: ' . $bottom;
|
||||
$htmlBody .= 'bottom-margin: ' . $bottom;
|
||||
|
||||
$htmlPage .= "}\n";
|
||||
$htmlBody .= "}\n";
|
||||
|
||||
return "<style>\n" . $htmlPage . $htmlBody . "</style>\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue