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

@ -44,6 +44,7 @@ Fixed in develop branch:
- 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
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------