Browsing posts in: microsoft

Generating microsoft office documents (word, excel) on your webserver using php

Actually, this is much easier than you might think. The trick is to use the capability of excel and word to read html files

So just generate normal html, but use a content-type header line to force the browser to see this as a word or excel file: (using php)

header (“Content-type: application/msword”); or
header (“Content-type: application/”);
for word and
header (“Content-type: application/msexcel”); or
header (“Content-type: application/”);

I have never seen any difference between msword and, so if anybody knows the difference, please respond.

Then you might want to define the local filename. This can be done using the content-disposition header:

header(“Content-Disposition: filename=\”invoice_$invoicenr.xls\””);

For excel, just start generating a html table. The full table is used as excel sheet with its rows and columns.
For word, just start generating html code. It is interpreted by word. Make sure to use a FULL url path if you want to include images.

Here is an example to generate a word document:

Click here to test it.

the IE6 to IE7 upgrade

I’m using firefox as my default browser, but for testing and development i need explorer every once in a while. A couple of weeks ago, my microsoft update asked my to upgrate to IE7. So why not? well, always reluctant to install microsoft stuff, but if everybody uses IE7, i should at least test websites for this new browser.

So i installed IE7. What a bummer! I got an icon, but that was about it. Clicking the IE7 icon shows the hourglass for a fraction of a second, and then it exits immediately. So i uninstalled it and installed it again. Nope.. Then I reinstalled IE6. Works fine! Continue Reading