Hi, I’m trying to implement an Excel export in one of my products.
I’ve decided to use two different export types. Which one is used depends on whether or not Excel is present on the server.
– A COM-application which works fine
– A header-based export for servers without Excel.
Now the header-based export looks like this:
[code=php]header(“Content-type: application/x-msdownload”);
header(“Content-Disposition: attachment; filename=export.xls”);
header(“Cache-Control: must-revalidate, post-check=0, pre-check=0”);
header(“Pragma: no-cache”);
header(“Expires: 0”);
print “$reportnamen$top1n$top2nn$reportheadern$data”;
But there’s two problems:
1. All values are formatted as ‘Standard’ types, meaning that Excel will determine whether a cell contains a string an integer or whatever. This means that zeros will be cut off phone-numbers and is disastrous for European datetime stamps. Is there any way to force the cellproperties to be formatted as a string?
2. [COLOR=Red]And even more important
I really really hope someone can help me. If you’re not sure, just give a suggestion and I’ll gladly try it.
Thanks in advance