Solved

Move ASP to Excel - need help

Posted on 2004-04-27
70
1,252 Views
Last Modified: 2007-12-19
I am trying to use OWC to export my ASP tables to Excel and want to do the following:

1) Separate several tables into individual worksheets in one excel file
2) Color code the excel cells

I have read several articles, all of which provide only little tidbits on how to use OWC and at the most, give you several different ways to approach it but there is no common way that I can see.  I am using the following article to mold my coding around :  http://www.greggriffiths.org/webdev/both/excel

here is what I have so far below.  I have another sub calling this sub.  when this sub below is invoked, my asp page loads but is getting a constant hour glass and I don't know why.  I don't even know if the code below will work.  I guess I am not clear on a really good way to do this.  Eventually I will need to incorporate my recordset into this.  What I don't want is why OWC is bad or good.  I just want to try it and am ignoring the warnings on it.



Sub SaveToExcel

Dim filename, ExcelSheet

ExcelSheet = CreateObject("Excel.Application")

Set NewWorkbook = ExcelSheet.Workbooks.Add

NewWorkbook.Worksheets.Add

NewWorkbook.Worksheets(1).Activate
NewWorkbook.Worksheets(1).Columns("A").Columnwidth = 50
NewWorkbook.Worksheets(1).Columns("A").WrapText = True
NewWorkbook.Worksheets(1).Columns("B").Columnwidth = 50
NewWorkbook.Worksheets(1).Columns("B").WrapText = True
NewWorkbook.Worksheets(1).Cells(1,1).Interior.ColorIndex = "15"
NewWorkbook.Worksheets(1).Cells(1,1).Value = "1"
NewWorkbook.Worksheets(1).Cells(1,1).Interior.ColorIndex = "10"
NewWorkbook.Worksheets(1).Cells(2,1).Value = "2"
NewWorkbook.Worksheets(1).Cells(1,1).Name = "April27, 2004 - Excel Testing"

filname = ExcelSheet.GetSaveASFilename("Testing Excel Extraction.xls")
If filename = "False" then
      filename = "Testing Excel Extraction.xls"
End If

NewWorkbook.SaveAs filename
Set ExcelSheet = Nothing


End Sub
0
Comment
Question by:dba123
  • 46
  • 12
  • 8
  • +1
70 Comments
 
LVL 10

Expert Comment

by:Shailesh15
Comment Utility
try...

Set ExcelSheet = CreateObject("Excel.Application")
instead of
 ExcelSheet = CreateObject("Excel.Application")
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
yea, I forgot that. Thanks.  The application is still hanging though.
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
I think it is ok now.  I had to close out my browser and reopen.  But the function does nothing at this point.  I don't see how OWC determines where to save the Excel file at this point.  I put in the name of the Excel File but where do you tell it to save to?
0
 
LVL 10

Expert Comment

by:Shailesh15
Comment Utility
This line
filname = ExcelSheet.GetSaveASFilename("Testing Excel Extraction.xls")
pops up a save as dilalog box.. Is it open in background?
 
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
And where is the function GetSaveASFilename comming from...is it just part of the ExcelSheet object?
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
sorry, my page is still indeed hangning (I was viewing another page which is the wrong one)  So I need to figure out why first.
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
And we do have OWC installed on our server
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
What is the difference between  Excel.Sheet and Excel.Application.  I have seen both but do not know why one is used vs. the other and when to use each
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
And Excel.Spreadsheet
0
 
LVL 6

Expert Comment

by:Lord_McFly
Comment Utility
Ok I have got the following to work with no hangs - it created the file and I was able to view it...

<%
Dim filename, ExcelSheet

Set ExcelSheet = Server.CreateObject("Excel.Application")

Set NewWorkbook = ExcelSheet.Workbooks.Add

NewWorkbook.Worksheets.Add

NewWorkbook.Worksheets(1).Activate
NewWorkbook.Worksheets(1).Columns("A").Columnwidth = 50
NewWorkbook.Worksheets(1).Columns("A").WrapText = True
NewWorkbook.Worksheets(1).Columns("B").Columnwidth = 50
NewWorkbook.Worksheets(1).Columns("B").WrapText = True
NewWorkbook.Worksheets(1).Cells(1,1).Interior.ColorIndex = "15"
NewWorkbook.Worksheets(1).Cells(1,1).Value = "1"
NewWorkbook.Worksheets(1).Cells(1,1).Interior.ColorIndex = "10"
NewWorkbook.Worksheets(1).Cells(2,1).Value = "2"
NewWorkbook.Worksheets(1).Name = "April27, 2004 - Excel Testing"

