public TemplateServiceProfile CreateTemplateServiceProfile(string key) { TemplateServiceProfile profile = new TemplateServiceProfile(); AddDataObject(key, profile); return(profile); }
/// <summary> /// reconstruct the documemnt /// </summary> public void Reconstruct() { Document Doc = Wkl.MainCtrl.CommonCtrl.CommonProfile.ActiveDoc; string filePath = Doc.FullName; if (System.Windows.Forms.MessageBox.Show(MessageUtils.Expand(Properties.Resources.ipm_ConfirmMessage, filePath), Properties.Resources.ipm_ConfirmCaption , System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { // unprotect word mainManager.MainService.BookmarkService.UnProtectDocument(); // update word bookmark and internal bookmark List <string> message = new List <string>(); IsMatchBetweenInternalAndWord(ref message, true, filePath); string key; TemplateServiceProfile templateServicePro = Wkl.MainCtrl.ServiceCtrl.CreateProfile(out key).TemplateService; templateServicePro.TemplateName = Doc.FullName; templateServicePro.FilePath = filePath; // save document Save(Doc, Doc.FullName, isReconstruct: true); Wkl.MainCtrl.CommonCtrl.CommonProfile.CurrentTemplateInfo.XmlContent = GetWordBodyOuterXml(Doc); Wkl.MainCtrl.CommonCtrl.CommonProfile.CurrentTemplateInfo.IsReConstructing = true; // close document for repair xml file ((_Document)Doc).Close(); // repair xml file if (mainManager.MainService.TemplateService != null) { mainManager.MainService.TemplateService.Repair(key); } Wkl.MainCtrl.CommonCtrl.CommonProfile.CurrentTemplateInfo.IsReConstructing = false; Wkl.MainCtrl.ServiceCtrl.RemoveDataObject(key); // re-open file System.Diagnostics.Process.Start(filePath); } }