Content control id got changed if i open word doc using web browser control and on closing another word doc RRS feed

  • Question

  • I am using web browser control in my application to open word document 2007 written in c#.

    Here is the code

    public void axWebBrowser1_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e)
                Object o = e.pDisp;
                if (o != null)
                    oDocument = o.GetType().InvokeMember("Document", BindingFlags.GetProperty, null, o, null);
                    Object oApplication = o.GetType().InvokeMember("Application", BindingFlags.GetProperty, null, oDocument, null);
                    if (oApplication != null)
                      wdApplication = oApplication as Microsoft.Office.Interop.Word.Application;
                      //Object oName = o.GetType().InvokeMember("Name", BindingFlags.GetProperty, null, oApplication, null);
                      //MessageBox.Show("File opened by: " + oName.ToString());

    after opening above document and user can add content control in my application and save content control id in xml.

    if i open another word document in MS word separately during my application running and close this document and after that if i close my close application then my content control id got  changed

    can anyone tell what is the issue in my code?


    Monday, March 11, 2013 6:56 AM

All replies