DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Fri, 29 Jun 2007 01:24:35 -0700,    posted on: microsoft.public.dotnet.framework.interop        back       

Thread Index
  1    unknown
          2    kris
          3    unknown
                 4    Mark Smith


Read-Only Word document in AxWebBrowser   
Hi,

I've been trying to find a way to host a 'view' of a Word document in
a Windows Forms app. Ideally I'd like it to be just the document; no
controls or toolbars, and certainly no editing functionality. It seems
that the recommended way is to us the WebBrowser control, and to be
able to access the document once opened, the AxWebBrowser control.

I have the document opening in the web browser control using the
Navigate method and a handler on the NavigateComplete2 event. Getting
the Word document is simple enough, and removing unwanted UI elements
such as toolbars and rules is also easy. However, I can't figure out
how to force the web browser control to open the document read only.
It seems that in the Word object model, the read only flag is a
parameter to the Application.Documents.Open() method, which I never
call thanks to the Navigate interface of the web browser.

Is there a way to force the document to be read only? I thought about
using the document properties, to no avail.

A secondary query I have is that I can't figure out how to remove the
view selection buttons from the horizontal scrollbar without removing
the entire scrollbar. I'd like the view locked to the Print View, and
don't want the user changing.

Any help would be greatly appreciated.

Thanks,

Craig
Date:Fri, 29 Jun 2007 01:24:35 -0700   Author:  

Re: Read-Only Word document in AxWebBrowser   
Hi Craig,

I was trying the similar thing last week and i wasn't able to open the word 
document in the browser window....
The word document opens outside the browser.

can you please send me the code snippet on how i can open the word doc in 
the browser?

Thanks
Kris

 wrote in message 
news:1183105475.041175.266490@c77g2000hse.googlegroups.com...

> Hi,
>
> I've been trying to find a way to host a 'view' of a Word document in
> a Windows Forms app. Ideally I'd like it to be just the document; no
> controls or toolbars, and certainly no editing functionality. It seems
> that the recommended way is to us the WebBrowser control, and to be
> able to access the document once opened, the AxWebBrowser control.
>
> I have the document opening in the web browser control using the
> Navigate method and a handler on the NavigateComplete2 event. Getting
> the Word document is simple enough, and removing unwanted UI elements
> such as toolbars and rules is also easy. However, I can't figure out
> how to force the web browser control to open the document read only.
> It seems that in the Word object model, the read only flag is a
> parameter to the Application.Documents.Open() method, which I never
> call thanks to the Navigate interface of the web browser.
>
> Is there a way to force the document to be read only? I thought about
> using the document properties, to no avail.
>
> A secondary query I have is that I can't figure out how to remove the
> view selection buttons from the horizontal scrollbar without removing
> the entire scrollbar. I'd like the view locked to the Print View, and
> don't want the user changing.
>
> Any help would be greatly appreciated.
>
> Thanks,
>
> Craig
> 
Date:Wed, 4 Jul 2007 09:32:34 +0530   Author:  

Re: Read-Only Word document in AxWebBrowser   
On 4 Jul, 05:02, "kris"  wrote:

> I was trying the similar thing last week and i wasn't able to open the word
> document in the browser window....
> The word document opens outside the browser.
>
> can you please send me the code snippet on how i can open the word doc in
> the browser?


Hi Kris,

I have seen this happen a few times. I used this code:

            String strFileName;

            //Find the Office document.
            openFileDialog1.FileName = "";
            openFileDialog1.ShowDialog();
            strFileName = openFileDialog1.FileName;
            if (strFileName.Length != 0)
            {
                axWebBrowser1.Navigate(strFileName);
            }

This usually works, but if I double-click the file in the open dialog
it will open in an external Word instance. If I select the document
and click OK it will pass the string back properly. This seems to be a
bug in the default implementation of the File dialog rather than the
web browser control.

The only other time I have seen the document open outside the browser
window is when I used the Windows Forms WebBrowser control. It seemed
to try and save the document to the desktop instead of open it, and
when I tried to force it open it opened externally.

On the subject of making a document read only, I found that using the
Document.Protect() method seems to be the way to go. Unfortunate, if
the user presses a key when the document is protected it makes a task
pane appear in the middle of your app ... not ideal, and there doesn't
seem to be a way around it.

HTH,

Craig
Date:Wed, 04 Jul 2007 03:16:40 -0700   Author:  

Re: Read-Only Word document in AxWebBrowser   
I want to something similar.  I want to take information in a database
and create a word document with it.  I have the information displaying
in a windows form with different tabs to show the different areas for
input.  I want to be able to press a button and have the information put
into the proper format (which I will specify) and be able to save it in
a word document format.  Any ideas?



*** Sent via Developersdex http://www.developersdex.com ***
Date:Wed, 11 Jul 2007 08:17:00 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us