Export data from web form to excel -- using client's excel app

I am currently trying to figure out if there is any way to export data to the client's excel app.  I do not want to use the web server's excel application as it is cutting into the site's performance.

Is there any way to use something similar to the what is included below (ExportComponent.vb), but to use the client's excel app?

Imports System.Drawing.Color
Public Class ExportComponent
Inherits System.ComponentModel.Component
Public Shared Sub DataToExcel(ByVal dgData As DataGrid, ByVal response As HttpResponse)
response.Charset = ""
response.ContentType = "application/vnd.ms-excel"
Dim stringWrite As New System.IO.StringWriter
Dim htmlWrite As New System.Web.UI.HtmlTextWriter(stringWrite)
Dim dg As New DataGrid
dg = dgData
dg.HeaderStyle.Font.Bold = True
dg.HeaderStyle.ForeColor = Black
dg.HeaderStyle.HorizontalAlign = HorizontalAlign.Center
End Sub
End Class
1/15/2004 9:52:40 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 44

heres my function that exports a datagrid to exvel

Sub Button1_onclick(sender as Object, E as Eventargs)
Response.ContentType = "application/vnd.ms-excel"
Response.AppendHeader("Content-Disposition", "filename=Report.xls;")
Response.Charset = ""
Response.Buffer = False
Me.EnableViewState = False
Dim tw As New System.IO.StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)

' tell the grid to render itself into the html text writer
' If needed, here's how to change colors/formatting at the component level
MyDataGrid.HeaderStyle.ForeColor = System.Drawing.Color.Blue
MyDataGrid.ItemStyle.ForeColor = System.Drawing.Color.red
Dim strHtml As String = tw.ToString
Dim iLoop As Int32
Dim Multiple As Int32 = Fix(strHtml.Length / 1000)
' now write the contents of the html string to the client
For iLoop = 0 To Multiple
Response.Write(Mid(strHtml, (100000 * iLoop) + 1, 100000))

End Sub

1/15/2004 10:09:05 PM
Does the code you provide open the excel app from the CLIENT or the SERVER?

It looks very similar to what I already have working and that opens from the SERVER.
1/15/2004 10:44:05 PM
this code opens it from the client. Are you talking about opening the actual excel app instead of opening in the browser window? If it opens in the browser window it is still on the client not the server.

1/15/2004 11:38:24 PM

Similar Artilces:

Exporting data from web form to excel file
I have a page with datgrid and one button called export into excel. I use this code to export data into excel sheet. If my excel file size become more then 50k then i am having error and i can not open or save the excel file. Here is the code:  Server.ScriptTimeout = 12000 Response.ContentType = "application/vnd.ms-excel" dvwdetail = GetSQLData(VSQL) grdapex.DataSource = dvwdetail.Tables(0) grdapex.DataBind() If i have less row means the excel file size is less then 50k then it works fine but if i have more data file size is more then 50k then it give me error m...

For interrupting.web form Resized by position of the div : if div can't dispaly all (such as only top part , then web form heithten the heght),resize the web form
Web Form Resized by position of the div : if div can't dispaly all (such as only top part , then web form heithten the heght),resize the web form ! Because of my pool English, if you can't see , I will explain more ! ThanksGambler is the real life I guess you mean when form grows it also grow parent div element. This is normal. If you want div to stay fixed size and rather clip the form and maybe show a scrollbar, look at overflow property in CSS.Thanks------------------------------------------------------------This posting is provided "AS IS" with no warranties, and confers no ...

How do I merge web services' app.config with web app's web.config? Help!!
I have a web application project that uses a separate class library containing web service references (service layer). I want to be able to configure the web reference URLs dynamically and I know you can set this up by setting the URL behavior to  'Dynamic', etc, etc. The problem is VS2005 puts the URLs in the project's app.config file. When the class library becomes a DLL component, I have no way of accessing the app.config file.Is there a way to make the web reference project to look for the URLs in the web.config instead of its app.config? Or is there a way to merge this app.config w...

Calling local client apps via web form/web app.
Hello all,I am not sure if this is the correct area to ask this, so excuse me ifI posted in wrong area. I'm a bit of a newbie to this but I was wondering if I can call a local app. via a web application.  A friend suggested looking into ActiveX controls, but I am not familiar with them.  Also what other alternatives are there beside using ActiveX? I read about using Flex and Applets but again I don't know which would be my best option and what kind of security issues I may be dealing with?  If anyone can inform me or suggest a reference or book I would appr...

Submitting data from a know web form to unknown web form
hi i m making a software in which i will submitt some data from a web page that will go to a web form of which contrlos are unknown to me only i know the name and how many controls in that form it means i can see the form only. how can i do this please help me soon with code plz its very argent.i m doin this wit the help of foxtrot.xray.WebRobot but its giving me error that this dll file is already exists in The file ('C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\_foxtrot.xray.WebRobot.dll' already exists).i don know what will do so please help me soon please thanks praveen We ca...

