|
|||||||
| HTML Discussion and technical support for building, using and deploying HTML sites. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
html table to excel spreadsheet using javascript without php
Hi can anyone help me with the script to convert a html table to excel spreadsheet using javascript without php
MIME header has been included is ther anything to be included in the script
|
|
#2
|
||||
|
||||
|
Javascript doesn't know what a file is. You could probably write a Javascript to convert the content (provided that you have the Excel file specification to know what to convert to what - Microsoft may sell you that for a few million dollars). Of course the Javascript will be so rediculously large as to make huge web pages look microscopic. There is of course then no way for you to save that content once you have let the Javascript finish creating it (possibly a wait of several months).
To be able to do this at all you would need to use a server side language that understands what Excel is.
__________________
Stephen Free Computer Help, blog, forum Web design ebooks and software JavaScript scripts and tutorials |
|
#3
|
|||
|
|||
|
doesnt this work??It does ,anyways thank you
<html>
<head> <script type="text/javascript"> function CreateExcelSheet() { var x=myTable.rows var xls = new ActiveXObject("Excel.Application") xls.visible = true xls.Workbooks.Add for (i = 0; i < x.length; i++) { var y = x[i].cells for (j = 0; j < y.length; j++) { xls.Cells( i+1, j+1).Value = y[j].innerText } } } </script> </head> <body marginheight="0" marginwidth="0"> <form> <input type="button" onclick="CreateExcelSheet()" value="Create Excel Sheet"> </form> <table id="myTable" border="1"> <tr> <b><td>Name </td> <td>Age</td></b></tr> <tr> <td>Shivani </td> <td>25</td> </tr> <tr> <td>Naren </td> <td>28</td> </tr> <tr> <td>Logs</td> <td>57</td> </tr> <tr> <td>Kas</td> <td>54</td> </tr> <tr> <td>Sent </td> <td>26</td> </tr> <tr> <td>Bruce </td> <td>7</td> </tr> </table> </body> </html> |
|
#4
|
|||
|
|||
|
Thanks
Thanks for your info shivani.
I tried to save a spreadsheet from javascript using the command xls.workbooks.save. If i try to close the spreadsheet, even then it asks whether to save the changes. how to prevent this from occuring? Thanks in advance! |
|
#5
|
||||
|
||||
|
Of course there are a lot of assumptions rolled into that Javascript function.
__________________
Help Save Ana Why use Web Standards: Zeldman How (new): Castro How (experienced): Cederholm If you can only get one book and you're already HTML savvy then this is it: stylin' with CSS: A Designer's Guide Charles Wyke-Smith New Riders "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan |
|
#6
|
||||
|
||||
|
It is actually JScript/ActiveX rather than JavaScript and so the main assumptions to start with is that the browser is Internet Explorer and the Operating System is Windows since that combination is the only one to support those languages.
__________________
Stephen Free Computer Help, blog, forum Web design ebooks and software JavaScript scripts and tutorials |
|
#7
|
||||
|
||||
|
There may be an assumption that Excel is installed, too.
__________________
Help Save Ana Why use Web Standards: Zeldman How (new): Castro How (experienced): Cederholm If you can only get one book and you're already HTML savvy then this is it: stylin' with CSS: A Designer's Guide Charles Wyke-Smith New Riders "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan |
|
#8
|
|||
|
|||
|
Thnak you all
Quote:
I am verry much thank full to all, this code has reduced my work a lot, thanks again. |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|