Larry Meaney - 2001-07-09

Hi Erol,

I am currently using Christian Novak's original function library, but I like what you've done to put a class wrapper around it.

I do have a few comments though :)

1) When calling WriteText_pos() from InsertText() and WriteNumber_pos() from InsertNumber(), why pass $value as a reference?  It doesn't seem to be changed anywhere, so it seems that passing by value will work fine.  This would also prevent PHP from generating this warning:

"Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer."

2) I am having the same problem that other people have mentioned with version 3, where Excel says "Unable to read file".  Version 2 works fine.  After comparing the files, I see that this line has been removed from WriteNumber_pos():
   $this->xls_data .= pack( "sssss", 0x0203, 14, $row, $col, 0x00 );
and this line is missing from WriteText_pos():
   $this->xls_data .= pack( "s*", 0x0204, 8 + $len, $row, $col, 0x00, $len );
After adding those lines back in, version 3 works again.  Were those lines removed by accident or am I missing something?

3) When I moved Christian's library from an X86 Linux box to a Sun SparcStation, I discovered the Excel files it generated no longer worked.  After reading about the pack function:
  http://www.php.net/manual/en/function.pack.php
I found that "pack"ing with an "s" like this:
  pack( "ssssss", 0x809, 0x08, 0x00,0x10, 0x0, 0x0 );
relies on the byte order of the machine you are on.  I changed all the pack commands to use "v" (little endian) instead of "s", and now it works fine on both machines (so far).

thanks,

-larry