Changes to MS WORD through C#

0

I am trying to save the document which i have opened through C#, I have kept the TrackRevision property of document interface also. Now I want to get the name of the person who has modified the document.In MS word I can find the name of the user from the Reviewing pane who has changed it. How can i get it through C# and after that I also need to save the same document with the same name once the user hits the save button in MS Word. Following is the code that I am executing.

public ActionResult abc()
        {
             ActionResult sc = def();

            Word.Application app = new Word.Application();
            app.Documents.Save(sc.GetType());
            return sc;

        }

public ActionResult def()
        {
            Word.Application app = new Word.Application();
            Word.Document dd = app.Documents.Open("C:\\hi12.docx");
            dd.TrackRevisions = true;
            int count = dd.Words.Count;
            dd.Save();
            dd.Close(ref Nothing, ref format, ref Nothing);
            return File(("C:\\hi12.docx"), ("application/vnd.openxmlformats-officedocument.wordprocessingml.document"), ("ank"));
        }

I am getting error at

app.Documents.Save(sc.GetType());

line in the abc(). Error is

Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))
c#
asp.net-mvc
asked on Stack Overflow Jan 1, 2013 by Ankur • edited Jan 1, 2013 by tereško

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0