Solved

ASP .Net: Create excel file using excel object

Posted on 2006-06-14
4
2,184 Views
Last Modified: 2012-08-13
I need to create excel file and make use of excel feature to process the data. Can anyone educate me on how to create excel fle using excel object? Thanx
0
Comment
Question by:scissorhand
4 Comments
 
LVL 7

Expert Comment

by:mmarksbury
ID: 16916422
You can use the Microsoft Office Interop.  In your web app, go to add reference, select the tab that lists assemblies and find the office interop.

Keep in mind, it is not a good idea to be doing this type of processing on a web server because you will sustain high CPU and memory usage with that assembly.
0
 
LVL 1

Accepted Solution

by:
JonathanTheMan earned 100 total points
ID: 16938017
If your goal is just to create an Excel spreadsheet and populate it with your data then you should try to avoid using Excel itself on the web server as it has the potential to make your server pretty unstable as well as sucking resources, as mmarksbury has commented on.

Two alternatives are:
- if you are using Excel 2003 or later, generate the spreadsheet as an Excel XML file. Being xml, these are not difficult to generate though they do have a lot of required Excel gumpf - the best way to start is to have a look at the format of the file Excel creates if you save a spreadsheet in XML format.
- if you do not need complex formatting & formulae, generate the spreadsheet as a simple HTML table but send it to the browser with the "application/vnd.ms-excel" content type.
e.g.
<%
      Response.ContentType = "application/vnd.ms-excel"
%>
<table><tr><td>This will be in the first cell of the spreadsheet</td><td>This will be in the first row and second cell</td></tr></table>
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Accessibility and Usability are two concepts that seem to be closely related.  But, too many people seem to have a distorted perception of them. During last five years, those two words have come to the day-to-day work of almost every web develope…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now