Solved

Move ASP to Excel - need help

Posted on 2004-04-27
70
1,255 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
ID: 10930521
try...

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

Author Comment

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

Author Comment

by:dba123
ID: 10930550
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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 10

Expert Comment

by:Shailesh15
ID: 10930555
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
ID: 10930568
And where is the function GetSaveASFilename comming from...is it just part of the ExcelSheet object?
0
 
LVL 1

Author Comment

by:dba123
ID: 10930581
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
ID: 10930589
And we do have OWC installed on our server
0
 
LVL 1

Author Comment

by:dba123
ID: 10930613
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
ID: 10930633
And Excel.Spreadsheet
0
 
LVL 6

Expert Comment

by:Lord_McFly
ID: 10930726
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
ID: 10930742
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
ID: 10930882
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
ID: 10930934
so why is mine hanging?
0
 
LVL 1

Author Comment

by:dba123
ID: 10930943
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
ID: 10931020
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
ID: 10931041
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
ID: 10931083
Ok, the problem is with line Set ExcelSheet = CreateObject("Excel.Application") which is where it is hanging.
0
 
LVL 1

Author Comment

by:dba123
ID: 10931131
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
ID: 10931170
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
ID: 10931204
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
ID: 10931250
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
ID: 10931251
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
ID: 10931259
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
ID: 10931295
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
ID: 10931388
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
ID: 10931435
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
ID: 10931470
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
ID: 10931478
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
ID: 10931479
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
ID: 10931485
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
ID: 10931538
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
ID: 10931571
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
ID: 10931617
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
ID: 10931634
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
 
LVL 1

Author Comment

by:dba123
ID: 10931649
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
ID: 10931660
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
ID: 10931716
.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
ID: 10931739
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
ID: 10931805
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
ID: 10931816
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
ID: 10931829
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
ID: 10931912
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
ID: 10932120
I am starting to think that this is an almost impossible task
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 10932126
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
ID: 10932143
I was told I do.  I will recheck to be sure.
0
 
LVL 1

Author Comment

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

Author Comment

by:dba123
ID: 10932289
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
ID: 10932314
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
ID: 10932331
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
ID: 10932345
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
ID: 10932573
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
ID: 10932617
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
ID: 10932667
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
ID: 10932683
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
ID: 10932687
forget it, I'm closing this post, this is driving me crazy.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 10932784
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
ID: 10933011
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
ID: 10933017
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
ID: 10933030
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
ID: 10933040
:)
0
 
LVL 1

Author Comment

by:dba123
ID: 10933071
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
ID: 10933098
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
ID: 10933105
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
ID: 10933108
>> 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
ID: 10933163
>>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
ID: 10933338
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
ID: 10933402
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
ID: 10933428
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

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…
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

774 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