?
Solved

Excel Office Web Components (OWC11) and ASP.NET

Posted on 2004-04-28
7
Medium Priority
?
23,318 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 250 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 250 total points
ID: 12134956
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

649 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