tags:

views:

1008

answers:

1

I need to export a report to Excel file using PHP i.e. on the fly. I am acutally getting data from mysql and presenting it in HTML tables. I am able to export all this data into Excel file format, except images. I can't point the image source to absolute url, because this file also needs to work offline. Is there any way, I can embede/insert images into this Excel file without using any library i.e. only PHP code or library which does'nt require PEAR/PECL extensions. I am using LAMP stack, so COM is not an option.

+1  A: 

I'm not sure what your reasoning is for not using PEAR, but there is a modified version (PHP Excel Creator library) of PEAR Spreadsheet Excel Writer which does not have any dependencies on the rest of PEAR.

I know that the original PEAR version has a method Worksheet::insertBitmap() . You would need to convert the images to bitmap if they aren't already (maybe using GD in PHP)

If you are on Windows and have decent access to the server you could also try using COM to talk to Excel and generate the file that way.

Tom Haigh