Solved

ASP .Net: Create excel file using excel object

Posted on 2006-06-14
4
2,185 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

867 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

12 Experts available now in Live!

Get 1:1 Help Now