filname = "E:\Websites\_EE\Misc\Testing_Excel_Extraction.xls"

NewWorkbook.SaveAs "E:\Websites\_EE\Misc\Testing_Excel_Extraction.xls"
NewWorkbook.Close

Set ExcelSheet = Nothing
%>

Note - you had...

NewWorkbook.Worksheets(1).Cells(1,1).Name = "April27, 2004 - Excel Testing"

you don't need the Cells bit...

NewWorkbook.Worksheets(1).Name = "April27, 2004 - Excel Testing"
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
I also had to correct a mispelling I had which was filname
I had to Dim my variable NewWorkbook

So how did you get it to work if you didn't do these 2 things?
0
 
LVL 6

Expert Comment

by:Lord_McFly
Comment Utility
I didn't notice the mispelling :)

I thought that I couldn't use a variable for the filename so I hardcoded it...

NewWorkbook.SaveAs "E:\Websites\_EE\Misc\Testing_Excel_Extraction.xls"

On correcting the filname var to filename

filename = "E:\Websites\_EE\Misc\Testing_Excel_Extraction.xls"

NewWorkbook.SaveAs filename

Worked...

As for dimming NewWorkbook coz I was testing I didn't use Option Explicit so I didn't need to DIM it.
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
so why is mine hanging?
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
Do I need OWC installed on my pC as well?  But this is a server side object right??
0
 
LVL 6

Expert Comment

by:Lord_McFly
Comment Utility
I'm not sure what this OWC thing is that you are referring to but you will need to have Excel installed on the server you wish to run this on.

I would try doing the following to find out where it hangs...

Response.Write "I got here..."
Response.End

Start from your first line and see how far you get - it'll help to identify which bit is not working.
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
OWC = Office Web Components....which is what needs to be installed in order to use the objects like Excel.Application, etc.
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
Ok, the problem is with line Set ExcelSheet = CreateObject("Excel.Application") which is where it is hanging.
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
What the heck is the difference between

CreateObject("Excel.Application")
CreateObject("OWC.Spreadsheet")
CreateObject("Excel.sheet")

should I be using Application here and why?  All I am trying to do is export an html table to a local Excel file on my PC (client)

There is no place that tells me the difference between the 3 syntaxes above...all I see is that people use different ones in certain examples adn I don't get the difference here.
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
And what is the difference between using

objSpreadsheet.Cells( i, j).Value = objfield.Name

vs.

NewWorkbook.Worksheets(1).Cells(2,1).Value = "2"


I feel that I am getting confused between 2 completely different ways of moving data into Excel here and need some explainations.  I have a ton of documents showing examples on how to move ASP to Excel using 2 different syntaxes but it doesn't really explain the differences here.
0
 
LVL 6

Expert Comment

by:Lord_McFly
Comment Utility
If you are creating the object via a web page you should be using...

Set ExcelSheet = Server.CreateObject("Excel.Application") - notice the use of 'Server.CreateObject' - this tells it to create the instance on the server - it won't be able to create it locally if you get what I mean.

The other 2...

CreateObject("OWC.Spreadsheet")
CreateObject("Excel.sheet")

...I've never seen them before.

When creating a office document using an ASP I've only ever seems the create bit as follows...

Set ExcelSheet = Server.CreateObject("Excel.Application")
Set WordDoc = Server.CreateObject("Word.Application")

You might even see say

Set ExcelSheet = Server.CreateObject("Excel.Application.8")

If all depend s on the version of Excel / Word that you have installed.

0
 
LVL 1

Author Comment

by:dba123
Comment Utility
Thanks...Ok, when I refer to OWC, here:  http://support.microsoft.com/default.aspx?scid=kb;EN-US;235883

Now I'm really confused.  So you are creating a new Excel file by using .Application?  and what do you mean creating the object via a web page.  Do you mean coding this in ASP?
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
Thanks...Ok, when I refer to OWC, here:  http://support.microsoft.com/default.aspx?scid=kb;EN-US;235883

Now I'm really confused.  So you are creating a new Excel file by using .Application?  and what do you mean creating the object via a web page.  Do you mean coding this in ASP?
0
 
LVL 6

Expert Comment

by:Lord_McFly
Comment Utility
Without seeing the examples that you have I couldn't comment on the differences between the varing syntax that you have come accross.

Sorry :)
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
I have just website examples....here:

http://www.devdex.com/gurus/code/445.asp
http://www.4guysfromrolla.com/ASPscripts/PrintPage.asp?REF=/webtech/022801-1.shtml

those 2 are the context in what I am using as a reference along with the Microsoft article posted earlier.  I don't get what the hell the different approaches are and why they differ....sorry, this is frustrating.
0
 
LVL 6

Expert Comment

by:Lord_McFly
Comment Utility
Ok the first one...http://www.devdex.com/gurus/code/445.asp

This code works as well...

<%
Dim filename, ExcelSheet

Set ExcelSheet = Server.CreateObject("Excel.Application")

Set NewWorkbook = ExcelSheet.Workbooks.Add
Set WorkSheet = NewWorkbook.Worksheets.Add      <----- They created this as extra

WorkSheet.Activate                                                 <---- See the difference / compare to original
WorkSheet.Columns("A").Columnwidth = 50
WorkSheet.Columns("A").WrapText = True
WorkSheet.Columns("B").Columnwidth = 50
WorkSheet.Columns("B").WrapText = True
WorkSheet.Cells(1,1).Interior.ColorIndex = "15"
WorkSheet.Cells(1,1).Value = "1"
WorkSheet.Cells(1,1).Interior.ColorIndex = "10"
WorkSheet.Cells(2,1).Value = "2"
WorkSheet.Name = "April27, 2004 - Excel Testing"

filename = "E:\Websites\_EE\Misc\Testing_Excel_Extraction.xls"

NewWorkbook.SaveAs filename
NewWorkbook.Close

Set ExcelSheet = Nothing
%>
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
so on the other approach, I completely changed my code and tried this:

Sub SaveToExcel

Dim filename, ExcelSheet, NewWorkbook

Set ExcelSheet = CreateObject("OWC.Spreadsheet")

Response.Write "test2"
Response.End

i  =0

For each f in Request.Form

Spreadsheet1.Cells( i, 0).Value = "test"

Next

ExcelSheet.SaveWorksheet "C:\documents and settings\dschinkel\desktop\Testing.xls"

End Sub


which did absolutely nothing.  the page loaded but no excel file on my desktop.  I feel ike I am throwing bits and peices together is the problem and not really understanding the basics, syntax or standards/approaches here.
0
 
LVL 6

Expert Comment

by:Lord_McFly
Comment Utility
The following...

HOWTO: Use the Spreadsheet Web Component with Visual Basic
http://support.microsoft.com/default.aspx?scid=kb;EN-US;235883

Is for Visual Basic - you posted to an ASP topic - are you doing your project in ASP?

The following...

http://www.4guysfromrolla.com/ASPscripts/PrintPage.asp?REF=/webtech/022801-1.shtml

