I can successfully export a dynamically-generated HTML table to Excel (within the browser) about 1 for every 10 attempts. That's not good. I have spent countless hours trying to fix or find the root of the problem OR identify a pattern/cause. I have failed.
It is especially frustrating because in those "10 attempts" (let's say), I can leave the code absolutely untouched AND, I can use the exact same query -- yet STILL! ...it seems to only work once a a great while.
I hope to hear that others have had very similiar difficulties and then found the solution. If you're out there, please share your solution.
ENVIRONMENT:
-- PHP (ISAPI)
-- IIS
-- Windows NT4
-- Access (I know, I know)
-- IE 5.50.4807.2300; SP2; Q313675;
TECHNIQUE:
Nothing fancy; Just the normal header that everyone uses...
header("Content-type: application/vnd.ms-excel");
ERRORS:
Here are the errors I get 9 out of 10 times...
1. A Microsoft Excel Alert Box that says, "Could not open 'http://mydir/export.php'."
2. After clicking OK, I get a bigger Microsoft Excel Alert Box that says, "Microsoft cannot access the file 'http//mydir/export.php'. There are several possible reasons:...'". Then it list 3 generic reasons like the file name or path not exisiting, the file is being used by another program or the name of the workbook is the same as another -- y'know, things that don't help much.
3. After clicking OK there, a File Download dialog window pops up (animated, but doing nothing), and then a IE Alert Box pops up immediately over the previous saying, "IE cannot download export.php from myservername. IE was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later."
4. After clicking OK, the dialog and alert box disappear -- and that's it.