Skip to content
This repository has been archived by the owner on Jan 2, 2019. It is now read-only.

Commit

Permalink
Bugfix: Work item GH-104 - echo statements in HTML.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Baker committed Dec 11, 2012
1 parent 62bf1b7 commit d13ca1f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 41 deletions.
50 changes: 25 additions & 25 deletions Classes/PHPExcel/Reader/HTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private function _flushCell($sheet,$column,$row,&$cellContent) {
// 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);
Expand All @@ -227,11 +227,11 @@ private function _processDomElement(DOMNode $element, $sheet, &$row, &$column, &
// 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;
}

Expand Down Expand Up @@ -259,13 +259,13 @@ private function _processDomElement(DOMNode $element, $sheet, &$row, &$column, &
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);
Expand All @@ -286,14 +286,14 @@ private function _processDomElement(DOMNode $element, $sheet, &$row, &$column, &
$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]);
Expand All @@ -303,7 +303,7 @@ private function _processDomElement(DOMNode $element, $sheet, &$row, &$column, &
}
$cellContent .= ' ';
$this->_processDomElement($child,$sheet,$row,$column,$cellContent);
echo 'END OF HYPERLINK:' , '<br />';
// echo 'END OF HYPERLINK:' , '<br />';
break;
case 'h1' :
case 'h2' :
Expand All @@ -317,17 +317,17 @@ private function _processDomElement(DOMNode $element, $sheet, &$row, &$column, &
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])) {
Expand All @@ -342,29 +342,29 @@ private function _processDomElement(DOMNode $element, $sheet, &$row, &$column, &
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';
}
break;
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;
Expand All @@ -380,15 +380,15 @@ private function _processDomElement(DOMNode $element, $sheet, &$row, &$column, &
++$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;
Expand Down Expand Up @@ -448,8 +448,8 @@ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
$content = '';
$this->_processDomElement($dom,$objPHPExcel->getActiveSheet(),$row,$column,$content);

echo '<hr />';
var_dump($this->_dataArray);
// echo '<hr />';
// var_dump($this->_dataArray);

// Return
return $objPHPExcel;
Expand Down
33 changes: 17 additions & 16 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,25 @@
Fixed in develop branch:
- Feature: (MBaker) Include charts option for HTML Writer
- Feature: (MBaker) Added composer file
- 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: (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 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
- General: (kea) Work item GH-69 - Improved AdvancedValueBinder for currency
- 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: (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 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
- 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
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: (karak) Work item GH-85 - Fill SheetView IO in 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: (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: (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
- 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: (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: (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: (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


--------------------------------------------------------------------------------
Expand Down

0 comments on commit d13ca1f

Please sign in to comment.