Solved

ASP .Net: Create excel file using excel object

Posted on 2006-06-14
4
2,188 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
[X]
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
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How do I pull the base url for use in html links 7 37
Code Manager | Snippits 2 59
Display if field is NOT "" or NOT null 6 22
auto play video on web page 4 39
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
The viewer will learn how to count occurrences of each item in an array.
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.

763 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