Пример #1
0
        private void SaveAsPDF()
        {
            try
            {
                Word.Document doc = this.Application.ActiveDocument;

                DocContent.UpdateDateModifiedCtrls(doc);
                DocContent.SaveDocumentAsPDF(doc,
                                             documentEditProperties[doc.Name].PDFFullName);
            }
            catch (System.IO.IOException ex)
            {
                MessageBox.Show(string.Format("The following error occurs while saving the document into PDF format: {0}", ex.Message), "Error on saving as PDF");
            }
            catch (Exception ex)
            {
                logger.LogException(LogLevel.Error, "SaveAsPDF", ex);
            }
        }
Пример #2
0
        private void eventInterface_DocumentBeforeSave(Word.Document Doc, ref bool SaveAsUI, ref bool Cancel)
        {
            try
            {
                //this is done as a substitution for AfterSave event!
                Cancel   = true;
                SaveAsUI = false;

                string oldName = Doc.Name;
                Doc.Saved = false;

                DocContent.UpdateDateModifiedCtrls(Doc);

                Doc.Save();

                ResetDocumentInDictionary(Doc, oldName);
            }
            catch (Exception e)
            {
                logger.LogException(LogLevel.Error, "eventInterface_DocumentBeforeSave", e);
            }
        }
Пример #3
0
        private void eventInterface_DocumentBeforeClose(Word.Document Doc, ref bool Cancel)
        {
            try
            {
                //if (Doc.Name.ToUpper().Contains(TEMPLATE_EXT))
                //    return;
                if (!Doc.Name.ToUpper().Contains(TEMPLATE_EXT) && documentEditProperties.ContainsKey(Doc.Name) && documentEditProperties[Doc.Name].IsSAPOL)
                {
                    DocContent.UpdateDateModifiedCtrls(Doc);
                }
                if (documentEditProperties.ContainsKey(Doc.Name))
                {
                    ReleaseSignatureInfo(documentEditProperties[Doc.Name]);
                }

                // Remove task pane
                RemoveTaskPaneFromWindow(Doc.ActiveWindow);
            }
            catch (Exception e)
            {
                logger.LogException(LogLevel.Error, "eventInterface_DocumentBeforeClose", e);
            }
        }