Bugfix: Work item GH-104 - echo statements in HTML.php

This commit is contained in:
Mark Baker 2012-12-11 21:55:46 +00:00
parent 62bf1b7a93
commit d13ca1f790
2 changed files with 42 additions and 41 deletions

View File

@ -201,7 +201,7 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
// Simple String content // Simple String content
if (trim($cellContent) > '') { if (trim($cellContent) > '') {
// Only actually write it if there's content in the string // Only actually write it if there's content in the string
echo 'FLUSH CELL: ' , $column , $row , ' => ' , $cellContent , '<br />'; // echo 'FLUSH CELL: ' , $column , $row , ' => ' , $cellContent , '<br />';
// Write to worksheet to be done here... // Write to worksheet to be done here...
// ... we return the cell so we can mess about with styles more easily // ... we return the cell so we can mess about with styles more easily
$cell = $sheet->setCellValue($column.$row,$cellContent,true); $cell = $sheet->setCellValue($column.$row,$cellContent,true);
@ -227,11 +227,11 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
// TODO // TODO
} }
} elseif($child instanceof DOMElement) { } elseif($child instanceof DOMElement) {
echo '<b>DOM ELEMENT: </b>' , strtoupper($child->nodeName) , '<br />'; // echo '<b>DOM ELEMENT: </b>' , strtoupper($child->nodeName) , '<br />';
$attributeArray = array(); $attributeArray = array();
foreach($child->attributes as $attribute) { foreach($child->attributes as $attribute) {
echo '<b>ATTRIBUTE: </b>' , $attribute->name , ' => ' , $attribute->value , '<br />'; // echo '<b>ATTRIBUTE: </b>' , $attribute->name , ' => ' , $attribute->value , '<br />';
$attributeArray[$attribute->name] = $attribute->value; $attributeArray[$attribute->name] = $attribute->value;
} }
@ -259,13 +259,13 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
case 'em' : case 'em' :
case 'strong': case 'strong':
case 'b' : case 'b' :
echo 'STYLING, SPAN OR DIV<br />'; // echo 'STYLING, SPAN OR DIV<br />';
if ($cellContent > '') if ($cellContent > '')
$cellContent .= ' '; $cellContent .= ' ';
$this->_processDomElement($child,$sheet,$row,$column,$cellContent); $this->_processDomElement($child,$sheet,$row,$column,$cellContent);
if ($cellContent > '') if ($cellContent > '')
$cellContent .= ' '; $cellContent .= ' ';
echo 'END OF STYLING, SPAN OR DIV<br />'; // echo 'END OF STYLING, SPAN OR DIV<br />';
break; break;
case 'hr' : case 'hr' :
$this->_flushCell($sheet,$column,$row,$cellContent); $this->_flushCell($sheet,$column,$row,$cellContent);
@ -286,14 +286,14 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
$this->_flushCell($sheet,$column,$row,$cellContent); $this->_flushCell($sheet,$column,$row,$cellContent);
++$row; ++$row;
} }
echo 'HARD LINE BREAK: ' , '<br />'; // echo 'HARD LINE BREAK: ' , '<br />';
break; break;
case 'a' : case 'a' :
echo 'START OF HYPERLINK: ' , '<br />'; // echo 'START OF HYPERLINK: ' , '<br />';
foreach($attributeArray as $attributeName => $attributeValue) { foreach($attributeArray as $attributeName => $attributeValue) {
switch($attributeName) { switch($attributeName) {
case 'href': case 'href':
echo 'Link to ' , $attributeValue , '<br />'; // echo 'Link to ' , $attributeValue , '<br />';
$sheet->getCell($column.$row)->getHyperlink()->setUrl($attributeValue); $sheet->getCell($column.$row)->getHyperlink()->setUrl($attributeValue);
if (isset($this->_formats[$child->nodeName])) { if (isset($this->_formats[$child->nodeName])) {
$sheet->getStyle($column.$row)->applyFromArray($this->_formats[$child->nodeName]); $sheet->getStyle($column.$row)->applyFromArray($this->_formats[$child->nodeName]);
@ -303,7 +303,7 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
} }
$cellContent .= ' '; $cellContent .= ' ';
$this->_processDomElement($child,$sheet,$row,$column,$cellContent); $this->_processDomElement($child,$sheet,$row,$column,$cellContent);
echo 'END OF HYPERLINK:' , '<br />'; // echo 'END OF HYPERLINK:' , '<br />';
break; break;
case 'h1' : case 'h1' :
case 'h2' : case 'h2' :
@ -317,17 +317,17 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
if ($this->_tableLevel > 0) { if ($this->_tableLevel > 0) {
// If we're inside a table, replace with a \n // If we're inside a table, replace with a \n
$cellContent .= "\n"; $cellContent .= "\n";
echo 'LIST ENTRY: ' , '<br />'; // echo 'LIST ENTRY: ' , '<br />';
$this->_processDomElement($child,$sheet,$row,$column,$cellContent); $this->_processDomElement($child,$sheet,$row,$column,$cellContent);
echo 'END OF LIST ENTRY:' , '<br />'; // echo 'END OF LIST ENTRY:' , '<br />';
} else { } else {
if ($cellContent > '') { if ($cellContent > '') {
$this->_flushCell($sheet,$column,$row,$cellContent); $this->_flushCell($sheet,$column,$row,$cellContent);
$row += 2; $row += 2;
} }
echo 'START OF PARAGRAPH: ' , '<br />'; // echo 'START OF PARAGRAPH: ' , '<br />';
$this->_processDomElement($child,$sheet,$row,$column,$cellContent); $this->_processDomElement($child,$sheet,$row,$column,$cellContent);
echo 'END OF PARAGRAPH:' , '<br />'; // echo 'END OF PARAGRAPH:' , '<br />';
$this->_flushCell($sheet,$column,$row,$cellContent); $this->_flushCell($sheet,$column,$row,$cellContent);
if (isset($this->_formats[$child->nodeName])) { if (isset($this->_formats[$child->nodeName])) {
@ -342,17 +342,17 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
if ($this->_tableLevel > 0) { if ($this->_tableLevel > 0) {
// If we're inside a table, replace with a \n // If we're inside a table, replace with a \n
$cellContent .= "\n"; $cellContent .= "\n";
echo 'LIST ENTRY: ' , '<br />'; // echo 'LIST ENTRY: ' , '<br />';
$this->_processDomElement($child,$sheet,$row,$column,$cellContent); $this->_processDomElement($child,$sheet,$row,$column,$cellContent);
echo 'END OF LIST ENTRY:' , '<br />'; // echo 'END OF LIST ENTRY:' , '<br />';
} else { } else {
if ($cellContent > '') { if ($cellContent > '') {
$this->_flushCell($sheet,$column,$row,$cellContent); $this->_flushCell($sheet,$column,$row,$cellContent);
} }
++$row; ++$row;
echo 'LIST ENTRY: ' , '<br />'; // echo 'LIST ENTRY: ' , '<br />';
$this->_processDomElement($child,$sheet,$row,$column,$cellContent); $this->_processDomElement($child,$sheet,$row,$column,$cellContent);
echo 'END OF LIST ENTRY:' , '<br />'; // echo 'END OF LIST ENTRY:' , '<br />';
$this->_flushCell($sheet,$column,$row,$cellContent); $this->_flushCell($sheet,$column,$row,$cellContent);
$column = 'A'; $column = 'A';
} }
@ -360,11 +360,11 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
case 'table' : case 'table' :
$this->_flushCell($sheet,$column,$row,$cellContent); $this->_flushCell($sheet,$column,$row,$cellContent);
$column = $this->_setTableStartColumn($column); $column = $this->_setTableStartColumn($column);
echo 'START OF TABLE LEVEL ' , $this->_tableLevel , '<br />'; // echo 'START OF TABLE LEVEL ' , $this->_tableLevel , '<br />';
if ($this->_tableLevel > 1) if ($this->_tableLevel > 1)
--$row; --$row;
$this->_processDomElement($child,$sheet,$row,$column,$cellContent); $this->_processDomElement($child,$sheet,$row,$column,$cellContent);
echo 'END OF TABLE LEVEL ' , $this->_tableLevel , '<br />'; // echo 'END OF TABLE LEVEL ' , $this->_tableLevel , '<br />';
$column = $this->_releaseTableStartColumn(); $column = $this->_releaseTableStartColumn();
if ($this->_tableLevel > 1) { if ($this->_tableLevel > 1) {
++$column; ++$column;
@ -380,15 +380,15 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
++$row; ++$row;
$column = $this->_getTableStartColumn(); $column = $this->_getTableStartColumn();
$cellContent = ''; $cellContent = '';
echo 'START OF TABLE ' , $this->_tableLevel , ' ROW<br />'; // echo 'START OF TABLE ' , $this->_tableLevel , ' ROW<br />';
$this->_processDomElement($child,$sheet,$row,$column,$cellContent); $this->_processDomElement($child,$sheet,$row,$column,$cellContent);
echo 'END OF TABLE ' , $this->_tableLevel , ' ROW<br />'; // echo 'END OF TABLE ' , $this->_tableLevel , ' ROW<br />';
break; break;
case 'th' : case 'th' :
case 'td' : case 'td' :
echo 'START OF TABLE ' , $this->_tableLevel , ' CELL<br />'; // echo 'START OF TABLE ' , $this->_tableLevel , ' CELL<br />';
$this->_processDomElement($child,$sheet,$row,$column,$cellContent); $this->_processDomElement($child,$sheet,$row,$column,$cellContent);
echo 'END OF TABLE ' , $this->_tableLevel , ' CELL<br />'; // echo 'END OF TABLE ' , $this->_tableLevel , ' CELL<br />';
$this->_flushCell($sheet,$column,$row,$cellContent); $this->_flushCell($sheet,$column,$row,$cellContent);
++$column; ++$column;
break; break;
@ -448,8 +448,8 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
$content = ''; $content = '';
$this->_processDomElement($dom,$objPHPExcel->getActiveSheet(),$row,$column,$content); $this->_processDomElement($dom,$objPHPExcel->getActiveSheet(),$row,$column,$content);
echo '<hr />'; // echo '<hr />';
var_dump($this->_dataArray); // var_dump($this->_dataArray);
// Return // Return
return $objPHPExcel; return $objPHPExcel;

View File

@ -26,24 +26,25 @@
Fixed in develop branch: Fixed in develop branch:
- Feature: (MBaker) Include charts option for HTML Writer - Feature: (MBaker) Include charts option for HTML Writer
- Feature: (MBaker) Added composer file - Feature: (MBaker) Added composer file
- Bugfix: (Asker) Work item 18777 - Error in PHPEXCEL/Calculation.php script on line 2976 (stack pop check) - Bugfix: (Asker) Work item 18777 - Error in PHPEXCEL/Calculation.php script on line 2976 (stack pop check)
- Bugfix: (MBaker) Work item 18794 - CSV files without a file extension being identified as HTML - Bugfix: (MBaker) Work item 18794 - CSV files without a file extension being identified as HTML
- Bugfix: (AndreKR) Work item GH-66 - Wrong check for maximum number of rows in Excel5 Writer - Bugfix: (AndreKR) Work item GH-66 - Wrong check for maximum number of rows in Excel5 Writer
- Bugfix: (MBaker) Work item GH-67 - Cache directory for DiscISAM cache storage cannot be set - Bugfix: (MBaker) Work item GH-67 - Cache directory for DiscISAM cache storage cannot be set
- Bugfix: (MBaker) Work item 17976 - Fix to Excel2007 Reader for hyperlinks with an anchor fragment (following a #), otherwise they were treated as sheet references - Bugfix: (MBaker) Work item 17976 - Fix to Excel2007 Reader for hyperlinks with an anchor fragment (following a #), otherwise they were treated as sheet references
- Bugfix: (MBaker) Work item 18963 - getSheetNames() fails on numeric (floating point style) names with trailing zeroes - Bugfix: (MBaker) Work item 18963 - getSheetNames() fails on numeric (floating point style) names with trailing zeroes
- General: (kea) Work item GH-69 - Improved AdvancedValueBinder for currency - General: (kea) Work item GH-69 - Improved AdvancedValueBinder for currency
- General: (MBaker) Work items 17936 and 17840 - Fix for environments where there is no access to /tmp but to upload_tmp_dir - General: (MBaker) Work items 17936 and 17840 - Fix for environments where there is no access to /tmp but to upload_tmp_dir
Provided an option to set the sys_get_temp_dir() call to use the upload_tmp_dir; though by default the standard temp directory will still be used Provided an option to set the sys_get_temp_dir() call to use the upload_tmp_dir; though by default the standard temp directory will still be used
- General: (amironov ) Work item GH-84 - Search style by identity in PHPExcel_Worksheet::duplicateStyle() - General: (amironov ) Work item GH-84 - Search style by identity in PHPExcel_Worksheet::duplicateStyle()
- General: (karak) Work item GH-85 - Fill SheetView IO in Excel5 - General: (karak) Work item GH-85 - Fill SheetView IO in Excel5
- General: (cfhay) Work item 18958 - Memory and Speed improvements in PHPExcel_Reader_Excel5 - General: (cfhay) Work item 18958 - Memory and Speed improvements in PHPExcel_Reader_Excel5
- Bugfix: (techhead) Work item GH-70 - Fixed formula/formatting bug when removing rows - Bugfix: (techhead) Work item GH-70 - Fixed formula/formatting bug when removing rows
- Bugfix: (alexgann) Work item GH-63 - Fix to cellExists for non-existent namedRanges - Bugfix: (alexgann) Work item GH-63 - Fix to cellExists for non-existent namedRanges
- Bugfix: (MBaker) Work item 18844 - cache_in_memory_gzip "eats" last worksheet line, cache_in_memory doesn't - Bugfix: (MBaker) Work item 18844 - cache_in_memory_gzip "eats" last worksheet line, cache_in_memory doesn't
- Bugfix: (Progi1984) Work item GH-22 - Sheet View in Excel5 Writer - Bugfix: (Progi1984) Work item GH-22 - Sheet View in Excel5 Writer
- Bugfix: (amironov) Work item GH-82 - PHPExcel_Worksheet::getCellCollection() may not return last cached cell - Bugfix: (amironov) Work item GH-82 - PHPExcel_Worksheet::getCellCollection() may not return last cached cell
- Bugfix: (teso) Work item 18551 - Rich Text containing UTF-8 characters creating unreadable content with Excel5 Writer - Bugfix: (teso) Work item 18551 - Rich Text containing UTF-8 characters creating unreadable content with Excel5 Writer
- Bugfix: (MBaker) Work item GH-104 - echo statements in HTML.php
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------