?
Solved

Excel Office Web Components (OWC11) and ASP.NET

Posted on 2004-04-28
7
Medium Priority
?
23,290 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

777 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