Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

ASP .Net: Create excel file using excel object

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

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 …
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

839 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