Word Dokument öffnen!

Klobow

Mitglied
Hallo,

ich möchte aus einer ASP.NET Anwendung, ein vorhandenes Worddokument öffnen, etwas reinschreiben und das Dokument wieder schließen!

Mein Code:
Code:
object fileName = "C:\\...\\bla.doc";
object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing.Value;

Word.ApplicationClass oWordApp = new Word.ApplicationClass();
Word.Document oWordDoc = oWordApp.Documents.Open(ref fileName, 
          ref missing,ref readOnly, 
          ref missing, ref missing, ref missing, 
          ref missing, ref missing, ref missing, 
          ref missing, ref missing, ref isVisible, 
          ref missing,ref missing,ref missing, ref missing);
oWordDoc.Activate();
oWordApp.Visible = true;
oWordApp.Selection.TypeText("test");
oWordApp.Selection.TypeParagraph();
oWordDoc.Save();
WordApp.Application.Quit(ref missing, ref missing, ref missing);
Das ganze funktioniert in einer Windowsandwendung einwandfrei! In der Webapplikation allerdings bekomme ich hier :
oWordApp.Documents.Open(...
den Fehler:
"Befehl misslungen"

hab mir auch mal ein kleines Programm von TheCodeprojekt geholt: hier
Der Code ist im Prinzip der selbe! -> Die Fehlermedlung leider auch!

Der unterschied bei mir zu Bsp. von Codeproject, ich verwende die
"Microsoft Word 11.0 Object Library" in der Version 8.3 und nicht
"Microsoft Word 10.0 Object Library" Version 8.2

Danke schonmal für die Antworten

gruß
Tobias
 
Zurück