Brett
 
You can actually access your COM object on a seperate machine than your web server.  Just have to specify 'remote' in the context attribute and make sure your CF server is logged in as administrator under services.  You also have to access is via the ClassID instead of the ProgID.  (You can find the ClassID's of installed apps under \HKEY_CLASSES_ROOT\CLSID\)
 
<cftry>
    <!---
  try to connect to the object
 --->
    <cfobject action="CONNECT"
  class={00020900-0000-0000-C000-000000000046}
  name="objWord" type="COM"
        context="REMOTE"
  server="\\myservername">
  <cfcatch>
    <!---
  object hasn't been created, so create one
 --->
 <cfobject action="CREATE"
  class={00020900-0000-0000-C000-000000000046}
  name="objWord" type="COM"
        context="REMOTE"
  server="\\myservername">
  </cfcatch>
</cftry>
<cfscript>
     objDocuments = objWord.Documents;
     myDocument = objDocuments.Add();
     myDocument.SaveAs("c:\testDocument.doc");
</cfscript>
 
Just go to the object model def at msdn to get all the goodies on methods and props.
 
The above code just executes the creation of the object and saves a document file locally.  Of course you can do all the clever features of word.  One of my favorites is using it not to create word docs, but instead leech the spell checker capability out of it for my web apps.   =D   Once made a web based thesaurus in about 10 minutes even - lol.
 
By the way, Microsoft not only does not support server-side automation of the office tools, the detest it. (but not in violation of any user agreements as in some cases "unavoidable")  Mwuhahahahaha - all the more reason to do it!      >=)
 
Whats up with makin me use my brain on the weekend?  Phhhhttt.....  Pass the Ziegen.
 
=P
 
Nate Nielsen
817.726.8644
 
----- Original Message -----
Sent: Saturday, February 16, 2002 3:22 PM
Subject: Dynamically Generate MS Word Files..

Does anyone know if you have to have a full copy of MS Word installed on an IIS web server to use ColdFusion to dynamically generate a Word document?  I was not sure there was a .dll or a set of objects that could be registered instead of having to install the MS Word software.  Any help would be appreciated..
 
Thanks,
  Brett

Reply via email to