User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,510 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,681 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 2171 | Replies: 2
Reply
Join Date: Jun 2007
Posts: 14
Reputation: njagi is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
njagi njagi is offline Offline
Newbie Poster

HTML To Excel

  #1  
Sep 28th, 2007
Hi
Is there anyone who know How to capute a whole HTML file and convert itto Excel
for example

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="description" content="">
<title>Fourth Year Computer Technology Time Table</title>
</head>
<body>
<p>&nbsp;</p>
<p>&nbsp;</p>

<table cellspacing='4' cellpadding='4' border="1" align="center">
<tr>
<td>Day</td>
<td>Time</td>
<td>Unit</td>
<td>Lecturer</td>
</tr>

<tr>
<td>Monday</td>
<td>8.00am To 1.00 Pm </td>
<td>BCT 2406 Project Research and definition</td>
<td>&nbsp;</td>
</tr>

<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>




<tr>
<td>Tuesday</td>
<td>8.00am To 10.00am </td>
<td>BCT 2405 Client Server Systems & Computing</td>
<td>JB Kariuki</td>

</tr>
<tr>
<td>&nbsp;</td>
<td>12.00noon To 2.00PM</td>
<td>BCT 2405 Computer Graphics System</td>
<td>Kihongo</td>

</tr>
<tr>
<td>&nbsp;</td>
<td>2.00PM To 5.00 PM </td>
<td>BCT 2405 Computer Graphics System</td>
<td>Kihongo</td>

</tr>


<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>

<tr>
<td>Wednesday</td>
<td>7.00am To 10.00am </td>
<td>BCT 2405 Client Server Systems & Computing</td>
<td>JB Kariuki</td>

</tr>
<tr>
<td>&nbsp;</td>
<td>11.00noon To 1.00PM</td>
<td>BCT 2403 Knowledge Based Systems</td>
<td>George Okeyo</td>
</tr>

<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>

<tr>
<td>Thursday</td>
<td>7.00am To 10.00am </td>
<td>BCT 2403 Knowledge Based Systems</td>
<td>George Okeyo</td>

</tr>

<tr>
<td>&nbsp;</td>
<td>11.00am To 12.00 PM </td>
<td>BCT 2401 Operations Research</td>
<td>P Kihara</td>

</tr>

<tr>
<td>&nbsp;</td>
<td>12.00am To 2.00 PM </td>
<td>BCT 2404 Decision Support System</td>
<td>L Mburu</td>

</tr>
<tr>
<td>&nbsp;</td>
<td>3.00am To 6.00 PM </td>
<td>BCT 2404 Decision Support System</td>
<td>L Mburu</td>

</tr>

<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>


<tr>
<td>Friday</td>
<td>9.00am To 10.00am </td>
<td>BCT 2401 Operations Research</td>
<td>P Kihara</td>

</tr>

<tr>
<td>&nbsp;</td>
<td>11.00am To 2.00 PM </td>
<td>Research Methodology</td>
<td>L Mengo</td>

</tr>

<tr>
<td>&nbsp;</td>
<td>2.00PM To 4.00 PM </td>
<td>Research Methodology</td>
<td>L Mengo</td>

</tr>

<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>



</table>

</body>
</html>
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2007
Posts: 53
Reputation: piers is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 2
piers piers is offline Offline
Junior Poster in Training

Re: HTML To Excel

  #2  
Sep 28th, 2007
easiest way I know is to view it in a web browser and then highlight the information and copy it to excel.
Reply With Quote  
Join Date: Oct 2005
Location: Harare, Zimbabwe
Posts: 34
Reputation: tirivamwe is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 2
tirivamwe's Avatar
tirivamwe tirivamwe is offline Offline
Light Poster

Solution Re: HTML To Excel

  #3  
Sep 29th, 2007
use the following code:

i have just included the first row and hope you will not have problems with the rest:

 <?php


echo "<table cellspacing='4' cellpadding='4' border=1 align=center>";
echo"<tr>";
echo"<td>Day</td>";
echo"<td>Time</td>";
echo"<td>Unit</td>";
echo"<td>Lecturer</td>";
echo"</tr>";

echo"</table>";















header("Content-type: application/octet-stream");

# replace excelfile.xls with whatever you want the filename to default to
header("Content-Disposition: attachment; filename=excelfile.xls");
header("Pragma: no-cache");
header("Expires: 0");


?> 
  
  
</p>
</body>
</html>




please if found this code helpful, can you add my reputation
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 3:51 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC