|
-
Jun 19th, 2001, 08:06 PM
#1
Thread Starter
Lively Member
word and asp
Hi all,
In my application which will be asp we want to give the users the functionality to pull in various ms word templates. Populate some selected fields based off a database query and then open word up with one of the templates so that they could edit the letter in ms word if need be.
Im not exactily sure how to do this, what i was thinking was invoking word on the server to create the letter and then return it back by displaying a hyperlink to the users so that they could download it.
Now-how do i go about doing this and does this seem practile. We could buy a compoenet if anyone knows of any good ones.
Thanks in advance
Scott
-
Jun 19th, 2001, 10:19 PM
#2
New Member
.... Same Exact question - SAME PROBLEMS!!
I am trying to do the SAME thing and getting nowhere. You would think this would be pretty easy but I guess not. Here is the code I am using. Maybe you or someone else can get this to work.
Sub CreateWordDoc()
Dim owd
set owd = Server.CreateObject("Word.Application")
owd.Documents.Open ("c:\worddocs\lt-2-a.doc")
owd.Selection.Find.Execute "{First Name}", , , , , , , , , "David", 2
owd.Selection.Find.Execute "{Last Name}", , , , , , , , , "Adams", 2
owd.Selection.Find.Execute "{Address}", , , , , , , , , "Main St", 2
owd.Documents.SaveAs ("c:\worddocs\temp.doc")
owd.Documents.Close (0)
owd.quit
Set owd= Nothing
End Sub
I have also put the following line of code in this page and have tried it in global.asa as well. (I've also left it out with the same results)
<!--METADATA TYPE="TypeLib" NAME="Microsoft Word 9.0 Object Library" UUID="{000209FF-0000-0000-C000-000000000046}" VERSION="8.1"-->
When I run this code in straight vb and set a reference to the word 9.0 library, it runs perfectly - but when I run this from and asp page, it chokes out at the "set owd = Server.CreateObject("Word.Application")" line. It either hangs completely at this line or returns a "cannot create object" error. I can create "Excel.Application" objects just fine. What is really strange is that winword.exe opens each time I refresh or run this page and will not close! Like I said, this works fine with VB..
I have full control permissions (You really only need delete, write, read) set up for the IUSER guest account. I also have Word 2K installed on the web server which is Win2K.
This is where I got my information from..
http://msdn.microsoft.com/library/pe...00/asp0071.htm
I believe it mentions that if this app will receive a lot of traffic that you should create the object in global.asa and simply refer to that object in your code. I had zero success with this as well.
This has been totally frustrating and if anyone can help us out it would be a HUGE help!!!
-
Jun 19th, 2001, 11:03 PM
#3
Thread Starter
Lively Member
Thanks for the feedback. I tried that code that was in asp developers journal and got the following error
Spelling Results
You submitted the following:
"my name is kat"
Server object error 'ASP 0196 : 80040154'
Cannot launch out of process component
/music/spell/SpellCheck.asp, line 28
Only InProc server components should be used. If you want to use LocalServer components, you must set the AspAllowOutOfProcComponents metabase setting. Please consult the help file for important considerations.
I tried it on pws so i wonder if that has anything to do with it. Did you get that ?
-
Jun 20th, 2001, 01:25 AM
#4
New Member
I didn't get that error because I am running Win 2000 Server (IIS 5.0). PWS is IIS 4.0 and by default will not allow out of process components. You have to turn set a property (forgot which one) to turn this off (if you search msdn.microsoft.com for "AspAllowOutOfProcComponents" you will see how to fix this). IIS 5.0 allows out of process components by default.
-
Jun 20th, 2001, 08:04 PM
#5
Thread Starter
Lively Member
sounds good, thanks for the help
-
Jun 21st, 2001, 06:43 AM
#6
Black Cat
What is really strange is that winword.exe opens
So you know, when you create a Word.Application object, this is actually a running instance of MS Word (an activex exe). It won't stop until you Exit it thru code AND destroy all references to it (Set X = Nothing).
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Jun 21st, 2001, 06:50 AM
#7
Incidentally... when you mentioned giving IUSR_<SERVERNAME> appropriate permissions... I think the user you should actually be assigning permissions to is IWAM_<SERVERNAME> as in my understanding this the account that runs out of process applications for IIS.
-
Jun 22nd, 2001, 01:55 AM
#8
New Member
I finally got this bad boy to work! I found the answer here at asptoday.com. You have to pay $50.00 to be a member (12 months) but I have already found some good material well worth the 50 alone. It looks like a Wrox based site with a ton of articles from their authors.
I basically went used my vb app and created an activeX component from it and called it from the asp.
Here is the asp part:
dim x ,y
set x = server.createobject("CreateWordDoc.clsWordDoc")
y = x.GenerateDocument()
response.write y
The vb part is pretty much the same as I posted above. I had to obviously register the .dll on the server and had to set up the component with Component Manager as well (Win 2000).
Good call on the IWAM interactive user also.
Let me know if you need more info....
-
Jun 22nd, 2001, 03:12 AM
#9
Cool... am hopefully gonna get ADSL (the expensive slow upload speed late arrival of what you Yankies have had for ages ) soon so I'll be setting you my home PC as a second webserver on my domain... so I might just be using that... am gonna use it for my CV... currently I have a web page CV and a Word CV... I'd be able to generate the Word CV from the web page so it'd always be up to date. Sweet!
-
Jun 22nd, 2001, 07:00 AM
#10
Black Cat
Hey, is a CV what us Yanks would call a "resume"?
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Jun 22nd, 2001, 07:32 AM
#11
He he. I think so. 
Have a look at mine and see for yourself. There's link at the bottom of my signature.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|