Problem using BIFFwriter

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Anyone here familiar with BIFFwriter and it associated classes that
are used to create Excel files?

I recently downloaded a package from PHP Developers Network (by Xavier
Noguer) and am trying to incorporate it into a couple of my pages.
But, an error is being thrown when trying to write an underlined,
bolded text string. :
   "Object of class Format could not be converted to int in
Worksheet.php on line 790"
I can't figure out what the problem might be. Here are the PHP
statements I'm using:
$workbook = new Workbook("-");
$fmt=& $workbook->add_format();
$worksheet1 =& $workbook->add_worksheet('TraceLog');  
$worksheet1->set_column(0, 0, 25);
$worksheet1->set_column(1, 1, 15);
$worksheet1->set_column(2, 2, 75);
$worksheet1->write_string(0, 0, "Date/Time",$fmt);
$worksheet1->write_string(0, 1, "Tote #",$fmt);
$worksheet1->write_string(0, 2, "Event Description",$fmt);
These last three statements all generate the above noted error.
I tried e-mailing the author about this but his published address is

Does anyone here any ideas as to what the problem might be?


Re: Problem using BIFFwriter


Quoted text here. Click to load it

OK, found the problem. Posting the solution here in case someone else
might need it.

One of the classes supplied with BIFFWriter is named Worksheet.php. In
this file, at line 820, there is this function:

function _XF(&$format)
        if($format != 0)

The statement: if($format != 0)
should be:  if($format != NULL)

With this one change, it all works as it's supposed to.

Site Timeline