Quantcast
Channel: NetOffice - MS Office in .NET
Viewing all articles
Browse latest Browse all 1741

Commented Unassigned: Is there a way to make Word open in readonly and not be able to edit the document [21132]

$
0
0
I can open a Word document as readonly so the [Read-only] shows but I want to disable the editing too. Is there additional options to stop people from being able to edit the document?
Comments: ** Comment from web user: ekirk0 **

Apply protection mode.

```
NetOffice.WordApi.Application app = new NetOffice.WordApi.Application();
app.DisplayAlerts = NetOffice.WordApi.Enums.WdAlertLevel.wdAlertsNone;
app.Visible = true;

NetOffice.WordApi.Document doc = app.Documents.Open(filename, false, true);

doc.Protect(NetOffice.WordApi.Enums.WdProtectionType.wdAllowOnlyReading, false, "password");
```


```
NetOffice.WordApi.Application app = new NetOffice.WordApi.Application();
app.Visible = true;
NetOffice.WordApi.ProtectedViewWindow window = app.ProtectedViewWindows.Open(filename);

```


Viewing all articles
Browse latest Browse all 1741

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>