Solved

Excel Office Web Components (OWC11) and ASP.NET

Posted on 2004-04-28
7
23,123 Views
Last Modified: 2011-08-18
I am having a tough time getting started using OWC. Maybe because MS didn't provide any documentation...

I have found out how to dynamically create a spreadsheet:

Add a reference to OWC11

then program:

        Dim xlsheet As New SpreadsheetClass

        ' put some data into the spreadsheet.
        Dim i As Int32
        For i = 1 To 10
            xlsheet.ActiveSheet.Cells(i, i) = i.ToString
        Next

        ' use this just to get a unique filename...  
        Dim xlFileName As String = System.DateTime.Now.Ticks.ToString() + ".xls"
        ' save it off to the filesystem...
        xlsheet.Export(Server.MapPath(".") + "\\" + xlFileName, OWC11.SheetExportActionEnum.ssExportActionNone, OWC11.SheetExportFormat.ssExportHTML)
        ' set content header so browser knows you'r sending Excel workbook...
        Response.ContentType = "application/x-msexcel"
        ' stream it on out!
        Response.WriteFile(Server.MapPath(".") + "\\" + xlFileName)

But...
This isn't quite what I need.

What I would like to do is to
1) "open" a base spreadsheet (has fomatting, borders, etc)
2) populate the spreadsheet with data from SQL (the easy part)
3) present the data to the user
4) provide a button so the user can save the data to a local file
optional) provide the means for the user to edit the data in the spreadsheet prior to saving it.

To accomplish step 1, I believe that the spreadsheet needs to be saved as XML (read this somewhere). I have done this. But now what?

If you do not have the specific answer to this question, but can point me to a good OWC11 reference that uses .NET technology, that may well be accepted as a valid answer.
0
Comment
Question by:groston
7 Comments
 
LVL 7

Expert Comment

by:chisholmd
Comment Utility
Why are you exporting it to HTML?

OWC11.SheetExportFormat.ssExportHTML

I am assuming that you are confident that your users have excel on their machines, so why not simply save it as xls ??

I'll have to look up OWC11 because I am used to simply using the office application objects directly.

0
 
LVL 3

Assisted Solution

by:mAjKoL
mAjKoL earned 125 total points
Comment Utility
Here is an article about creating Excel Spreadsheets using OWC
http://www.4guysfromrolla.com/webtech/022801-1.shtml
Charting with Office Web Components:
http://www.4guysfromrolla.com/webtech/022101-1.shtml
Using the Office Web Components to create dynamic charts
http://www.west-wind.com/presentations/OWCCharting/OWCCharting.asp
0
 
LVL 3

Accepted Solution

by:
mAjKoL earned 125 total points
Comment Utility
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Author Comment

by:groston
Comment Utility
I accepted the answer just to close this question.

The references pointed to by mAjKoL are for ASP, not ASP.NET. They are also focused on OWC10 and charting, not spreadsheet.

The webcast is also only maginally useful.

Bottom line: OWC might be useful, but the almost complete lack of documentation makes it worthless. You are better off installing Excel and using Excel objects. Those methods are documented and the funtion properly.
0
 
LVL 3

Expert Comment

by:norgan
Comment Utility
I too need to be able to display an excell file to our intranet users and allow then to use an excel spreadsheet (stored on server) to calculate loan amounts.

i have worked out that if i add a spreadsheet using OWC then i can then set the data source and get the information on the sheet.

Problem is this sheet has NO formatting and none of the macro's or formulea seems to be working.

Any ideas please?
0
 

Expert Comment

by:yeoyeesoon
Comment Utility
Hi...do you solve the problem eventually? Could you please email your complete solutions because I am facing the same problems as well. Thanks in advance.

My email is yeesoon.yeo@gmail.com
0
 
LVL 1

Author Comment

by:groston
Comment Utility
EE frowns upon such requests.
My solution was to use plain-old Excel - at the University, we have a site license, so it is feasible. Also, the site is restricted to the University so there are no licensing issues.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This video discusses moving either the default database or any database to a new volume.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 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

6 Experts available now in Live!

Get 1:1 Help Now