Aspose.Excel.Web 1.0 Released!
Aspose.Excel.Web 1.0 Released! Version 1.0 Released on March 10 2005 ...

synchronizing chunk of data of one web form for another web form
I'm making a web application. In one web form; i'm taking inputs from user. Now; there is some info given by user in this page which is needed for web form which is going to be displayed next. i want to display that info automatically on that web form so that user doesn't have to re-input that info in this next web form. Info from first page would be inserted into database when user clicks on the submit button. then that next web form would be displayed. and the chunk of info from previous page should be displayed there!!! how can i do this?? cany anybody help?? nobody can help me!! I...

export to excel in web form application
hi, there is possible to export datawindow to excel document in web form application? if there is possible, how?can you give a sample application. many thanks Hi, Deny I would recommend you to ask your question in the "webform" newsgroup. Before that it would be of big help to read the existing postings on the theme - search for messages containing some of the words "Excel", "XLS", "DW2XLS". Then if you have further questions, ask. Regards, Ivaylo "Deny Fernando" <half.lefthanded@gmail.com> wrote in message news:a19...

Export web form contents to Excel?
Is there much to exporting the contents of a web form to an Excel spreadsheet?  I've been doing some research and the vast majority of articles seem to pertain to exporting GridView and DataGrid controls.Thanks!  RobertF57:Is there much to exporting the contents of a web form to an Excel spreadsheet?  I've been doing some research and the vast majority of articles seem to pertain to exporting GridView and DataGrid controls.  Base on my experience, you can create Excel.Application to solve your problem, check out the following link: http://support.microsoft.c...

Web forms and mobile web forms
Hey everyone, I am looking to develope a web site that depending on the device connecting to it, it will display a certain page. In this case im looking to create a web and wap version of the same project. I have the Web forms version finished using ASP.NET and C# and I am wondering how to create the mobile web form and incorporate it in the project. In the project folder, can I just add a mobile web??? But what about displaying device specific pages?? Cheers -Dudach Yes, you can add mobile web forms and controls to your Web Application project. No problem. For device/br...

