Solved

Excel Office Web Components (OWC11) and ASP.NET

Posted on 2004-04-28
7
23,218 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
[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
7 Comments
 
LVL 7

Expert Comment

by:chisholmd
ID: 10946259
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
ID: 12134829
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
ID: 12134956
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 1

Author Comment

by:groston
ID: 12149080
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
ID: 12489879
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
ID: 13845413
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
ID: 13845705
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…

733 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