mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-22 21:36:05 +03:00
Minor performance tweaks to the HTML Writer
git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@63829 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
parent
06bfeaaea0
commit
dbcd7fb1af
@ -986,7 +986,6 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
||||
}
|
||||
$colSpan = 1;
|
||||
$rowSpan = 1;
|
||||
$writeCell = true; // Write cell
|
||||
|
||||
// initialize
|
||||
$cellData = '';
|
||||
@ -1042,11 +1041,12 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
||||
}
|
||||
}
|
||||
|
||||
// replace leading spaces on each line with
|
||||
$cellData = $this->_convertNbsp($cellData);
|
||||
// Converts the cell content so that spaces occuring at beginning of each new line are replaced by
|
||||
// Example: " Hello\n to the world" is converted to " Hello\n to the world"
|
||||
$cellData = preg_replace("/(?m)(?:^|\\G) /", ' ', $cellData);
|
||||
|
||||
// convert newline "\n" to '<br>'
|
||||
$cellData = str_replace("\n", '<br/>', $cellData);
|
||||
$cellData = nl2br($cellData);
|
||||
|
||||
// Extend CSS class?
|
||||
if (!$this->_useInlineCss) {
|
||||
@ -1222,28 +1222,6 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a string so that spaces occuring at beginning of each new line are replaced by
|
||||
* Example: " Hello\n to the world" is converted to " Hello\n to the world"
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return string
|
||||
*/
|
||||
private function _convertNbsp($pValue = '')
|
||||
{
|
||||
$explodes = explode("\n", $pValue);
|
||||
foreach ($explodes as $explode) {
|
||||
$matches = array();
|
||||
if (preg_match('/^( )+/', $explode, $matches)) {
|
||||
$explode = str_repeat(' ', strlen($matches[0])) . substr($explode, strlen($matches[0]));
|
||||
}
|
||||
$implodes[] = $explode;
|
||||
}
|
||||
|
||||
$string = implode("\n", $implodes);
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add color to formatted string as inline style
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user