[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
ASPFAQ_Open_Application_Client_Side

How to open an MS Word application on the client?

The example shows how to open an MS Office Word application on the client. It can be useful when dealing with lots of documents in a proprietary format that the users want to view or edit but the ISP of the website may not allow to run the specific application on their server.

Normally clicking on a link such as <a href="some.doc">A Word document[/b]</a> the browser will try to open and display the file in the application associated with the file type in the href attribute.

However, if you wish to manipulate this programatically or want to do more with the file's content eg. editing or saving (will be shown in further examples) then you can open an application as in the examples below.

In this case JavaScript or VBScript can be embedded in the ASP page that will run on the client.

JavaScript example:

<script language="javascript" type="text/javascript">
function runApp() {
  var appWord = new ActiveXObject("Word.Application");
  appWord.Visible = true; }
</script>


Use the new ActiveXObject command to create a new application object then set its visibility property to true.

VBScript example:

<script language="vbscript" type="text/vbscript">
Sub runApp()
  Set appWord = CreateObject("Word.Application")
  appWord.Visible = True
End Sub
</script>


Use the CreateObject command to create a new application object then set its visibility property to true.

Related threads:
open server side file

Back to ASP FAQ

last edited (April 29, 2004) by lillu, Number of views: 4877, Current Rev: 2 (Diff)

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  

Members

Username:

Password:


Register
Forgot Password?




Programmers Heaven - for .NET, Java, C/C++ and WEB Developers!
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Tore Nestenius at .NET Consultant - Synchron Data.