Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decode for the newline in the cell #19

Open
GoogleCodeExporter opened this issue Apr 24, 2016 · 2 comments
Open

decode for the newline in the cell #19

GoogleCodeExporter opened this issue Apr 24, 2016 · 2 comments

Comments

@GoogleCodeExporter
Copy link

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 [email protected] on 6 Oct 2011 at 6:58

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 21 Jul 2012 at 6:00

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 20 Nov 2012 at 4:39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant