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
if (trim($cellContent) > '') {
// 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...
// ... we return the cell so we can mess about with styles more easily
$cell = $sheet->setCellValue($column.$row,$cellContent,true);
@ -227,11 +227,11 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
// TODO
}
} elseif($child instanceof DOMElement) {
echo '<b>DOM ELEMENT: </b>' , strtoupper($child->nodeName) , '<br />';
// echo '<b>DOM ELEMENT: </b>' , strtoupper($child->nodeName) , '<br />';
$attributeArray = array();
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;
}
@ -259,13 +259,13 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
case 'em' :
case 'strong':
case 'b' :
echo 'STYLING, SPAN OR DIV<br />';
// echo 'STYLING, SPAN OR DIV<br />';
if ($cellContent > '')
$cellContent .= ' ';
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
if ($cellContent > '')
$cellContent .= ' ';
echo 'END OF STYLING, SPAN OR DIV<br />';
// echo 'END OF STYLING, SPAN OR DIV<br />';
break;
case 'hr' :
$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);
++$row;
}
echo 'HARD LINE BREAK: ' , '<br />';
// echo 'HARD LINE BREAK: ' , '<br />';
break;
case 'a' :
echo 'START OF HYPERLINK: ' , '<br />';
// echo 'START OF HYPERLINK: ' , '<br />';
foreach($attributeArray as $attributeName => $attributeValue) {
switch($attributeName) {
case 'href':
echo 'Link to ' , $attributeValue , '<br />';
// echo 'Link to ' , $attributeValue , '<br />';
$sheet->getCell($column.$row)->getHyperlink()->setUrl($attributeValue);
if (isset($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 .= ' ';
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
echo 'END OF HYPERLINK:' , '<br />';
// echo 'END OF HYPERLINK:' , '<br />';
break;
case 'h1' :
case 'h2' :
@ -317,17 +317,17 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
if ($this->_tableLevel > 0) {
// If we're inside a table, replace with a \n
$cellContent .= "\n";
echo 'LIST ENTRY: ' , '<br />';
// echo 'LIST ENTRY: ' , '<br />';
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
echo 'END OF LIST ENTRY:' , '<br />';
// echo 'END OF LIST ENTRY:' , '<br />';
} else {
if ($cellContent > '') {
$this->_flushCell($sheet,$column,$row,$cellContent);
$row += 2;
}
echo 'START OF PARAGRAPH: ' , '<br />';
// echo 'START OF PARAGRAPH: ' , '<br />';
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
echo 'END OF PARAGRAPH:' , '<br />';
// echo 'END OF PARAGRAPH:' , '<br />';
$this->_flushCell($sheet,$column,$row,$cellContent);
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 we're inside a table, replace with a \n
$cellContent .= "\n";
echo 'LIST ENTRY: ' , '<br />';
// echo 'LIST ENTRY: ' , '<br />';
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
echo 'END OF LIST ENTRY:' , '<br />';
// echo 'END OF LIST ENTRY:' , '<br />';
} else {
if ($cellContent > '') {
$this->_flushCell($sheet,$column,$row,$cellContent);
}
++$row;
echo 'LIST ENTRY: ' , '<br />';
// echo 'LIST ENTRY: ' , '<br />';
$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);
$column = 'A';
}
@ -360,11 +360,11 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
case 'table' :
$this->_flushCell($sheet,$column,$row,$cellContent);
$column = $this->_setTableStartColumn($column);
echo 'START OF TABLE LEVEL ' , $this->_tableLevel , '<br />';
// echo 'START OF TABLE LEVEL ' , $this->_tableLevel , '<br />';
if ($this->_tableLevel > 1)
--$row;
$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();
if ($this->_tableLevel > 1) {
++$column;
@ -380,15 +380,15 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
++$row;
$column = $this->_getTableStartColumn();
$cellContent = '';
echo 'START OF TABLE ' , $this->_tableLevel , ' ROW<br />';
// echo 'START OF TABLE ' , $this->_tableLevel , ' ROW<br />';
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
echo 'END OF TABLE ' , $this->_tableLevel , ' ROW<br />';
// echo 'END OF TABLE ' , $this->_tableLevel , ' ROW<br />';
break;
case 'th' :
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);
echo 'END OF TABLE ' , $this->_tableLevel , ' CELL<br />';
// echo 'END OF TABLE ' , $this->_tableLevel , ' CELL<br />';
$this->_flushCell($sheet,$column,$row,$cellContent);
++$column;
break;
@ -448,8 +448,8 @@ class PHPExcel_Reader_HTML extends PHPExcel_Reader_Abstract implements PHPExcel_
$content = '';
$this->_processDomElement($dom,$objPHPExcel->getActiveSheet(),$row,$column,$content);
echo '<hr />';
var_dump($this->_dataArray);
// echo '<hr />';
// var_dump($this->_dataArray);
// Return
return $objPHPExcel;

View File

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