how to create a readable MS Word document for 97

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ets009
Forum Newbie
Posts: 1
Joined: Tue Feb 11, 2003 10:06 am

how to create a readable MS Word document for 97

Post by ets009 »

I can use header function to create a word document and format with HTML tags like the following codes. However, the page is not readable when opended with Word97. Does Anybody know how to make this work on Word97? What's the alternatives in formatting Word documents with PHP codes? Thanks in advance!

<?
Header("Content-type: application/msword");
Header("Conent-Disposition: attachment;filename=boom.doc");
?>
<center><b>Welcome to MS Word on the fly</b></center>
<table width=100% bgcolor="#F3F5EF">
<tr bgcolor="#F3F5EF">
<td align=center><b>Anrede</b></td>
<td align=center><b>Name</b></td>
<td align=center><b>Firma</b></td>
<td align=center><b>Strasse</b></td>
</tr>
</table>
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post by Stoker »

word-html is some nasty stuff..

I created a report system for a client of mine with PHP generating RTF (Rich Text Format), which is fairly close to Word Native... You can create some simple documents and store as RTF and then look at the source, but I also recommend reading the RTF specs from Microsoft, as a simple word document includes a lot of crap you really don't need, like specifiying a bunch of fonts and styles and all that.. It takes a while to get into but may be worth it if you are in great need to Word documents..
Post Reply