943,902 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 20041
  • PHP RSS
Sep 28th, 2007
0

HTML To Excel

Expand Post »
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>
Similar Threads
Reputation Points: 39
Solved Threads: 1
Newbie Poster
njagi is offline Offline
15 posts
since Jun 2007
Sep 28th, 2007
0

Re: HTML To Excel

easiest way I know is to view it in a web browser and then highlight the information and copy it to excel.
Reputation Points: 10
Solved Threads: 3
Junior Poster in Training
piers is offline Offline
68 posts
since Jul 2007
Sep 29th, 2007
0

Re: HTML To Excel

use the following code:

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

PHP Syntax (Toggle Plain Text)
  1.  
  2. <?php
  3.  
  4.  
  5. echo "<table cellspacing='4' cellpadding='4' border=1 align=center>";
  6. echo"<tr>";
  7. echo"<td>Day</td>";
  8. echo"<td>Time</td>";
  9. echo"<td>Unit</td>";
  10. echo"<td>Lecturer</td>";
  11. echo"</tr>";
  12.  
  13. echo"</table>";
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29. header("Content-type: application/octet-stream");
  30.  
  31. # replace excelfile.xls with whatever you want the filename to default to
  32. header("Content-Disposition: attachment; filename=excelfile.xls");
  33. header("Pragma: no-cache");
  34. header("Expires: 0");
  35.  
  36.  
  37. ?>
  38.  
  39.  
  40. </p>
  41. </body>
  42. </html>


please if found this code helpful, can you add my reputation
Reputation Points: 11
Solved Threads: 2
Light Poster
tirivamwe is offline Offline
36 posts
since Oct 2005
Feb 14th, 2009
0

Re: HTML To Excel

This works for me !!! Thank you very much !!!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jwf3148 is offline Offline
1 posts
since Feb 2009
Aug 1st, 2009
0

Re: HTML To Excel

can i format the table columns? like tell the column to act as a number?
i getting 1231 instead 1.23443E+14 of 123443211234000
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rui.penso is offline Offline
1 posts
since Aug 2009
Apr 10th, 2010
0
Re: HTML To Excel
thanx
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sainiweb is offline Offline
15 posts
since Apr 2010
Feb 24th, 2011
0
Re: HTML To Excel
Hi! A little late, but.... I found the following 'library' easy to use.

http://innovationsdesign.net/wb_2.7/...ktop_write.php

Using php, could you pass what you want to pass into excel via a variable and your set.

Hope it helps.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ddellostritto is offline Offline
21 posts
since Oct 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: PHP + VB.NET Encryption Problem (MD5)
Next Thread in PHP Forum Timeline: help me understand $_GET variable with the links





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC