How To Open Word Doc In Flex or ActionScript

MS-Word-2-icon 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 PDF template, 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:

public function clickButton():void{
var request : URLRequest = new URLRequest('C:\\documents\\test.doc');
navigateToURL(request )

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

var oApplication=new ActiveXObject("Word.Application");

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

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 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. :)

Share and Enjoy:
  • Digg
  • Facebook
  • Google Bookmarks
  • DZone
  • Reddit
  • Technorati
  • StumbleUpon
  • Twitter
RSS Enjoy this Post? Subscribe to

RSS Feed   RSS Feed     Email Feed  Email Feed Follow us Follow us
You can leave a response, or trackback from your own site.

8 Responses to “How To Open Word Doc In Flex or ActionScript”

  1. Peter says:

    Do you have any ideas about how to transform MS office documents to SWF directly? Looking forward your help!

  2. says:

    You can find some solutions like or others, it seems all of them based virtual printer converting printed documents(xls, doc, pdf… etc) into flash swf. But I don’t think you can do it “directly” like you open word doc in flex or actionscript.

  3. choi says:

    Well,I not hava some solutions with you,but I find a software can conver word document to swf in yestarday.It’s Macromedia FlashPaper 2,so we can get a swf file.Maybe you can use the “<mx:SWFLoader " to load the swf in flex.
    Now,I have a question,it's how to operater the loaded swf,for example,how to get the word-swf's current page in flex,get the word-swf's focus for roll!Can you get me some idea?Thanks..

  4. Thanks for the snippet. It worked like a charm.

    Satheesh C.

  5. Tahir Alvi says:

    Very nice work

    Thanks buddy.

  6. Laynechin says:

    I have other solution to this.
    Firstly, create document in Word, save as .pdf.
    Then upload your pdf at They do the rest for you.

  7. Naso says:

    Hi Ntt,

    Please excuse my ignorance but I would like to ask you for some clarification.

    In your article you are saying: “… create a Microsoft Word object with the code like following:” followed by two lines of code.

    My question is: where do you put those two lines? The code looks like AS but I am not familiar with ActiveXObject and I was wandering if it needs to be imported … or is it an IE’s object?

    In short my goal is to work out how to interact with MS Word form within Adobe Air.

    Thank you very much in advance!



  8. greg says:

    issuu and other solutions (like great converts other than PDF (including doc or xls) format into PDF and then converts it to Flash. converts lots of document types into flash flipbook.

Leave a Reply