The article is from 2001 - and is probably an alternative way of doing it - nowadays the format Excel.Application is more widely used (I'm guessing there)
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
I can't use .Application.  Everytime I put that code in there, it hangs my asp page.  My asp page only loads and loads at all if I take that out and use the technique using OWC.Spreadsheet
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
I can't use .Application.  Everytime I put that code in there, it hangs my asp page.  My asp page only loads and loads at all if I take that out and use the technique using OWC.Spreadsheet
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
yes, you are correct on that note for the Microsoft link...just ignore that.  I just read that again and noticed this as well.
0
 
LVL 6

Expert Comment

by:Lord_McFly
Comment Utility
Are you using ASP for this project?

If you are then in your example you put...

Set ExcelSheet = CreateObject("OWC.Spreadsheet")

When you should be using

Server.CreateObject()
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
Yea, read my original post.....ASP to Excel.

I should be putting CreateObject("OWC.Spreadsheet") because my recordset object is in another sub.  Here I am creating a spreadsheet object which is why.  Just like in

http://www.4guysfromrolla.com/ASPscripts/PrintPage.asp?REF=/webtech/022801-1.shtml
0
 
LVL 6

Expert Comment

by:Lord_McFly
Comment Utility
I'm not entirely sure what you think is on that page.

Even they say...

'Create an instance of the Spreadsheet component from OWC
Dim objSpreadsheet
Set objSpreadsheet = Server.CreateObject("OWC.Spreadsheet")

Notice the Server.CreateObject()
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
OK, what I am not clear on is when doing .Application, is this linking the Excel doc to your database as well so if a user updates the Excel Doc, it i turn updates the database?  This isn't what I want, I just want a one time copy to a new excel doc of my ASP table.  I think I am ontrack here but I keep seeeing "Excel Interfacing" and have noticed that in some examples out there on the web, there are certain ways to link Excel to the table that is outputted to it which I hope I am not doing here.
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 1

Author Comment

by:dba123
Comment Utility
Yea, I am creating a spreadsheet object.....sorry but I think we are missing each other's point here.  I don't get what you are trying to tell me.  To me this seems pretty straight forward in that part...I am creating an instance of a spreadsheet object so I can take that object variable and start populating my new spreadsheet.
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
What is on that page is how to create code to populate an Excel spreadsheet from a table....are we both in agreement?  Then if yes, you must first create a spreadsheet object (Set objSpreadsheet = Server.CreateObject("OWC.Spreadsheet") )

and then use that to populate its data...right?
0
 
LVL 6

Expert Comment

by:Lord_McFly
Comment Utility
.Application, is this linking the Excel doc to your database  - NO.

 keep seeeing "Excel Interfacing" and have - not sure what this is, sorry.

Note...

("OWC.Spreadsheet") - from my understanding this only allows you to set cell values, it won't allow you to do formatting, the following works by the way...

<%
Dim filename, ExcelSheet

Set ExcelSheet = Server.CreateObject("OWC.Spreadsheet")

ExcelSheet.Cells(1,1).Value = "1"
ExcelSheet.Cells(2,1).Value = "2"

filename = "E:\Websites\_EE\Misc\Testing_Excel_Extraction.xls"

ExcelSheet.ActiveSheet.Export filename, 0


Set ExcelSheet = Nothing
%>
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
So are you saying Server.CreateObject creates a spreadsheet object on the server and
CreateObject creates a spreadsheet object on the client

does it really matter?  If I create an object either way, my asp page is using an object and ulitimately creates an output excel file to the location of my choice anyway?

Please verify

0
 
LVL 1

Author Comment

by:dba123
Comment Utility
So in other words, your last post works but is trying to create the excel file on your web server.  I want it to be created on my local PC (which is what our users will be doing...saving an ASP report to Excel on their PC)
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
I tried this but got an error (notice my filepath):

Dim filename, ExcelSheet

Set ExcelSheet = Server.CreateObject("OWC.Spreadsheet")

ExcelSheet.Cells(1,1).Value = "1"
ExcelSheet.Cells(2,1).Value = "2"

filename = "C:\documents and settings\myprofile\desktop\Extraction.xls"

ExcelSheet.ActiveSheet.Export filename, 0


Set ExcelSheet = Nothing


ERROR

Microsoft Office Web Components 9.0 error 'e004002a'

Could not create or save the file. Click OK, and make sure that space is available and that you have permission to save files on the location you specified. Then try exporting again.
0
 
LVL 6

Expert Comment

by:Lord_McFly
Comment Utility
Don't quote me on the following but its about right...

CreateObject is used when you are writing a Client app (in VB for instance) - becuase the app is on the locale machine it is ok to call CreateObject but when you application is a remote app (i.e. a website) you need to use Server.CreateObject.

You couldn't create the file on the local machine anyway - its a security breach - you have to create the file on the server and then provide a link for download.
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
Thanks

Then how come I was able to create a file on my local PC using this code:

Response.ContentType = "application/msword"
 
Response.ContentType = "application/vnd.ms-excel"

There was no security breach there...


And why is Shailesh telling me that this line should prompt me to save the Excel File...which would mean I could save it to my local hard drive if I wanted:

filname = ExcelSheet.GetSaveASFilename("Testing Excel Extraction.xls")



0
 
LVL 1

Author Comment

by:dba123
Comment Utility
I am starting to think that this is an almost impossible task
0
 
LVL 46

Expert Comment

by:fritz_the_blank
Comment Utility
A quick question: do you have Microsoft Office installed on your server? OWC may not function otherwise.

Fritz the Blank
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
I was told I do.  I will recheck to be sure.
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
Yes, I see Excel installed on the server.  My collegue says he installed OWC also
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
Let me update everyone where i am at:

1) I am not clear on standards, techniques, syntaxt between many approaches (specifically Server.CreateObject("OWC.Spreadsheet") vs. Server.CreateObject ("Excel.Appliction") vs. CreateObject("Excel.Sheet")

2) When using Server.CreateObject ("Excel.Application"), my page hangs in ASP as if it forever is processing.  I don't even get my html table showing.

3) When I use OWC.Spreadsheet technique, syntax, whatever you call it, my page comes up but I get the following error:

Microsoft Office Web Components 9.0 error 'e004002a'

Could not create or save the file. Click OK, and make sure that space is available and that you have permission to save files on the location you specified. Then try exporting again.




