Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 21st, 2005, 07:32 AM
Authorized User
 
Join Date: Jun 2004
Posts: 54
Thanks: 0
Thanked 1 Time in 1 Post
Default Export Data to Excel & Generate Graphs

Hi all,

I got stuck on one thing, it would be great if anybody will suggest me solution.

I need a solution to export data to excel and also need to generate graphs based on the data getting into excel. For example, I have a datagrid on webpage and when I click on a button say "Export" it should export data to excel sheet format and also generate graph using that data within the excel sheet. I know it can be achieved using Excel Object but here the problem is production server will not have excel installed.

does anybody know any such tool which takes care of such functionality and could post the link for me.

thanks in advance.



Vinod Pawar
India
__________________
Vinod Pawar
United States
 
Old October 25th, 2005, 04:17 AM
Authorized User
 
Join Date: Aug 2003
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

All you have to do is write a text file that is TAB delimited.

Just loop through the rows and for each one add a line to a string.
Between each column value enter a TAB character.
Make the filename have an extension of .xls

You'll have to do the graphs after the file is created.
Otherwise, you've gotta have Excel (or some 'Excelable' component) accessible to .NET on the server.

I didn't test this but it should get you close.

Code:
oFile = new StreamWriter(Server.MapPath("MyFilePath") + "/MyNewFile.xls");
oFile.WriteLine("First Name    Last Name    Address    City    State");
for(int i=0;i<DataGrid1.Items.Count;i++)
{
  //Retrieve the string for each column
  //Add a tab to the end of each line
  for(int x=0;x<DataGrid1.Columns.Count;x++)
  {
    sLine = DataGrid1.Items[i].Cells[x].ToString(); + "    " +
  }
  oFile.WriteLine(sLine);
}                            
oFile.Close();
 
Old June 9th, 2006, 09:11 AM
Registered User
 
Join Date: Jun 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

when server will not have excel installed and generate graphs to excel.There is a .net component called Spire.DataExport,Totally independent and not affiliated with ,free download.
I have heard that it is quite good for generating Excel files.
see: http://www.e-iceblue.com

 
Old July 15th, 2006, 01:03 AM
Registered User
 
Join Date: Jul 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Vinod Pawar,
  I have been searching a lot on how to create the msi for dotnetnuke, then i found your page where you explained the automated xcopy. In that explaination you haven't described where are you linking the dotnetnuke project with that msi in the whole procedure. Please help me as i require it very badly.
     I hope you can understand my situation as you too faced it.

Thanks & Regards,
Mukesh Kumar








Similar Threads
Thread Thread Starter Forum Replies Last Post
Import & Export Excel File prasanta2expert ASP.NET 1.0 and 1.1 Basics 5 March 5th, 2007 09:28 AM
Export Data to Excel msbsam ASP.NET 2.0 Basics 0 November 8th, 2006 02:09 AM
export data to Excel?? amy_mgfe Excel VBA 0 January 15th, 2005 10:44 AM
import & export data script minhpx SQL Language 1 January 4th, 2005 01:15 AM
Generate all possible graphs mehdi62b C++ Programming 3 October 6th, 2004 03:28 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.