473,761 Members | 2,410 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

from HTML to Excel

Good day,
I have a web page that shows info retrieved from a MySQL db and I
would like to convert all these data into an .XLS file.
Have searched the net high and low but seems that I'm unable to find a
free tool that can do the above and therefore I'm forced to do
everything from scratch.
Till now have developed two different versions of the programs and
both somehow work but still have a small problem that I can't
understand.

The first version uses the header
Content-Type:applicatio n/vnd.ms-excel and create a simple table in
HTML. For instance :

<table cellspacing=0 cellpadding=0 border=0 bgcolor=#BBDDFF >
<tr><td>AAA</td><td>BBB</td><td>CCC</td></tr>
...

It works (also with big files, have created an .XLS file that was
22000 rows x 12 cols) but I cannot access all Excel options /
functions (for instance : I cannot add a filter)

The second version uses JS and ActiveX :

<script language="VBScr ipt"></script>
<script language="javas cript">
function ExcelShow()
{
var oXL = new ActiveXObject(" Excel.Applicati on");
var oWB = oXL.Workbooks.A dd();
var oS = oWB.ActiveSheet ;

oS.Name="test";
oS.Cells(5, 1) = "AAA";
oS.Cells(5, 2) = "BBB";
oS.Cells(5, 3) = "CCC";

This work fine, it is fast and I can access Excel functions but have
noted that when number of rows is high the program dies without any
warning / error message. It simply dies and in the HTML page I see
only :
<html><head><ti tle></title></head>
<script language="VBScr ipt">
</script>

Any idea about what can cause the problem and how to solve it ?
Tks, regards
Valerio
Jul 23 '05 #1
1 9327
v_verno wrote:
Good day,
I have a web page that shows info retrieved from a MySQL db and I
would like to convert all these data into an .XLS file.
Have searched the net high and low but seems that I'm unable to find a
free tool that can do the above and therefore I'm forced to do
everything from scratch.
Till now have developed two different versions of the programs and
both somehow work but still have a small problem that I can't
understand.

The first version uses the header
Content-Type:applicatio n/vnd.ms-excel and create a simple table in
HTML. For instance :

<table cellspacing=0 cellpadding=0 border=0 bgcolor=#BBDDFF >
<tr><td>AAA</td><td>BBB</td><td>CCC</td></tr>
...

It works (also with big files, have created an .XLS file that was
22000 rows x 12 cols) but I cannot access all Excel options /
functions (for instance : I cannot add a filter)

The second version uses JS and ActiveX :

<script language="VBScr ipt"></script>
<script language="javas cript">
function ExcelShow()
{
var oXL = new ActiveXObject(" Excel.Applicati on");
var oWB = oXL.Workbooks.A dd();
var oS = oWB.ActiveSheet ;

oS.Name="test";
oS.Cells(5, 1) = "AAA";
oS.Cells(5, 2) = "BBB";
oS.Cells(5, 3) = "CCC";

This work fine, it is fast and I can access Excel functions but have
noted that when number of rows is high the program dies without any
warning / error message. It simply dies and in the HTML page I see
only :

<html><head><ti tle></title></head>
<script language="VBScr ipt">
</script>

Any idea about what can cause the problem and how to solve it ?
Tks, regards
Valerio


I'm going to take a wild guess and say it's a bug. In which case there is
going to be little you can do to resolve the issue.

However, as far as adding a filter is concerned, you can do that with HTML
data saved as a .XLS file using the following:

<td filter="all">Co lumn Name</td>

As for formatting content, you can do that one of two ways:

<table>
<col span="2" width="140"
style="vnd.ms-excel.numberfor mat:#,###,###,# #0.000" valign="top"
id="Quantity">
<tr> ...
....
</table>

or

<td style="vnd.ms-excel.numberfor mat:#,###,###,# #0.000">

on individual cells. Also note:

style="vnd.ms-excel.numberfor mat:[<=999][dquote][dquote][semicolon][<=9999999]###-####[semicolon](###)
###-####"

works just as:

[<=999]"";[<=9999999]###-####;(###) ###-#### works in Excel

Although doing Excel spreadsheets as HTML _is_ more limited then the way
you are attempting to do it, it tends to work reliably across all browsers
regardless of client-side Javascript support. What specific functionality
do you require that you aren't able to obtain using HTML?

--
| Grant Wagner <gw*****@agrico reunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
47747
by: Jim, N2VX | last post by:
I'd like to create/display an Excel spreadsheet from javascript. We have an HTML page with results of a search and it can be reasonably large. The first attempt was to format the data into an HTML table and send it to an ASP page. The ASP page has: Response.AddHeader ("Content-Disposition", "inline"); Response.ContentType = "application/vnd.ms-excel"); Response.Write(formatted_html_data);
4
4531
by: Jae | last post by:
I'm writing a web application that exports and imports excel files. The application gets a list of users and their info and displays it in a datagrid .The user then selects to save the file as a tab delimited file or an excel file. The application then saves the file in the correct format. The flip side is for the user to import/upload the file to the server The application must be able to import the excel file and read the contents. I...
8
1558
by: Ben | last post by:
Hello, I have an asp routine to display an Excel worksheet on an a web (asp) page. I have created aspx pages but only in the classroom. Point - I have the basics for aspx. Could someone show me how I would perform the routine below (asp routine) in aspx? I have VS 2003. Is there a control I would use instead of the adoStream, or stick with adoStream?
1
6124
by: Anonieko | last post by:
Here are some of the approaches. 1. Transform DataGrid http://www.dotnetjohn.com/articles.aspx?articleid=36 3. Use the Export approach http://www.aspnetpro.com/NewsletterArticle/2003/09/asp200309so_l/asp200309so_l.asp
3
7377
by: akristensen | last post by:
I am new to this site, so be patient if I do not ask the question correctly. Current Target Platform: Browser: MS IE, script language: Javascript (will use VBScript, but JS is preferred), External apps: MS Excel What I need to do: From a web page using javascript, I open a new Excel application and sheet, populate some information into it. After it is populated with some information, I need to run the "Solver..." option on the data in the...
1
2112
roswara
by: roswara | last post by:
Dear all, Currently, I am working on a project to make a web-based application using ASP 2.0 and C#. This application will ask user to input for an excel file which has graphs in it. Then the application will grab the graph as image file, and this image will be displayed as thumbnail in the page. Is it possible to accomplish this feature? If it is possible, would you please tell me how? And if it is not possible, why?
3
6248
by: sejal17 | last post by:
hello Can any one tell me how to read multiple worksheets from a single excel file.I have stored that excel in xml file.so i want to read that xml that has multiple worksheet.And i want to store that multiple worksheet data in different table.How can i do it.Below is my xml file. <?xml version="1.0"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" ...
3
5401
by: sejal17 | last post by:
hello Can any one tell me how to read multiple worksheets from a single excel file.I have stored that excel in xml file.so i want to read that xml that has multiple worksheet.And i want to store that multiple worksheet data in different table.How can i do it.Below is my xml file. <?xml version="1.0"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office"...
15
9439
by: patf | last post by:
Hi - experienced programmer but this is my first Python program. This URL will retrieve an excel spreadsheet containing (that day's) msci stock index returns. http://www.mscibarra.com/webapp/indexperf/excel?priceLevel=0&scope=0&currency=15&style=C&size=36&market=1897&asOf=Jul+25%2C+2008&export=Excel_IEIPerfRegional Want to write python to download and save the file. So far I've arrived at this:
0
9336
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9948
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9765
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7327
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6603
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5364
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3866
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3446
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.