Dynamic Word Doc in ASP

Results 1 to 2 of 2

Thread: Dynamic Word Doc in ASP

  1. #1
    Karen Allison Guest

    Default Dynamic Word Doc in ASP

    Based on selections ane field values a user selects in an asp page, I need to populate a Template Word document that loads in another browser window. Is it possible to have the asp page create the document before the document is loaded? The word document will need to be saved as another name (project number) without changing the template. I want to do this in visual basic and compile a dll that will save the document under the project number and then call word to open that specific doc. My supervisor thinks it is possible to do this in asp on the fly?? What do you think?

  2. #2
    rcmanila Guest

    Default RE: Dynamic Word Doc in ASP

    Yes, this is possible. I actually did something like this.<BR>The code looks something like this:<BR><BR>Set objWordDoc = CreateObject("Word.Application")<BR>dim strTemplate<BR>strTemplate = "MyTemplate.dot"<BR>strTemplate = Server.MapPath (strTemplate)<BR> <BR>&#039open a word document using a template<BR>objWordDoc.Application.Documents.Add strTemplate, False<BR>objWordDoc.Application.WindowState = 1 &#039wdWindowStateNormal<BR>objWordDoc.Application .ActiveWindow = "My Word Doc"<BR><BR>Set a = objWordDoc.Application.ActiveDocument<BR><BR>a.Par agraphs.Add.Range.InsertAfter strData<BR>ctr = a.Paragraphs.Count<BR>a.Paragraphs(ctr).Range.Styl e = "Style1"<BR>&#039 Style1 is a style in the template <BR><BR>WordDocFileName = "MyFolder/" & strFileName<BR>WordDocFileName = Server.MapPath (WordDocFileName)<BR>a.SaveAs WordDocFileName<BR><BR>objWordDoc.Application.Quit <BR>Set objWordDoc = Nothing<BR><BR>Good luck !!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts