示例#1
0
 protected override void DownloadAfter(string fileName, Model.XModelBase model)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         XEquipmentReceiveWordTool.FillWordValue(fileName, model as Model.XVEquipmentReceiveInfo);
     }
     catch (Exception ex)
     {
         XMessageBox.ShowError(ex.Message);
         XErrorLogTool.WriteLog(ex.ToString());
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
示例#2
0
        private void Init()
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                string path = XCommon.TempPath;
                this.m_FileName = Guid.NewGuid().ToString();

                m_FileName = this.m_FileAttachmentBusiness.DownLoadFile(m_EquipmentReceiveInfo.ID,
                                                                        path, m_FileName);

                if (m_FileName != string.Empty)
                {
                    XEquipmentReceiveWordTool.FillWordValue(m_FileName, m_EquipmentReceiveInfo);
                    this.fcWord.Open(m_FileName, true, null, null, null);

                    Word.Document dct = this.fcWord.ActiveDocument as Word.Document;

                    if (dct.ProtectionType == Word.WdProtectionType.wdAllowOnlyComments)
                    {
                        dct.Unprotect();
                    }

                    if (dct.ProtectionType == Word.WdProtectionType.wdNoProtection)
                    {
                        dct.Protect(Word.WdProtectionType.wdAllowOnlyComments);
                    }
                }
                else
                {
                    XMessageBox.ShowError("未找到要打印的报告文档!");
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                XErrorLogTool.WriteLog(ex.ToString());
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }