Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ASP .Net: Create excel file using excel object

Posted on 2006-06-14
4
Medium Priority
?
2,194 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
2 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 400 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
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.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

773 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