How to Make Web Forms from other Web Forms
In putting together an ASP.NET application for a biz application, we have come to the point where there are three different types of basic forms which have, for the most part, been perfected. Now its is a matter of cloning those forms for various uses and modifying or adding code to suit the particular need. Copy and paste works OK, but there is a lot of changing of certain words, etc. Is there a way in ASP.NET to take these basic forms, turn them into classes or templates, create forms from them, then add or overwrite code? ? (Anybody who is a Vis Fox Pro programmer would know imme...

web form fields values export to excel
hii all,           i've a web page where some textboxes , buttons and dropdowns are there, i need to export whole form values to excel but without buttons, dropdown etc. means the selected value of dropdown should be there on excel but dropdown list should not be there.... can any1 help me??? Regards Anant Vijay Have a simple export to excel button that handles the click event to read all the textbox values and the dropdownlist values. Once, this is read, add it to an excel sheet with the following code. Protected Sub Butt...

Reading Excel Files from a .Net Web Form
Hi, This might be a dumb question, but ... When reading an Excel file from a .Net Web Form, is it necessary to have Microsoft Excel actually installed on the client machine running the web form? Also, do the Excel files being read need to be saved as "values only" or can the values be extracted from a spreadsheet where the cells contain formulas? Thanks. -Wayne Hi, For the 1st part, Office is not necessary to be installed. But Download the Office XP PIAs and use them to develop Office XP solutions with Visual Studio .NET. For 2nd Part I think you need to use Values.Regar...

Access Web Control's property within the Web Form
Hello, I have a Web Control which has a TextBox and a Button. I want to put this Control on a WebForm, then put some text in a Control's TextBox, press on Control's Button and be able to access text box's value from within the Web Form. That's my Control: _________________________________________________ public class Colo : System.Web.UI.UserControl { protected System.Web.UI.WebControls.TextBox TextBox1; protected System.Web.UI.WebControls.Button Button1; public string Myval{ get{return (string)ViewState["myval"];} set{ViewState["myval"] = va...

Aspose.Excel.Express 1.2 Released!
Aspose.Excel.Express 1.2 Released! Version Released on January 24 2005 The .Net Excel.Express spreadsheet reporting component which enables you to delivers real...

Aspose.Excel.Express 1.1 Released!
Aspose.Excel.Express 1.1 Released! Version Released on November 30 2004 The .Net Excel.Express spreadsheet reporting component which enables you to delivers real Excel spreadsh...

How to fire events in other web form from other web form ?
Suppose that I have A and B web form. I want to trigger B web form's Page_Load event from A web form. How can I do that ? Thanks in advanced WilbertWilbert Bujn Create a public method in B that call the load method : public void Load(object sender, System.EventArgs e) { Page_Load(sender, e) ; } In the page_load of A, instanciate a B object and then call the function B myB = new B() ; myB.Load() ; Quicky Thank you quicky, it works fine. WilbertWilbert Bujn...

Web Form vs. Web Content Form
If you don't mind, I would like to know what is the difference between those two items, when I go to add a new item I see both of those and I don't know what the difference is.  A content form is for use with a masterpage. A web form is a standalone web page. If you select web content form, you will then have to specify a masterpage for it. and what is a master page used for?  Hi, a master page is used to give a constant look and theme to a site, without having to duplicate code. So basically you can put your header, menu, nav and footer on a master page. Then a...

calling a web form from another web form
I would like to know what is the best way to open a web form from another web form. I would like to call it from a button control. Thanks Well, if I've grasped your question right, there are many methods to do that: 1)Response.Redirect > To navigate to another page from code and is equal to clicking a hyperlink. I suggest this as I think it's closer to your question. 2)Server.Transfer > This ends the current web form and begins a new web form. It's usable when you want to pass some variables i.e (Label1.Text) to the next immediate page. It's not safe though and not used to send p...

Web Form embedded in another Web Form
Hi,  I have programmed a Web Form which acts like a scientific calculator. I would like to embedd this calculator in the upper left hand corner of another accounting Web Form. I don't want to host the calculator on the same server as the accounting page. I.e. I want them to have distinct URLs. Classically, I would do this using frames, but is there a better way using ASP? Is there some sort of Panel which can display the webpage at a specific URL which I can just drag onto my accounting Web Form? Thanks,  P1000   Frames are the only way to embed a webform inside ano...

Include web form inside web form
I tried to include an aspx file in a asp.net web form. However, all the web controls (textbox, button) in the included page are not displayed when called. <Form id="Form1" method="post" runat="server"> <%   Response.writeFile("subPage.aspx"); %> <asp:button id="btnPrev" runat="server" text="Previous"></asp:button> </Form> There are some <asp:textbox> controls in the subPage.aspx file, the file itself works fine, but when it is included in the main page, all the controls are not displayed. Please assist. Thanks   u should use iFrame instead...   <iFrame src="subPage.aspx" /> Hi, much more convenient way to have reusability in "page-like way" is to use user controls. Web Forms User Controlshttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconwebformsusercontrols.aspThanks,Teemu KeiskiFinland, EU...

Exporting SQL query results into Excel on a web form
So here's the deal... I have a web form (ASP.NET and VB.NET, created in Visual Web Developer 2005 Express Edition) that allows the user to search for records in a SQL 2000 database, and I need to be able to export those records into Excel. At this point the search results do not display on the page at all, and they don't need to - I just need for them to either be in an Excel spreadsheet that pops open, or to save as an Excel spreadsheet in a specified location. Or some other file type (XML?) that Excel can open is fine, too. As I have it right now, the query returns a...

conver a windows forms app into a aspx web forms app
Hi, i remember reading somewere that a windows forms application can be "translated" to web forms application in .Net. ¿Is that true?. ¿How can I do it?¿does it work in visual studio 2003? Thanks a lot! Mikel There is no automatic wizard that will convert an ASP.NET app to WinForms, or a WinForms app to ASP.NET.  However, a number of the concepts are similar between the two models and you will be able to re-use all of your non-UI specific code.  The broader .NET Framework class library is also the same.Hope this helps you  If y...

Implementing .Net Form into an APS.net web form, can this be done
I am new here, but have been searching for a while, and may not have the correct lingo to find what I am looking for.  I am tasked with implementing a .exe application that was writen vb6 then converted to .net into a new website my team is developing. The idea is to put each of the 3 different forms in this .exe application of 3 different .aspx pages. I have attempted multiple things to get this into the page and even started to just rewrite it as an ASP.net web form, but even then I can't reuse any of the code since the System.Web.UI.Page doesn't inherit the sa...

Passing Values from a Web Form to Another Web Form
Hello All! I am trying to pass values from one web form to another web form. I know that there are 3 ways of doing this: queryString, Server.Transfer and Session. I am using the Server.Transfer method. But I am not able to create, in my 2nd web form, an instance of my 1st web form. My 1st Web form is named CallTrack.aspx and my 2nd is named Export.aspx. What I mean is something like this: Public value as CallTrack. I can't create it in my 2nd web form because when the intellisense is displayed, there's no CallTrack in the options. Thanks!   How about using cross-...

Web resources about - Export data from web form to excel -- using client's excel app - asp.net.web-forms

Resources last updated: 2/15/2016 1:07:24 AM