PHP Classes

255-char limit?

Recommend this page to a friend!

      MS-Excel Stream Handler  >  All threads  >  255-char limit?  >  (Un) Subscribe thread alerts  
Subject:255-char limit?
Summary:Long strings aren't written inside the cells
Messages:4
Author:Simauria Networks
Date:2008-06-25 08:44:54
Update:2008-07-15 14:44:37
 

  1. 255-char limit?   Reply   Report abuse  
Picture of Simauria Networks Simauria Networks - 2008-06-25 08:44:54
I have been trying to insert some strings into an XLS file, but I'm having a problem: if the string is longer than 255 characters, nothing is written in the cell, and Excel 2007 raises an error saying that "Data may have been lost".

Is there any way to overcome this error?

Thanks in advance.

  2. Re: 255-char limit?   Reply   Report abuse  
Picture of Basti Basti - 2008-07-15 07:44:33 - In reply to message 1 from Simauria Networks
I have exactly the same error. Is there a solution for this problem?

  3. Re: 255-char limit?   Reply   Report abuse  
Picture of Simauria Networks Simauria Networks - 2008-07-15 12:19:36 - In reply to message 2 from Basti
The problem seems to be that this class uses the Excel 97 format, which has a limit of 255 chars for the contents of a cell. I solved it by using the PEAR Excel Writer class (http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.php), which allows to write Excel files in the newer 2000+ format. This class is good for simple Excel documents, but the PEAR class is much more robust and allows more complex document generation.

Hope this helped.

  4. Re: 255-char limit?   Reply   Report abuse  
Picture of Basti Basti - 2008-07-15 14:44:37 - In reply to message 3 from Simauria Networks
Thank you for your answer.

I've checked the PEAR class and it looks good!