?
Solved

Open WORD doc in seperate window without the traditional toolbars.

Posted on 2003-11-19
11
Medium Priority
?
929 Views
Last Modified: 2012-08-13
I want to open a word document in a new window without the standard MS WORD toolbars and menu's?
I want the client to just look at the document without giving him the possibility to use the MS WORD functions as SAVE, OPEN, etc.

Who can help me in this matter ???

Thanx.
0
Comment
Question by:benmarken
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 2
11 Comments
 
LVL 10

Expert Comment

by:Nushi
ID: 9778751
do you want to aloow him to change anything?
Nushi.
0
 
LVL 10

Accepted Solution

by:
Nushi earned 260 total points
ID: 9778775
Try this out

<html>

<head><title>load document</title>
<script language="JavaScript">
<!--//
function loadworddoc(){

      var doc = new ActiveXObject("Word.Application");
      var txt;
      doc.Visible=false;
      doc.Documents.Open(document.all.hello.value);
      txt = doc.Documents(document.all.hello.value).Content;
      document.all.myarea.value = txt;
      doc.quit(0);
}
function onBrowseClick() {
document.all['inp_File'].click();
}
</script>
</head>

<body>

<p><input type=button onClick="loadworddoc();" value="Load">

<p><input type=file name=hello>


<p>
<textarea name=myarea cols=50 rows=5>nothing here yet</textarea>
<br>


</body>

</html>

it will read the content of the document in to html text area.

Nushi.
0
 
LVL 11

Expert Comment

by:Zontar
ID: 9779303
There are several problems with your script, nushi:

1. ActiveX only works on MSIE/Windows.

2. You can't set the value for a file input.

3. A file input allows the browsing of the user's own local filesystem, not the filesystem on the server.

4. Furthermore it's not possible to keep someone from saving a file viewed over the Web -- if the user can view it, then a copy of it exists on the user's hard drive.

What you desire is simply not possible, Word toolbars or not. See #4 above.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Expert Comment

by:Nushi
ID: 9779499
1. Word is also windows only as far as i know.
2.
0
 
LVL 10

Expert Comment

by:Nushi
ID: 9779500
1. Word is also windows only as far as i know.
2.
0
 
LVL 10

Expert Comment

by:Nushi
ID: 9779501
1. Word is also windows only as far as i know.
2.
0
 
LVL 10

Expert Comment

by:Nushi
ID: 9779535
sorry about it i was dissconected for some reason
and i cliked tab +ENTER.

Zontar some remarks regarding your comment

1. Word is also windows only as far as i know.
2. >>You can't set the value for a file input.
    Using active x you can do it.
 try the script pand see it in action

3. it can be on network as long as you have access to it (if you have network drive mapped).

4. here you are right.
    if its opened as word document it cant be prevented since its a plug-in/ActiveX
    thats has its own framework (toolbars  for example).

:-))
Nushi.

         
0
 
LVL 11

Expert Comment

by:Zontar
ID: 9779631
Office for Mac has been around for a long time. Word files can also be opened and viewed with OpenOffice and StarOffice on Linux, BSD, and Solaris.

ActiveX is not Web programming, it's Windows programming. It's also a horrid thing to use on the Web -- it's a security hole among other things. Besides, you're not using ActiveX to set the value of the file input, it is not possible to do this -- the user's action browses and sets the value (and yes, I do know what I'm talking about -- just because I don't like ActiveX does not mean I'm ignorant of its capabilities). When you click the "Browse" button, you're presented with a file-picker. The value is NOT pre-determined. Any value you place in the value attribute is ignored by the browser. Even Microsoft is not silly/irresponsible enough to allow programmers to override this in MSIE -- it would be a huge security risk.

And even MSDN says that document.all should not be used anymore, and that you should use W3C DOM methods like document.getElementById() instead.
0
 
LVL 10

Expert Comment

by:Nushi
ID: 9779662
>>Office for Mac has been around for a long time. Word files can also be opened and viewed with OpenOffice and StarOffice on Linux, BSD, and Solaris.

that new to me
>>document.all
i agree with you about that.
0
 

Author Comment

by:benmarken
ID: 9786681
Thanx guys but this is not the solution i was looking for.
I need a NEW window (_new) without the toolbars and menu's of msword.

The script should be used in a windows/msie environment so that should be ok.

Nushi script works ok but it does not show me the background and the headers and footer in the word document.
I guess that zontar is right that what i want is not possible.

thanx again
0
 
LVL 10

Expert Comment

by:Nushi
ID: 9786691
>> Nushi script works ok but it does not show me the background and the headers
thats beacuse my script reads the content and not the headers/footers

Nushi.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question