feriba / php-excel

Automatically exported from code.google.com/p/php-excel
MIT License
0 stars 0 forks source link

decode for the newline in the cell #19

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I added this code on the next line of 132(after htmlentities function)

$v = str_replace("\n", '
',$v );

so that you can make newline in the cell data.

Original issue reported on code.google.com by tam...@gmail.com on 6 Oct 2011 at 6:58

GoogleCodeExporter commented 8 years ago
I ran into this issue as well. We need to be able to have multi-line text in 
cells. Excel does support this already by using the 
 html entity. I found this 
by making a multi-line cell in Excel, then exporting it to .xml with Save As. 
The diff of my fix was as follows:

@@ -131,6 +131,7 @@ class Excel_XML
     $type = 'Number';
     endif;
     $v = htmlentities($v, ENT_COMPAT, $this->sEncoding);
+    $v = str_replace("\n", "
", $v);
     $cells .= "<Cell><Data ss:Type=\"$type\">" . $v . "</Data></Cell>\n";
     endforeach;
     $this->lines[] = "<Row>\n" . $cells . "</Row>\n";

Original comment by mcl...@gmail.com on 21 Jul 2012 at 6:00

GoogleCodeExporter commented 8 years ago
replace the Head Element
protected $header = "<?xml version=\"1.0\" encoding=\"%s\"?\>\n<Workbook 
xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\" 
xmlns:x=\"urn:schemas-microsoft-com:office:excel\" 
xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\" 
xmlns:html=\"http://www.w3.org/TR/REC-html40\"><Styles><Style ss:ID=\"Default\" 
ss:Name=\"Normal\"><Alignment ss:Vertical=\"Top\" 
ss:WrapText=\"1\"\/><\/Style><\/Styles>";

Original comment by fo...@dghaies.de on 20 Nov 2012 at 4:39