I created a custom tag to open an Word XML file and save it as a word document 
file.   I believe that the constant for wdFormatDocument is 0, and that is the 
value that I am passing to second paramter in the SaveAs method.  However, the 
file is not saved as Word Document format.  It is still XML, except that the 
filename is changed to name given by the ATTRIBTUES.docFileName parameter.  Any 
ideas as to what I'm doing wrong?

Thanks,
Kin Wong



<!--- Initialize Tag Parameters --->
<!--- Required Parameters --->
<cfparam name="ATTRIBUTES.xmlFileName" type="string">
<cfparam name="ATTRIBUTES.docFileName" type="string">

<cflock name="MicrosoftWordCOM" type="readonly" timeout="30">
        <cfset IsWordLoaded = IsDefined("APPLICATION.COMObjects.msWord")>
        <cfif IsWordLoaded>
                <cfset wordApp = APPLICATION.COMObjects.msWord>
        </cfif>
</cflock>

<cfif NOT IsWordLoaded>
        <cflock name="MicrosoftWordCOM" type="Exclusive" timeout="30">
                <cfset IsWordLoaded = 
IsDefined("APPLICATION.COMObjects.msWord")>
                <cfif IsWordLoaded>
                        <cfset wordApp = APPLICATION.COMObjects.msWord>
                <cfelse>
                        <cfobject action="create" type="COM" 
class="Word.application" name="APPLICATION.COMObjects.msWord" context="local">
                        <cfset wordApp = APPLICATION.COMObjects.msWord>
                        <cfset wordApp.Visible = False>
                </cfif>
        </cflock>
</cfif>

<cfoutput>
<cfset documents = wordApp.Documents>
<cfset documents.Open("#ATTRIBUTES.xmlFileName#")>
<cfset activeDocument = wordApp.ActiveDocument>
<cfset activeDocument.SaveAs("#ATTRIBUTES.docFileName#", Val(0))>
<cfset activeDocument.Close()>
<cfset documents = "">
<cfset wordApp = "">
</cfoutput>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:249762
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to