Viewing Word Doc in IE6

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CliveGL2
    New Member
    • Aug 2010
    • 5

    #1

    Viewing Word Doc in IE6

    Using XPSP2, Visual Studio 2005, ASP.NET 2.0 IE6, OFFICE 2003. Have seen similar questions but no working solution - as yet. Am trying to open a WORD document in IE6 in a Client - Server APP. The line in my ASP.NET Web page :

    Code:
     ......
    <p>Click <a href="Test.doc" target ="_blank"> here </a> to View Test Document</p> .....
    works fine as long as the file 'Test.doc' is in the SAME directory as the Web page. If I try to redirect to another directory such as "C:\\Test.d oc" it doesnt work. Have tried all combinations of forward/back/double slashes and quotes to no avail.

    Failing that another approach using Javascript in a separate html file called 'WordView.html' was ....

    Code:
     ....
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    
    <script type="text/javascript" language="javascript ">
    
    function runDoc(docFile)
    {
       var wordApp = new ActiveXObject('Word.Application');
           wordApp.Documents.Open(docFile);
           wordApp.visible = true;
    }
    
    </script>
    
    
    <head runat="server">
        <title>Word Document Test Page</title>
    </head>
    
    <body>
    
    <a href="#" onclick="runDoc('C:\\Test.doc'); return false;">View Test Document</a>  
    
    </body>
    </html>
    .....
    If loaded straight into IE6 works fine except for some security alerts. However if I call the SAME page from my ASP.NET Web page using

    Code:
    .....
      <p>Click <a href="WordView.html" target ="_blank" >  here  </a> to View Test Document</p>
    The page loads into IE6 OK but clicking the link just puts up an "Error on Page .. " message.

    A solution along the lines of the first option would be preferable as there are no security alerts to deal with. However ANY help would be greatly appreciated.
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    is it doc that you have on the server? you cannot access files on a remote client ... if that is your intention?

    Comment

    • CliveGL2
      New Member
      • Aug 2010
      • 5

      #3
      Thanks for replying Gits, actually you may have a good point there as I have only been running the code on my development system which is configured to act as both Server and Client. The .doc files ARE on the SERVER. I thought however that as both approaches seemed to work to some extent then it had to be a coding problem or more specifically something in ASP.NET. Presumably if you are right then running it on a PROPER Server-Client configuration will mean that even the limited functionality I have now, will not work. I will try that and see what happens. Thanks again for replying.

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        if you basically want to deliver the doc-files from your server, then there are some different options. when you want to have the docs simply referred in links on your page then they would need to be placed in a 'web-accessible' folder. another options would be to read the file with a reader in serverside script and sending the content with the appropriate headers - while the first would be the easiest way the second would allow to send such content through an XMLHttpRequest.

        Comment

        • CliveGL2
          New Member
          • Aug 2010
          • 5

          #5
          Thanks again Gits. Have now installed the App on my proper Client-Server setup. The 'first' option ran as before. The doc file was in the 'Project' directory on the SERVER and displayed OK on the client. When the file was removed, IE posted an Error 404 message so I feel confident that the file being displayed IS the one on the Server. The 'Javascript' version now works but ONLY when the file is on the C:\ drive of the CLIENT i.e. "C:\\Test.d oc" which of course is not what I want. Your last reply talks about a 'Web-accessible' folder. How can I make this such as "C:\TestDocs\Te st.doc" instead of the 'project' folder which is currently something like "C:\Projects\CV S" where the "C:\Tests\Test. doc" folder just contains Word documents.
          Again many thanks for your help.

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5390

            #6
            the 404 error is the result of refering to a file which the webserver cannot access ... it is a bad idea to make the entire c-drive accessible for the web ... i think you could imagine why :) ... so you should put the relevant docs somewhere in your webroot - i guess you use MS IIS due to the ASP.NET requirements? don't exactly remember where IIS has its webroot but i think it's something like c:\inetpub\ or similar? so your docs should recide somewhere in that folder - it might be that you could configure IIS to use other locations - but as i said - i'm not very familiar with MS-stuff since i avoid to use it - but searching the web should give you a lot of hits with IIS configuration hints -> you might even ask here at bytes.com in this forum.

            Comment

            • CliveGL2
              New Member
              • Aug 2010
              • 5

              #7
              Yes I should have said the 404 Error was "Page Not Found" Yes I am using IIS and your reference to C:\inetpub has jogged my memory on something I read a while back. I will go and look that up and see where we go from there. Meanwhile thank you very much for all your help I feel more confident now of cracking this one.
              Best Regards
              CliveGL2

              Comment

              Working...