javascript - How can I send the contents of a table or results of a sql query to the clipboard from an asp Page? -


There are many examples on this type of Internet talk, but none of them work in Firefox. So I thought I set the challenge for stack overflow users.

Actually, I should use a page user for a very easy way so that the results of the quiz can be found in the clipboard so that they paste it into Excel.

This can either get data from the HTML table (generated by the query)

or send the results directly to the clipboard (readable excel in a format)

I have intranet with many ASP pages. Some of them produce large tables and some of them are then copied to Excel. Currently the user has to click inside the upper left cell, then scroll down the page.And move the cursor to the end of the table. If they do not do that right (in Firefox), data will not be read properly by Excel.

I want them to click on a button, they go to Excel, click in cell A1, and ctrl-v The data should be correctly divided into columns and rows (formatting does not matter)

Any ideas?

I am open to ASP or Javascript methods and it should work in both IE and Firefox (3)

Edit

< P> I have chosen the simplest option from the answer (I can have a lot to do 'do' in the pages so that will be the easiest.

In this form ...

  Send results to Excel & input; type = "checkbox" name = "Sendtoexcel" & gt;  

In the code later ...

  if request.querystring ("sendtoexcel") = "on" Third .contenttype = "app / vnd.ms-excel" Response.AddHeader "content-nature", "attachment; file name = fname.xls" end if  

< Div class First of all, Excel has great support for copy / paste HTML table objects. You should see that it meets your needs.

Otherwise, I

I have not tested it, but you should get the way out of it:

  & lt;% Response.AddHeader "Content-Type", "Apple Cation / Oktet- stre am "ResponsekAddHeader" content-displacement "," attachment; "Name" and "", "Response." "" "" & Amp; "Give feedback to each customer for customers. "" Commands for Customers, C Customer = GetCustomerFromDb (); C ("email") and "", "feedback." "" "" & Amp; Amp; Amp; C ("address") & amp; "", "Response.Write" "" & amp; ) & Amp; "" "," Response.Write vbCrLf Next%>  

What you want to do is create a new page with this code, then there is a link to this page in your interface which will download the CSV.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -