Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Export to excel

This is a discussion on Export to excel within the JavaScript forums, part of the Web Development category; Hi, i am designing the webpage, where i have a page with search results that are dynamic (based on some input from the user, search is performed) .. i want ...

Go Back   Geeks Talk > Web Development > JavaScript
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 12-27-2007
Junior Member
 
Join Date: Dec 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
paritosh.garg is on a distinguished road
Export to excel

Hi,
i am designing the webpage, where i have a page with search results that are dynamic (based on some input from the user, search is performed) ..
i want to export these results to Excel..
can any body help me..
i tried the following code:


var oXL = new ActiveXObject("Excel.Application");

oXL.Visible = true;

// Get a new workbook.
var oWB = oXL.Workbooks.Add();
var oSheet = oWB.ActiveSheet;


the code is working on my local machine..
but when i tried to load the webpage on server and then tried to run from my local machine...its giving error::

Automation Server can not create object..

Please let me know...if there is any other way to export to Excel...using java script...

Last edited by paritosh.garg; 12-27-2007 at 01:28 AM.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 02-12-2009
Junior Member
 
Join Date: Feb 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
prafullagang is on a distinguished road
Re: Export to excel

Hi

I tried using your Javascript; but it did not run on local machine except opening the excel file.

I tried two scripts:





Is there any error in the script?

regards / Prafulla
Reply With Quote
  #3 (permalink)  
Old 02-12-2009
Junior Member
 
Join Date: Feb 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
prafullagang is on a distinguished road
Re: Export to excel

Script 1

Function ExportToExcel()

Var sHTML = document.all.item("table1").outerhtml;
Var oExcel = new ActiveXObject("Excel.Application");
Var oBook = oExcel.Workbooks.Add;
sHTML = oBook.HTMLProject.HTMLProjectItems("Sheet1").Text;
oBook.HTMLProject.RefreshDocument;
oExcel.Visible = true;
oExcel.UserControl = true;
End Function


Script 2

function Export() {
window.clipboardData.setData(”Text”,document.all(’table2').outerHTML);
try{
var ExApp = new ActiveXObject(”Excel.Application”);

var ExWBk = ExApp.workbooks.add();
var ExWSh = ExWBk.worksheets(1);
ExApp.visible = true;
ExApp.DisplayAlerts = true;

}catch(e){
alert(”your computer don’t install Microsoft Excel!”)
return false
}
ExWBk.worksheets(1).Paste;
}
oExcel.Visible = true;
oExcel.UserControl = true;


Sorry for reposting, as the script tag perhaps disallowed on the forum.
Reply With Quote
Reply

  Geeks Talk > Web Development > JavaScript

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Export 'All testcases at a time' from Mercury Quality Center Geek_Guest Quality Center 10 05-30-2009 06:56 AM
Can exp just export a tablespace orion42 Oracle 1 09-26-2007 01:55 PM
How can I export / import the tables from one database to another Geek_Guest Oracle 2 07-30-2007 09:22 AM
Use of export xml file and import xml file options naags QTP 1 07-19-2007 02:37 PM
WebSphere V5.0 : Import and export Lokesh M Web Tools 0 05-27-2006 07:26 AM


All times are GMT -4. The time now is 11:13 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved