mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-26 15:26:03 +03:00
Minor performance tweaks
git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@63697 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
parent
51dc3403ff
commit
270ea1df05
@ -19,10 +19,10 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Writer
|
* @package PHPExcel_Writer
|
||||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -30,7 +30,7 @@
|
|||||||
* PHPExcel_Writer_CSV
|
* PHPExcel_Writer_CSV
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Writer
|
* @package PHPExcel_Writer
|
||||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Writer_CSV implements PHPExcel_Writer_IWriter {
|
class PHPExcel_Writer_CSV implements PHPExcel_Writer_IWriter {
|
||||||
@ -86,21 +86,21 @@ class PHPExcel_Writer_CSV implements PHPExcel_Writer_IWriter {
|
|||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Writer_CSV
|
* Create a new PHPExcel_Writer_CSV
|
||||||
*
|
*
|
||||||
* @param PHPExcel $phpExcel PHPExcel object
|
* @param PHPExcel $phpExcel PHPExcel object
|
||||||
*/
|
*/
|
||||||
public function __construct(PHPExcel $phpExcel) {
|
public function __construct(PHPExcel $phpExcel) {
|
||||||
$this->_phpExcel = $phpExcel;
|
$this->_phpExcel = $phpExcel;
|
||||||
$this->_delimiter = ',';
|
$this->_delimiter = ',';
|
||||||
$this->_enclosure = '"';
|
$this->_enclosure = '"';
|
||||||
$this->_lineEnding = PHP_EOL;
|
$this->_lineEnding = PHP_EOL;
|
||||||
$this->_sheetIndex = 0;
|
$this->_sheetIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save PHPExcel to file
|
* Save PHPExcel to file
|
||||||
*
|
*
|
||||||
* @param string $pFileName
|
* @param string $pFileName
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function save($pFilename = null) {
|
public function save($pFilename = null) {
|
||||||
// Fetch sheet
|
// Fetch sheet
|
||||||
@ -112,7 +112,7 @@ class PHPExcel_Writer_CSV implements PHPExcel_Writer_IWriter {
|
|||||||
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
|
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
$fileHandle = fopen($pFilename, 'w');
|
$fileHandle = fopen($pFilename, 'wb+');
|
||||||
if ($fileHandle === false) {
|
if ($fileHandle === false) {
|
||||||
throw new Exception("Could not open file $pFilename for writing.");
|
throw new Exception("Could not open file $pFilename for writing.");
|
||||||
}
|
}
|
||||||
@ -280,23 +280,23 @@ class PHPExcel_Writer_CSV implements PHPExcel_Writer_IWriter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Pre-Calculate Formulas
|
* Get Pre-Calculate Formulas
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getPreCalculateFormulas() {
|
public function getPreCalculateFormulas() {
|
||||||
return $this->_preCalculateFormulas;
|
return $this->_preCalculateFormulas;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Pre-Calculate Formulas
|
* Set Pre-Calculate Formulas
|
||||||
*
|
*
|
||||||
* @param boolean $pValue Pre-Calculate Formulas?
|
* @param boolean $pValue Pre-Calculate Formulas?
|
||||||
* @return PHPExcel_Writer_CSV
|
* @return PHPExcel_Writer_CSV
|
||||||
*/
|
*/
|
||||||
public function setPreCalculateFormulas($pValue = true) {
|
public function setPreCalculateFormulas($pValue = true) {
|
||||||
$this->_preCalculateFormulas = $pValue;
|
$this->_preCalculateFormulas = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Writer
|
* @package PHPExcel_Writer
|
||||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -30,7 +30,7 @@
|
|||||||
* PHPExcel_Writer_HTML
|
* PHPExcel_Writer_HTML
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Writer
|
* @package PHPExcel_Writer
|
||||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
||||||
@ -135,7 +135,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Writer_HTML
|
* Create a new PHPExcel_Writer_HTML
|
||||||
*
|
*
|
||||||
* @param PHPExcel $phpExcel PHPExcel object
|
* @param PHPExcel $phpExcel PHPExcel object
|
||||||
*/
|
*/
|
||||||
public function __construct(PHPExcel $phpExcel) {
|
public function __construct(PHPExcel $phpExcel) {
|
||||||
$this->_phpExcel = $phpExcel;
|
$this->_phpExcel = $phpExcel;
|
||||||
@ -145,15 +145,15 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
|
|
||||||
$this->_spansAreCalculated = false;
|
$this->_spansAreCalculated = false;
|
||||||
$this->_isSpannedCell = array();
|
$this->_isSpannedCell = array();
|
||||||
$this->_isBaseCell = array();
|
$this->_isBaseCell = array();
|
||||||
$this->_isSpannedRow = array();
|
$this->_isSpannedRow = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save PHPExcel to file
|
* Save PHPExcel to file
|
||||||
*
|
*
|
||||||
* @param string $pFileName
|
* @param string $pFileName
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function save($pFilename = null) {
|
public function save($pFilename = null) {
|
||||||
// garbage collect
|
// garbage collect
|
||||||
@ -168,7 +168,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
$this->buildCSS(!$this->_useInlineCss);
|
$this->buildCSS(!$this->_useInlineCss);
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
$fileHandle = fopen($pFilename, 'w');
|
$fileHandle = fopen($pFilename, 'wb+');
|
||||||
if ($fileHandle === false) {
|
if ($fileHandle === false) {
|
||||||
throw new Exception("Could not open file $pFilename for writing.");
|
throw new Exception("Could not open file $pFilename for writing.");
|
||||||
}
|
}
|
||||||
@ -313,8 +313,8 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
$html .= '<!-- Generated by PHPExcel - http://www.phpexcel.net -->' . "\r\n";
|
$html .= '<!-- Generated by PHPExcel - http://www.phpexcel.net -->' . "\r\n";
|
||||||
$html .= '<html>' . "\r\n";
|
$html .= '<html>' . "\r\n";
|
||||||
$html .= ' <head>' . "\r\n";
|
$html .= ' <head>' . "\r\n";
|
||||||
$html .= ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . "\r\n";
|
$html .= ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . "\r\n";
|
||||||
$html .= ' <title>' . htmlspecialchars($this->_phpExcel->getProperties()->getTitle()) . '</title>' . "\r\n";
|
$html .= ' <title>' . htmlspecialchars($this->_phpExcel->getProperties()->getTitle()) . '</title>' . "\r\n";
|
||||||
if ($pIncludeStyles) {
|
if ($pIncludeStyles) {
|
||||||
$html .= $this->generateStyles(true);
|
$html .= $this->generateStyles(true);
|
||||||
}
|
}
|
||||||
@ -360,20 +360,20 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
// Write table header
|
// Write table header
|
||||||
$html .= $this->_generateTableHeader($sheet);
|
$html .= $this->_generateTableHeader($sheet);
|
||||||
|
|
||||||
// Get worksheet dimension
|
// Get worksheet dimension
|
||||||
$dimension = explode(':', $sheet->calculateWorksheetDimension());
|
$dimension = explode(':', $sheet->calculateWorksheetDimension());
|
||||||
$dimension[0] = PHPExcel_Cell::coordinateFromString($dimension[0]);
|
$dimension[0] = PHPExcel_Cell::coordinateFromString($dimension[0]);
|
||||||
$dimension[0][0] = PHPExcel_Cell::columnIndexFromString($dimension[0][0]) - 1;
|
$dimension[0][0] = PHPExcel_Cell::columnIndexFromString($dimension[0][0]) - 1;
|
||||||
$dimension[1] = PHPExcel_Cell::coordinateFromString($dimension[1]);
|
$dimension[1] = PHPExcel_Cell::coordinateFromString($dimension[1]);
|
||||||
$dimension[1][0] = PHPExcel_Cell::columnIndexFromString($dimension[1][0]) - 1;
|
$dimension[1][0] = PHPExcel_Cell::columnIndexFromString($dimension[1][0]) - 1;
|
||||||
|
|
||||||
// row min,max
|
// row min,max
|
||||||
$rowMin = $dimension[0][1];
|
$rowMin = $dimension[0][1];
|
||||||
$rowMax = $dimension[1][1];
|
$rowMax = $dimension[1][1];
|
||||||
|
|
||||||
// calculate start of <tbody>, <thead>
|
// calculate start of <tbody>, <thead>
|
||||||
$tbodyStart = $rowMin;
|
$tbodyStart = $rowMin;
|
||||||
$tbodyEnd = $rowMax;
|
$tbodyEnd = $rowMax;
|
||||||
$theadStart = 0; // default: no <thead>
|
$theadStart = 0; // default: no <thead>
|
||||||
$theadEnd = 0; // default: no </thead>
|
$theadEnd = 0; // default: no </thead>
|
||||||
if ($sheet->getPageSetup()->isRowsToRepeatAtTopSet()) {
|
if ($sheet->getPageSetup()->isRowsToRepeatAtTopSet()) {
|
||||||
@ -388,29 +388,29 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Loop through cells
|
// Loop through cells
|
||||||
$rowData = null;
|
$rowData = null;
|
||||||
for ($row = $rowMin; $row <= $rowMax; ++$row) {
|
for ($row = $rowMin; $row <= $rowMax; ++$row) {
|
||||||
// Start a new row
|
// Start a new row
|
||||||
$rowData = array();
|
$rowData = array();
|
||||||
|
|
||||||
// Loop through columns
|
// Loop through columns
|
||||||
for ($column = $dimension[0][0]; $column <= $dimension[1][0]; ++$column) {
|
for ($column = $dimension[0][0]; $column <= $dimension[1][0]; ++$column) {
|
||||||
// Cell exists?
|
// Cell exists?
|
||||||
if ($sheet->cellExistsByColumnAndRow($column, $row)) {
|
if ($sheet->cellExistsByColumnAndRow($column, $row)) {
|
||||||
$rowData[$column] = $cell = $sheet->getCellByColumnAndRow($column, $row);
|
$rowData[$column] = $cell = $sheet->getCellByColumnAndRow($column, $row);
|
||||||
} else {
|
} else {
|
||||||
$rowData[$column] = '';
|
$rowData[$column] = '';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// <thead> ?
|
|
||||||
if ($row == $theadStart) {
|
|
||||||
$html .= ' <thead>' . "\r\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// <tbody> ?
|
// <thead> ?
|
||||||
|
if ($row == $theadStart) {
|
||||||
|
$html .= ' <thead>' . "\r\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// <tbody> ?
|
||||||
if ($row == $tbodyStart) {
|
if ($row == $tbodyStart) {
|
||||||
$html .= ' <tbody>' . "\r\n";
|
$html .= ' <tbody>' . "\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write row if there are HTML table cells in it
|
// Write row if there are HTML table cells in it
|
||||||
@ -418,16 +418,16 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
$html .= $this->_generateRow($sheet, $rowData, $row - 1);
|
$html .= $this->_generateRow($sheet, $rowData, $row - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// </thead> ?
|
// </thead> ?
|
||||||
if ($row == $theadEnd) {
|
if ($row == $theadEnd) {
|
||||||
$html .= ' </thead>' . "\r\n";
|
$html .= ' </thead>' . "\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// </tbody> ?
|
// </tbody> ?
|
||||||
if ($row == $tbodyEnd) {
|
if ($row == $tbodyEnd) {
|
||||||
$html .= ' </tbody>' . "\r\n";
|
$html .= ' </tbody>' . "\r\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write table footer
|
// Write table footer
|
||||||
$html .= $this->_generateTableFooter();
|
$html .= $this->_generateTableFooter();
|
||||||
@ -493,7 +493,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
/**
|
/**
|
||||||
* Generate image tag in cell
|
* Generate image tag in cell
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet $pSheet PHPExcel_Worksheet
|
* @param PHPExcel_Worksheet $pSheet PHPExcel_Worksheet
|
||||||
* @param string $coordinates Cell coordinates
|
* @param string $coordinates Cell coordinates
|
||||||
* @return string
|
* @return string
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
@ -525,7 +525,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
$filename = htmlspecialchars($filename);
|
$filename = htmlspecialchars($filename);
|
||||||
|
|
||||||
$html .= "\r\n";
|
$html .= "\r\n";
|
||||||
$html .= ' <img style="position: relative; left: ' . $drawing->getOffsetX() . 'px; top: ' . $drawing->getOffsetY() . 'px; width: ' . $drawing->getWidth() . 'px; height: ' . $drawing->getHeight() . 'px;" src="' . $filename . '" border="0" width="' . $drawing->getWidth() . '" height="' . $drawing->getHeight() . '" />' . "\r\n";
|
$html .= ' <img style="position: relative; left: ' . $drawing->getOffsetX() . 'px; top: ' . $drawing->getOffsetY() . 'px; width: ' . $drawing->getWidth() . 'px; height: ' . $drawing->getHeight() . 'px;" src="' . $filename . '" border="0" width="' . $drawing->getWidth() . '" height="' . $drawing->getHeight() . '" />' . "\r\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -555,20 +555,20 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
|
|
||||||
// Start styles
|
// Start styles
|
||||||
if ($generateSurroundingHTML) {
|
if ($generateSurroundingHTML) {
|
||||||
$html .= ' <style type="text/css">' . "\r\n";
|
$html .= ' <style type="text/css">' . "\r\n";
|
||||||
$html .= ' html { ' . $this->_assembleCSS($css['html']) . ' }' . "\r\n";
|
$html .= ' html { ' . $this->_assembleCSS($css['html']) . ' }' . "\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write all other styles
|
// Write all other styles
|
||||||
foreach ($css as $styleName => $styleDefinition) {
|
foreach ($css as $styleName => $styleDefinition) {
|
||||||
if ($styleName != 'html') {
|
if ($styleName != 'html') {
|
||||||
$html .= ' ' . $styleName . ' { ' . $this->_assembleCSS($styleDefinition) . ' }' . "\r\n";
|
$html .= ' ' . $styleName . ' { ' . $this->_assembleCSS($styleDefinition) . ' }' . "\r\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// End styles
|
// End styles
|
||||||
if ($generateSurroundingHTML) {
|
if ($generateSurroundingHTML) {
|
||||||
$html .= ' </style>' . "\r\n";
|
$html .= ' </style>' . "\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
@ -604,8 +604,8 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
// Start styles
|
// Start styles
|
||||||
if ($generateSurroundingHTML) {
|
if ($generateSurroundingHTML) {
|
||||||
// html { }
|
// html { }
|
||||||
$css['html']['font-family'] = 'Calibri, Arial, Helvetica, sans-serif';
|
$css['html']['font-family'] = 'Calibri, Arial, Helvetica, sans-serif';
|
||||||
$css['html']['font-size'] = '11pt';
|
$css['html']['font-size'] = '11pt';
|
||||||
$css['html']['background-color'] = 'white';
|
$css['html']['background-color'] = 'white';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -692,7 +692,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
}
|
}
|
||||||
$css['table.sheet' . $sheetIndex . ' tr']['height'] = $pt_height . 'pt';
|
$css['table.sheet' . $sheetIndex . ' tr']['height'] = $pt_height . 'pt';
|
||||||
if ($rowDimension->getVisible() === false) {
|
if ($rowDimension->getVisible() === false) {
|
||||||
$css['table.sheet' . $sheetIndex . ' tr']['display'] = 'none';
|
$css['table.sheet' . $sheetIndex . ' tr']['display'] = 'none';
|
||||||
$css['table.sheet' . $sheetIndex . ' tr']['visibility'] = 'hidden';
|
$css['table.sheet' . $sheetIndex . ' tr']['visibility'] = 'hidden';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -728,7 +728,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
/**
|
/**
|
||||||
* Create CSS style
|
* Create CSS style
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Style $pStyle PHPExcel_Style
|
* @param PHPExcel_Style $pStyle PHPExcel_Style
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function _createCSSStyle(PHPExcel_Style $pStyle) {
|
private function _createCSSStyle(PHPExcel_Style $pStyle) {
|
||||||
@ -750,7 +750,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
/**
|
/**
|
||||||
* Create CSS style (PHPExcel_Style_Alignment)
|
* Create CSS style (PHPExcel_Style_Alignment)
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Style_Alignment $pStyle PHPExcel_Style_Alignment
|
* @param PHPExcel_Style_Alignment $pStyle PHPExcel_Style_Alignment
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function _createCSSStyleAlignment(PHPExcel_Style_Alignment $pStyle) {
|
private function _createCSSStyleAlignment(PHPExcel_Style_Alignment $pStyle) {
|
||||||
@ -770,7 +770,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
/**
|
/**
|
||||||
* Create CSS style (PHPExcel_Style_Font)
|
* Create CSS style (PHPExcel_Style_Font)
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Style_Font $pStyle PHPExcel_Style_Font
|
* @param PHPExcel_Style_Font $pStyle PHPExcel_Style_Font
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function _createCSSStyleFont(PHPExcel_Style_Font $pStyle) {
|
private function _createCSSStyleFont(PHPExcel_Style_Font $pStyle) {
|
||||||
@ -803,7 +803,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
/**
|
/**
|
||||||
* Create CSS style (PHPExcel_Style_Borders)
|
* Create CSS style (PHPExcel_Style_Borders)
|
||||||
*
|
*
|
||||||
* @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) {
|
private function _createCSSStyleBorders(PHPExcel_Style_Borders $pStyle) {
|
||||||
@ -872,7 +872,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
/**
|
/**
|
||||||
* Generate table header
|
* Generate table header
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet $pSheet The worksheet for the table we are writing
|
* @param PHPExcel_Worksheet $pSheet The worksheet for the table we are writing
|
||||||
* @return string
|
* @return string
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@ -884,15 +884,15 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
|
|
||||||
if (!$this->_useInlineCss) {
|
if (!$this->_useInlineCss) {
|
||||||
$gridlines = $pSheet->getShowGridLines() ? ' gridlines' : '';
|
$gridlines = $pSheet->getShowGridLines() ? ' gridlines' : '';
|
||||||
$html .= ' <table border="0" cellpadding="0" cellspacing="0" id="sheet' . $sheetIndex . '" class="sheet' . $sheetIndex . $gridlines . '">' . "\r\n";
|
$html .= ' <table border="0" cellpadding="0" cellspacing="0" id="sheet' . $sheetIndex . '" class="sheet' . $sheetIndex . $gridlines . '">' . "\r\n";
|
||||||
} else {
|
} else {
|
||||||
$style = isset($this->_cssStyles['table']) ?
|
$style = isset($this->_cssStyles['table']) ?
|
||||||
$this->_assembleCSS($this->_cssStyles['table']) : '';
|
$this->_assembleCSS($this->_cssStyles['table']) : '';
|
||||||
|
|
||||||
if ($this->_isPdf && $pSheet->getShowGridLines()) {
|
if ($this->_isPdf && $pSheet->getShowGridLines()) {
|
||||||
$html .= ' <table border="1" cellpadding="0" id="sheet' . $sheetIndex . '" cellspacing="0" style="' . $style . '">' . "\r\n";
|
$html .= ' <table border="1" cellpadding="0" id="sheet' . $sheetIndex . '" cellspacing="0" style="' . $style . '">' . "\r\n";
|
||||||
} else {
|
} else {
|
||||||
$html .= ' <table border="0" cellpadding="0" id="sheet' . $sheetIndex . '" cellspacing="0" style="' . $style . '">' . "\r\n";
|
$html .= ' <table border="0" cellpadding="0" id="sheet' . $sheetIndex . '" cellspacing="0" style="' . $style . '">' . "\r\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -900,11 +900,11 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn()) - 1;
|
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn()) - 1;
|
||||||
for ($i = 0; $i <= $highestColumnIndex; ++$i) {
|
for ($i = 0; $i <= $highestColumnIndex; ++$i) {
|
||||||
if (!$this->_useInlineCss) {
|
if (!$this->_useInlineCss) {
|
||||||
$html .= ' <col class="col' . $i . '">' . "\r\n";
|
$html .= ' <col class="col' . $i . '">' . "\r\n";
|
||||||
} else {
|
} else {
|
||||||
$style = isset($this->_cssStyles['table.sheet' . $sheetIndex . ' col.col' . $i]) ?
|
$style = isset($this->_cssStyles['table.sheet' . $sheetIndex . ' col.col' . $i]) ?
|
||||||
$this->_assembleCSS($this->_cssStyles['table.sheet' . $sheetIndex . ' col.col' . $i]) : '';
|
$this->_assembleCSS($this->_cssStyles['table.sheet' . $sheetIndex . ' col.col' . $i]) : '';
|
||||||
$html .= ' <col style="' . $style . '">' . "\r\n";
|
$html .= ' <col style="' . $style . '">' . "\r\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -920,7 +920,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
private function _generateTableFooter() {
|
private function _generateTableFooter() {
|
||||||
// Construct HTML
|
// Construct HTML
|
||||||
$html = '';
|
$html = '';
|
||||||
$html .= ' </table>' . "\r\n";
|
$html .= ' </table>' . "\r\n";
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
return $html;
|
return $html;
|
||||||
@ -929,7 +929,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
/**
|
/**
|
||||||
* Generate row
|
* Generate row
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet $pSheet PHPExcel_Worksheet
|
* @param PHPExcel_Worksheet $pSheet PHPExcel_Worksheet
|
||||||
* @param array $pValues Array containing cells in a row
|
* @param array $pValues Array containing cells in a row
|
||||||
* @param int $pRow Row number (0-based)
|
* @param int $pRow Row number (0-based)
|
||||||
* @return string
|
* @return string
|
||||||
@ -962,12 +962,12 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
|
|
||||||
// Write row start
|
// Write row start
|
||||||
if (!$this->_useInlineCss) {
|
if (!$this->_useInlineCss) {
|
||||||
$html .= ' <tr class="row' . $pRow . '">' . "\r\n";
|
$html .= ' <tr class="row' . $pRow . '">' . "\r\n";
|
||||||
} else {
|
} else {
|
||||||
$style = isset($this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow])
|
$style = isset($this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow])
|
||||||
? $this->_assembleCSS($this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]) : '';
|
? $this->_assembleCSS($this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]) : '';
|
||||||
|
|
||||||
$html .= ' <tr style="' . $style . '">' . "\r\n";
|
$html .= ' <tr style="' . $style . '">' . "\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write cells
|
// Write cells
|
||||||
@ -1088,7 +1088,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
// Write
|
// Write
|
||||||
if ($writeCell) {
|
if ($writeCell) {
|
||||||
// Column start
|
// Column start
|
||||||
$html .= ' <td';
|
$html .= ' <td';
|
||||||
if (!$this->_useInlineCss) {
|
if (!$this->_useInlineCss) {
|
||||||
$html .= ' class="' . $cssClass . '"';
|
$html .= ' class="' . $cssClass . '"';
|
||||||
} else {
|
} else {
|
||||||
@ -1136,7 +1136,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write row end
|
// Write row end
|
||||||
$html .= ' </tr>' . "\r\n";
|
$html .= ' </tr>' . "\r\n";
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
return $html;
|
return $html;
|
||||||
@ -1162,65 +1162,65 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Pre-Calculate Formulas
|
* Get Pre-Calculate Formulas
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getPreCalculateFormulas() {
|
public function getPreCalculateFormulas() {
|
||||||
return $this->_preCalculateFormulas;
|
return $this->_preCalculateFormulas;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Pre-Calculate Formulas
|
* Set Pre-Calculate Formulas
|
||||||
*
|
*
|
||||||
* @param boolean $pValue Pre-Calculate Formulas?
|
* @param boolean $pValue Pre-Calculate Formulas?
|
||||||
* @return PHPExcel_Writer_HTML
|
* @return PHPExcel_Writer_HTML
|
||||||
*/
|
*/
|
||||||
public function setPreCalculateFormulas($pValue = true) {
|
public function setPreCalculateFormulas($pValue = true) {
|
||||||
$this->_preCalculateFormulas = $pValue;
|
$this->_preCalculateFormulas = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get images root
|
* Get images root
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getImagesRoot() {
|
public function getImagesRoot() {
|
||||||
return $this->_imagesRoot;
|
return $this->_imagesRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set images root
|
* Set images root
|
||||||
*
|
*
|
||||||
* @param string $pValue
|
* @param string $pValue
|
||||||
* @return PHPExcel_Writer_HTML
|
* @return PHPExcel_Writer_HTML
|
||||||
*/
|
*/
|
||||||
public function setImagesRoot($pValue = '.') {
|
public function setImagesRoot($pValue = '.') {
|
||||||
$this->_imagesRoot = $pValue;
|
$this->_imagesRoot = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get use inline CSS?
|
* Get use inline CSS?
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getUseInlineCss() {
|
public function getUseInlineCss() {
|
||||||
return $this->_useInlineCss;
|
return $this->_useInlineCss;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set use inline CSS?
|
* Set use inline CSS?
|
||||||
*
|
*
|
||||||
* @param boolean $pValue
|
* @param boolean $pValue
|
||||||
* @return PHPExcel_Writer_HTML
|
* @return PHPExcel_Writer_HTML
|
||||||
*/
|
*/
|
||||||
public function setUseInlineCss($pValue = false) {
|
public function setUseInlineCss($pValue = false) {
|
||||||
$this->_useInlineCss = $pValue;
|
$this->_useInlineCss = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a string so that spaces occuring at beginning of each new line are replaced by
|
* Converts a string so that spaces occuring at beginning of each new line are replaced by
|
||||||
|
Loading…
Reference in New Issue
Block a user