How To Open Word Doc In Flex or ActionScript

 

Create a PDF template with Adobe Livecycle Designer with the relevant fields, send XML data to PDF remote object with the name of the XML nodes matching those of the fields in the , then your Flex applications can open PDF, or simply put the PDF file on your webserver and call it with the url, then the same thing can be done. But how to open word doc in a Flex application?

 

 

In AIR, just simply create a URLRequest that calls it from the user’s local file system. The source code like:

  1. public function clickButton():void{
  2. var request : URLRequest = new URLRequest(‘C:\documents\test.doc’);
  3. navigateToURL(request )
  4. }

Because Flex applications can communicate with javascript and VBScript, carate a Microsoft Word object with the code like following:

  1. var oApplication=new ActiveXObject(“Word.Application”);
  2. oApplication.Documents.Open(“wordFileName”);

and the file name can be passed from Flex with External interface. It will be a probably solution for most of us.

Additional, I tried to find other solutions with ask google, The following is one point from nabble.com:

Unfortunately no! Flex files are compiled into SWFs and SWF natively does not even have the capability to load an HTML files, leave alone word and excel…

And I dont think Adobe is even thinking of doing that! Atleast not with Flash Player 10…

But http://issuu.com/jackzhang1204/docs/word_test seems load the word doc perfectly.

 

A similar question of opening an excel sheet was discussed and a possible alternate for using OWC is also discussed. Because there no more details on above solution I don’t know if OWC or any Word Parser or others be used, anyway, it is not a non-solution issue, if you know anything left a comment pls.