Page 1 of 1

Word document

Posted: Wed Feb 27, 2008 1:19 am
by sandy1028
How to write the php script to open in a word format. I tried the code below which opens in word document but the contents are not dynamic.

The data collected in the function is fetched from the database which is updated for every 2 minutes.

The word page is not getting refreshed.

Code: Select all

 
$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>";
 
 

Re: Word document

Posted: Wed Feb 27, 2008 2:54 pm
by Jade
You can set the header to refresh every 2 minutes if you want it to continually update. Another thing you can do to help is set it so it doesn't cache.

Re: Word document

Posted: Thu Feb 28, 2008 9:33 pm
by sandy1028
How to open a word document in php. I am using Linux platform. If I add header with no-cache the word document doesnot gets refreshed in Internet Explorer. But in mozilla it is refreshed.

Re: Word document

Posted: Mon Mar 03, 2008 12:22 am
by sandy1028
Please tell me any other solution to open the document in word file when the data gets refreshed.

When i try to open the word file it opens the word file which was opened for the first time. The values is not dynamic