mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-30 01:06:03 +03:00
Feature: Added support for superscript/subscript in HTML/PDF Writers
git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@67512 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
parent
c6d58661e1
commit
c1fe7016ab
@ -426,7 +426,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
// Writing PDF?
|
// Writing PDF?
|
||||||
if ($this->_isPdf) {
|
if ($this->_isPdf) {
|
||||||
if (is_null($this->_sheetIndex) && $sheetId + 1 < $this->_phpExcel->getSheetCount()) {
|
if (is_null($this->_sheetIndex) && $sheetId + 1 < $this->_phpExcel->getSheetCount()) {
|
||||||
$html .= '<tcpdf method="AddPage" />';
|
$html .= '<div style="page-break-before:always" />';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -729,7 +729,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
// Create CSS
|
// Create CSS
|
||||||
$css = array_merge(
|
$css = array_merge(
|
||||||
$this->_createCSSStyleAlignment($pStyle->getAlignment())
|
$this->_createCSSStyleAlignment($pStyle->getAlignment())
|
||||||
, $this->_createCSSStyleBorders($pStyle->getBorders(),$pStyle->getFill())
|
, $this->_createCSSStyleBorders($pStyle->getBorders())
|
||||||
, $this->_createCSSStyleFont($pStyle->getFont())
|
, $this->_createCSSStyleFont($pStyle->getFont())
|
||||||
, $this->_createCSSStyleFill($pStyle->getFill())
|
, $this->_createCSSStyleFill($pStyle->getFill())
|
||||||
);
|
);
|
||||||
@ -797,15 +797,15 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
* @param PHPExcel_Style_Borders $pStyle PHPExcel_Style_Borders
|
* @param PHPExcel_Style_Borders $pStyle PHPExcel_Style_Borders
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function _createCSSStyleBorders(PHPExcel_Style_Borders $pStyle, PHPExcel_Style_Fill $fill) {
|
private function _createCSSStyleBorders(PHPExcel_Style_Borders $pStyle) {
|
||||||
// Construct CSS
|
// Construct CSS
|
||||||
$css = array();
|
$css = array();
|
||||||
|
|
||||||
// Create CSS
|
// Create CSS
|
||||||
$css['border-bottom'] = $this->_createCSSStyleBorder($pStyle->getBottom(),$fill);
|
$css['border-bottom'] = $this->_createCSSStyleBorder($pStyle->getBottom());
|
||||||
$css['border-top'] = $this->_createCSSStyleBorder($pStyle->getTop(),$fill);
|
$css['border-top'] = $this->_createCSSStyleBorder($pStyle->getTop());
|
||||||
$css['border-left'] = $this->_createCSSStyleBorder($pStyle->getLeft(),$fill);
|
$css['border-left'] = $this->_createCSSStyleBorder($pStyle->getLeft());
|
||||||
$css['border-right'] = $this->_createCSSStyleBorder($pStyle->getRight(),$fill);
|
$css['border-right'] = $this->_createCSSStyleBorder($pStyle->getRight());
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
return $css;
|
return $css;
|
||||||
@ -817,20 +817,12 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
* @param PHPExcel_Style_Border $pStyle PHPExcel_Style_Border
|
* @param PHPExcel_Style_Border $pStyle PHPExcel_Style_Border
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function _createCSSStyleBorder(PHPExcel_Style_Border $pStyle, PHPExcel_Style_Fill $fill) {
|
private function _createCSSStyleBorder(PHPExcel_Style_Border $pStyle) {
|
||||||
// Construct HTML
|
// Construct HTML
|
||||||
$css = '';
|
$css = '';
|
||||||
|
|
||||||
// Create CSS
|
// Create CSS
|
||||||
$borderWidth = $this->_mapBorderStyle($pStyle->getBorderStyle());
|
$css .= $this->_mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB();
|
||||||
if (($borderWidth == '0px') && ($this->_isPdf)) {
|
|
||||||
// tcPDF treats a 0px border with a colour of black as a thick black border, so we set the colour to the
|
|
||||||
// background colour for the cell if we're generating PDF output
|
|
||||||
$bValue = $fill->getFillType() == PHPExcel_Style_Fill::FILL_NONE ? 'FFFFFF' : $fill->getStartColor()->getRGB();
|
|
||||||
$css .= $borderWidth . ' #' . $bValue;
|
|
||||||
} else {
|
|
||||||
$css .= $borderWidth . ' #' . $pStyle->getColor()->getRGB();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
return $css;
|
return $css;
|
||||||
@ -943,7 +935,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
// Sheet index
|
// Sheet index
|
||||||
$sheetIndex = $pSheet->getParent()->getIndex($pSheet);
|
$sheetIndex = $pSheet->getParent()->getIndex($pSheet);
|
||||||
|
|
||||||
// TCPDF and breaks
|
// DomPDF and breaks
|
||||||
if ($this->_isPdf && count($pSheet->getBreaks()) > 0) {
|
if ($this->_isPdf && count($pSheet->getBreaks()) > 0) {
|
||||||
$breaks = $pSheet->getBreaks();
|
$breaks = $pSheet->getBreaks();
|
||||||
|
|
||||||
@ -953,7 +945,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
$html .= $this->_generateTableFooter();
|
$html .= $this->_generateTableFooter();
|
||||||
|
|
||||||
// insert page break
|
// insert page break
|
||||||
$html .= '<tcpdf method="AddPage" />';
|
$html .= '<div style="page-break-before:always" />';
|
||||||
|
|
||||||
// open table again: <table> + <col> etc.
|
// open table again: <table> + <col> etc.
|
||||||
$html .= $this->_generateTableHeader($pSheet);
|
$html .= $this->_generateTableHeader($pSheet);
|
||||||
@ -1039,6 +1031,11 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
array($this, 'formatColor')
|
array($this, 'formatColor')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if ($pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() )->getFont()->getSuperScript()) {
|
||||||
|
$cellData = '<sup>'.$cellData.'</sup>';
|
||||||
|
} elseif ($pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() )->getFont()->getSubScript()) {
|
||||||
|
$cellData = '<sub>'.$cellData.'</sub>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Converts the cell content so that spaces occuring at beginning of each new line are replaced by
|
// Converts the cell content so that spaces occuring at beginning of each new line are replaced by
|
||||||
|
Loading…
Reference in New Issue
Block a user