Creating a Word document on server 
Author Message
 Creating a Word document on server

An intranet application I'm working on needs to be able to create a Word
document on the server and populate it with various items of data in the
Request.Form collection.

At first I was not able to do this because of AspAllowOutOfProcComponents
not being set. I set this in a script and restarted the server. Now I am
getting the following message:

Server.CreateObject Access Error

/KF/Register.asp, line 94

The call to Server.CreateObject failed while checking permissions. Access is
denied to this object.

in response to this line of code:

Set oWordApp = Server.CreateObject ("Word.Application")

An instance of WinWord is being started every time this line is called, but
no reference to the Application object is being returned. In the directory
where Winword is stored, "All Users" are granted "Full Access" permission.

Does anyone know what I need to do to allow creation of this object?



Sat, 21 Jul 2001 03:00:00 GMT  
 Creating a Word document on server
First you must create a text file on the server, to do this you must specify
the location and the name of the file you want to create. Be carefull to
specify write permission on the virtual directory where you want to create
the name ( otherwise it will generate an error of creation)

the code is the following :

fileword="name_of_the_ file.doc"
filePath= Server.mapPath("\your_virtual_directory")
Filename= filepath & "\" & fileword

set fs=Server.CreateObject("Scripting.FileSystemObject")
set myfile=fs.createtextfile(filename,True)

If Err.Number > 0 Then
   response.redirect "Error_page.asp"
End If

Now you have a text file open on the server and all you have to do, it's to
write on it .

i.e : you want to write my name, and a shor description. the code must be:

myfile.writeline "gabriel garcia"
myfile.writeline "It's a system engenering that help me with my problem"

when you finish to write on you text file, you must close all the objects
you use in the creation:

set myfile=nothing
set fs=nothing

I hope this code work fine for ypur purposes.
If you have any problem just e-mail me



Mon, 23 Jul 2001 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Creating a Word document on server

2. Generating word document files from embedded documents in Access or SQL Server DB.

3. Creating Word documents from an Embedded OLE Word Template

4. Cutting a full Word document and pasting it in another Word Document

5. Creating Word Documents via ASP, JScript, Etc

6. Creating Word Document from Form Entry on Web Pages

7. Creating and opening a Word document

8. Creating table in Word document from VB Script

9. Creating word documents

10. Creating a word document

11. problem creating PS document from MS-WORD file.

12. Creating a Word Document from ASP....?


Powered by phpBB® Forum Software