schreibgeschütztes öffnen von Word Documenten

mupa0013

Mitglied
Hallo,

Ich hoffe mal das ich hier richtig bin.

Ich suche eine Möglichkeit aus einer Anwendung heraus Word zu starten und dort ein Document schreibgeschützt zu öffnen. (unabhängig davon ob es bereits geöffnet ist)

Das habe ich bisher:

Code:
  	public void öffneDokument(String dir,String dokument)
  	{
  		try
  		{
  			ApplicationClass app = new ApplicationClass ();
  			app.set_Visible ( true );
  			DirectoryInfo di = new DirectoryInfo(dir);
  			FileInfo[] fi = di.GetFiles(dokument);
  			if (fi.length <= 0) 
  			{
  				di = new DirectoryInfo(dir);
  				fi = di.GetFiles(dokument);
  			}
  			System.Object fileName = fi[0].get_FullName();
  			System.Object optional = Missing.Value;
  			System.Object visible = ( System.Boolean )true;
  		
  #if OFFICEXP
 			_Document doc = app.get_Documents ().Open2000 ( fileName,
  #else
  			_Document doc = app.get_Documents ().Open ( fileName,
  #endif
  				optional, optional, optional,
  				optional, optional, optional,
  				optional, optional, optional,
  				optional, visible );
  		}
  		catch(System.Runtime.InteropServices.COMException e){}
  	 }

Word wird gestartet und das Dokument wird geöffnet, nur eben nicht schreibgeschützt.

Vielen Dank im Voraus

Gruß Patricia
 
Zurück