So basically I am frustrated on the errors and confused as hell on what the techniques are and what the differences are between using OWC vs. Excel.application
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
There are several functions i have coded and tried so far amongst all t his confusion and here they are below.  I have been simply testing each one by calling them each time I test the page and thus on some of them, you have seen my troubles in my posts.

Note:  "myprofile" directory is used to hide my identity here


Sub SaveToExcel

Dim filename, ExcelSheet, NewWorkbook

Set ExcelSheet = CreateObject("OWC.Spreadsheet")

Response.Write "test2"
Response.End

i  =0

For each f in Request.Form

Spreadsheet1.Cells( i, 0).Value = "test"

Next

ExcelSheet.SaveWorksheet "C:\documents and settings\myprofile\desktop\Testing.xls"

End Sub

' ###################################
Sub SaveToExcel3

Dim filename, ExcelSheet

Set ExcelSheet = Server.CreateObject("Excel.Application")

Set NewWorkbook = ExcelSheet.Workbooks.Add
Set WorkSheet = NewWorkbook.Worksheets.Add

WorkSheet.Activate
WorkSheet.Columns("A").Columnwidth = 50
WorkSheet.Columns("A").WrapText = True
WorkSheet.Columns("B").Columnwidth = 50
WorkSheet.Columns("B").WrapText = True
WorkSheet.Cells(1,1).Interior.ColorIndex = "15"
WorkSheet.Cells(1,1).Value = "1"
WorkSheet.Cells(1,1).Interior.ColorIndex = "10"
WorkSheet.Cells(2,1).Value = "2"
WorkSheet.Name = "April27, 2004 - Excel Testing"

filename = "c:\documents and settings\myprofile\desktop\Testing.xls"

NewWorkbook.SaveAs filename
NewWorkbook.Close

Set ExcelSheet = Nothing

End Sub


' ###################################
Sub SaveToExcel2

Dim filename, ExcelSheet

Set ExcelSheet = Server.CreateObject("OWC.Spreadsheet")

ExcelSheet.Cells(1,1).Value = "1"
ExcelSheet.Cells(2,1).Value = "2"

filename = "C:\documents and settings\myprofile\desktop\Extraction.xls"

ExcelSheet.ActiveSheet.Export filename, 0


Set ExcelSheet = Nothing


End Sub
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
Sub SaveToExcel3 - This is freezing my PC, what I have been talking about

Sub SaveToExcel2 - when trying this sub, it produces that error "Microsoft Office Web Components 9.0 error 'e004002a' " stated in my previous post
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
I need to be able to allow the end user to click a button or link that lets them save the ASP report (table (s)) to an excel file on their local PC.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
Comment Utility
I haven't had time to read through all of this, but one or two things:

Server.CreateObject ("Excel.Application") has to do with office automation. Please avoid it--it is bad and even microsoft warns against it.

Set objSpreadsheet = Server.CreateObject("OWC.Spreadsheet") is the syntax for creating the Office Web component.

I would suggest taking this step by step--create a simple asp test page that we can build on. Let's try something very simple like this:

<%
On Error Resume Next
dim objSpreadsheet
Set objSpreadsheet = Server.CreateObject("OWC.Spreadsheet")

if isOject(objSpreadsheet ) then
   response.write("Object Exists")
else
   response.write("Object does not exist")
end if

%>



Fritz the Blank
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
Ok, I tried that and got "Object Exists".  I was told that using OWC doesn't allow writing to muiltiple worksheets.  I was also told that using OWC doesn't let you color code or format cells.  Is this true?
0
 
LVL 46

Expert Comment

by:fritz_the_blank
Comment Utility
As I had mentioned in a separate thread, I don't use OWC (for many of the reasons that you are experiencing at the moment!) but use the XML approach instead (faster, easier on the resources, less flaky, it's the future of MS technology and etc.).

Having said that, if you want to work through this problem, then I suggest that we continue on with our little test page and add functionality bit by bit. You will notice, for example, your pesky error has already dissappeared....

FtB
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
OK so you are saying not to use Excel.Application or OWC.Spreadsheet then?   Then where is the info on why here?
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
forget it, I'm closing this post, this is driving me crazy.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
Comment Utility
We can do OWC if you like, but you asked me about this in a different thread, and I showed you how I do this.

The test page that I am talking about, the one that we started above, is a good way to work through the OWC approach. We have successfully created the object without the error that you were getting previously. The next few steps would be to try to add functionality a bit at a time and test along the way until we get where we need to go.

