Jump to content

Word document


sandy1028

Recommended Posts

How to write the php script to open in a word format. I tried the code below which opens in word documetn but the contents are not dynamic.

 

The word page is not getting refreshed

 

 

$rec=clusteravail();
array_shift($rec);
header("Content-type: application/msword");
echo "<html><head><title>REPORT</title><meta http-equiv=\"refresh\" content=\"100\"></head><body bgcolor=\"#FFFFFF\" text=\"#000000\"><TABLE BORDER=2 CELLPADDING=4 width=\"100%\"><TR><TH COLSPAN=8>DATE AS ON 2008-02-27</TH></TR><TR><TH COLSPAN=8>Head and CLIENT NODE Status of Garuda Network</TH></TR><TR><TD>SL NO</TD><TD>CLIENT NODE NAME</TD><TD>IP ADDRESS</TD><TD>HEAD NODE NAME</TD><TD>START TIME</TD><TD>END TIME</TD><TD>DURATION</TD></TR>";
for($i=0;$i<=count($rec);$i++){
$data=split("#",$rec[$i]);
echo "<tr>";
echo "<td>$i</td>";
echo "<td>$data[0]</td>";
echo "<td>$data[1]</td>";
echo "<td>$data[2]</td>";
echo "<td>$data[3]</td>";
echo "<td>$data[4]</td>";
echo "<td>$data[5]</td>";
}
echo "</tr></table></body></html>";

Link to comment
https://forums.phpfreaks.com/topic/93276-word-document/
Share on other sites

I haven't used any microsoft product in years so don't confess to being any expert, but I would suggest it can't be done.

 

The whole idea doesn't make sense to be honest.

Well MS Word can handle HTML, and I never looked at it in Plain text but i think the new format (.docx) is all XML based. but this script should generate what evers in the strings provided.
Link to comment
https://forums.phpfreaks.com/topic/93276-word-document/#findComment-477914
Share on other sites

Ooh, just did a test and the header("Content-type: application/msword"); prompts you to download a word doc which when opened will actually contain the html that you are outputting. COOL! Now to go away and find a good implementation for that.

 

What does

clusteravail();

function do? This is where are you shifting the recordset, and i suspect is wrong.

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/93276-word-document/#findComment-477983
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.