/// <summary> /// Downloads page content, opens the page in word and marks the documents as saved. /// </summary> /// <param name="_pageFullName">Page full name.</param> private void GetPage(Object _pageFullName) { try { //Download page content string pageFullName = _pageFullName.ToString(); PageContentDownloader pageContentDownloader = new PageContentDownloader(ref addin, _pageFullName.ToString(), Client, pageConverters); pageContentDownloader.Perform(); string localFileName = pageContentDownloader.GetResults(); //Register new local filename as a wiki page. addin.EditedPages.Add(localFileName, pageFullName); addin.CurrentPageFullName = pageFullName; //Since the page exists on server, consider it published addin.CurrentPagePublished = true; if (addin.PublishedStatus.ContainsKey(pageFullName)) { addin.PublishedStatus[pageFullName] = true; } else { addin.PublishedStatus.Add(pageFullName, true); } //Open the file with Word HTMLDocumentOpener htmlDocOpener = new HTMLDocumentOpener(addin, localFileName); try { htmlDocOpener.Perform(); } catch { } //MS Word might thing some modal forms are still opened Word.Document doc = htmlDocOpener.GetResults(); doc.Activate(); newDoc = doc; if (doc != null) { //Mark just-opened document as saved. This prevents a silly confirmation box that //warns about unsaved changes when closing an unchanged document. doc.Saved = true; } } catch (Exception ex) { UserNotifier.Error(ex.Message); } }
/// <summary> /// Downloads page content, opens the page in word and marks the documents as saved. /// </summary> /// <param name="_pageFullName">Page full name.</param> private void GetPage(Object _pageFullName) { try { //Download page content string pageFullName = _pageFullName.ToString(); PageContentDownloader pageContentDownloader = new PageContentDownloader(ref addin, _pageFullName.ToString(), Client, pageConverters); pageContentDownloader.Perform(); string localFileName = pageContentDownloader.GetResults(); //Register new local filename as a wiki page. addin.EditedPages.Add(localFileName, pageFullName); addin.CurrentPageFullName = pageFullName; //Since the page exists on server, consider it published addin.CurrentPagePublished = true; if (addin.PublishedStatus.ContainsKey(pageFullName)) { addin.PublishedStatus[pageFullName] = true; } else { addin.PublishedStatus.Add(pageFullName, true); } //Open the file with Word HTMLDocumentOpener htmlDocOpener = new HTMLDocumentOpener(addin, localFileName); try { htmlDocOpener.Perform(); } catch { } //MS Word might thing some modal forms are still opened Word.Document doc = htmlDocOpener.GetResults(); doc.Activate(); newDoc = doc; if (doc != null) { //Mark just-opened document as saved. This prevents a silly confirmation box that //warns about unsaved changes when closing an unchanged document. doc.Saved = true; } } catch (Exception ex) { UserNotifier.Error(ex.Message); } }