FtB
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
If my question was not answered, then I don't PAQ the question because that in turn results in a crap KB post in the Experts-exchange forum.  While I sincerely appreciate all the effort eveyone has given, I have to be considerate and only PAQ answers that resolve my problem.  IN this case, I don't think this problem can be resolved as we have seen.
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
I have come across this argument many times.  PAQ means closing a post because someone has resolved or helped you resolve your issue.  Nothing in here has resolved it so PAQ does not apply.  The points should not be the #1 influence on why you PAQ a post.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
Comment Utility
It all depends how much effort that you want to put into it I guess. For the sake of the PAQ, here is a great source for this question:

http://www.4guysfromrolla.com/webtech/051502-1.shtml

Fritz the Blank
0
 
LVL 6

Expert Comment

by:Lord_McFly
Comment Utility
:)
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
yes, I have the article.  by my post in this one was first based on trying to use the Excel.Application but seems as though your response to my other posts (which I PAQ'd for you) are all based on a hybrid way of doing so...which you say is the only way...via XML.  I am still trying to figure otu if there is still a way to do it via OWC or Application.Excel which is why I posted this new thread.  I sent an email to you because I needed you to clear up the differences between Excel.Application and OWC.Spreadsheet

I don't feel I have gotten anywhere but a mess..not because of you but I don't think it is possible to do this level of integration with ASP and Excel and if there is, what a waste of time.

sorry, I am frustrated at this point and feel that this post has not gotten to my resolution.
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
You may see that I post again on this subject.  Feel free to ignore it because I'm sure there is someone who can really get to the bottom of helping me understand the differences between Excel.Application, OWC.Spreadsheet, the history of each, why each is good or bad, etc.

I have yet to find real good documentation on this and have about 8 websites with examples that are half ass and incomplete.  They dive in to pieces of it but don't really give you the history or full overview of this subject.  Most of them only deal with Response.ContentType="application/vnd.ms-excel" which is worthless
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
I meant feel free to ignore it because you'll probably become frustrated if you see me post again..because I will when I find out more.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
Comment Utility
>> I sent an email to you because I needed you to clear up the differences between Excel.Application and OWC.Spreadsheet<<

This syntax is for office automation (okay for client machines but a bad idea for servers--even Microsoft says so)--Please avoid it:

Server.CreateObject ("Excel.Application") has to do with office automation.



This is the syntax for creating an Office Web Component:


Set objSpreadsheet = Server.CreateObject("OWC.Spreadsheet")

Fritz the Blank
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
>>This syntax is for office automation (okay for client machines but a bad idea for servers--even Microsoft says so)--Please avoid it:

>>erver.CreateObject ("Excel.Application") has to do with office automation.

>>This is the syntax for creating an Office Web Component:

>>Set objSpreadsheet = Server.CreateObject("OWC.Spreadsheet")


I don't understand what "office automation" means in context here

I don't understand what Web component means here and what the difference is between the two above

0
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 500 total points
Comment Utility
Ah, I see! I am sorry for not getting that earlier--I was under the impression that you knew what these meant but remained unsure about what syntax goes with what.

Office Automation actually creates an instance of the application running in memory on your server. So, once you do this:

Server.CreateObject ("Excel.Application")

a copy of Excel is actually running on your server! You can verify this by looking at your task manager--it will appear as a process. Moreover, if many people access this page simultaneously, you will see multiple instances of the application running. I am sure that you can see how that could very quickly become a resource issue, especially if a few of the pages hang for one reason or another.

OWC on the other hand, does not do this. Instead, it relies on a series of COM components to create the necessary objects. Doing it this way is less resource intensive and lends itself to fewer complications.

Fritz the Blank
0
 
LVL 1

Author Comment

by:dba123
Comment Utility
Should I have known this and if so, how?  I don't usually have time to read the entire web on this stuff....just curious to your thoughts on this.  I feel sometimes like I am the only one who doesnt' know this or something on some things.

thanks
0
 
LVL 46

Expert Comment

by:fritz_the_blank
Comment Utility
This is an area of great complication! Bosses see it somewhere and then all of a sudden demand it without knowing the issues.

To further problematize this, there are a number of third-party components that allow you to create graphs, charts and etc.

Should you have known about this? Probably not. Most people don't really learn the issues and the details until they need to implement something, and then at that point, they research the feasibility and etc. At least that's the case with me....

Fritz the Blank
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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 information …
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/…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
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

8 Experts available now in Live!

Get 1:1 Help Now