Пример #1
0
        private void insertInstB(Word._Document oDoc, Guid id)
        {
            if (id == Guid.Empty)
            {
                return;
            }
            var c = baseform.PharmacyDatabaseService.GetInstrumentsBusinessLicense(out msg, id);

            if (c == null)
            {
                return;
            }
            oDoc.Bookmarks["QXJY1"].Select();
            oDoc.Bookmarks["QXJY1"].Range.Text  = c.Name;
            oDoc.Bookmarks["QXJY2"].Range.Text  = c.LicenseCode;
            oDoc.Bookmarks["QXJY3"].Range.Text  = c.UnitName;
            oDoc.Bookmarks["QXJY4"].Range.Text  = c.IssuanceOrg;
            oDoc.Bookmarks["QXJY5"].Range.Text  = c.RegAddress;
            oDoc.Bookmarks["QXJY6"].Range.Text  = c.IssuanceDate.ToLongDateString();
            oDoc.Bookmarks["QXJY7"].Range.Text  = c.OutDate.ToLongDateString();
            oDoc.Bookmarks["QXJY8"].Range.Text  = c.LegalPerson;
            oDoc.Bookmarks["QXJY9"].Range.Text  = c.Header;
            oDoc.Bookmarks["QXJY10"].Range.Text = c.QualityHeader;
            oDoc.Bookmarks["QXJY11"].Range.Text = c.BusinessScope;
            oDoc.Bookmarks["QXJY12"].Range.Text = c.WarehouseAddress;
        }
Пример #2
0
        private void insertLn(Word._Document oDoc, Guid id)
        {
            if (id == Guid.Empty)
            {
                return;
            }
            Models.LnstitutionLegalPersonLicense ln = new Models.LnstitutionLegalPersonLicense();
            ln.Id = id;
            var c = baseform.PharmacyDatabaseService.GetLnstitutionLegalPersonLicense(ln, out msg).FirstOrDefault();

            if (c == null)
            {
                return;
            }

            oDoc.Bookmarks["SY1"].Select();
            oDoc.Bookmarks["SY1"].Range.Text  = c.Name;
            oDoc.Bookmarks["SY2"].Range.Text  = c.LicenseCode;
            oDoc.Bookmarks["SY3"].Range.Text  = c.UnitName;
            oDoc.Bookmarks["SY4"].Range.Text  = c.LegalPerson;
            oDoc.Bookmarks["SY5"].Range.Text  = c.CertificateName;
            oDoc.Bookmarks["SY6"].Range.Text  = c.FundsSource;
            oDoc.Bookmarks["SY7"].Range.Text  = c.InitiaFund;
            oDoc.Bookmarks["SY8"].Range.Text  = c.Address;
            oDoc.Bookmarks["SY9"].Range.Text  = c.BussinessRange;
            oDoc.Bookmarks["SY10"].Range.Text = c.IssuanceOrg;
            oDoc.Bookmarks["SY11"].Range.Text = c.DocNumber;
            oDoc.Bookmarks["SY12"].Range.Text = c.ManageOrg;
            oDoc.Bookmarks["SY13"].Range.Text = c.IssuanceDate.ToLongDateString();
            oDoc.Bookmarks["SY14"].Range.Text = c.OutDate.ToLongDateString();
            oDoc.Bookmarks["SY15"].Range.Text = c.UseMedicalScope;
            oDoc.Bookmarks["SY16"].Range.Text = c.memo;
        }
Пример #3
0
        private void insertOrg(Word._Document oDoc, Guid id)
        {
            if (id == Guid.Empty)
            {
                return;
            }
            var c = baseform.PharmacyDatabaseService.GetOrganizationCodeLicense(out msg, id);

            if (c == null)
            {
                return;
            }
            oDoc.Bookmarks["ZZJG1"].Select();
            oDoc.Bookmarks["ZZJG1"].Range.Text  = c.Name;
            oDoc.Bookmarks["ZZJG2"].Range.Text  = c.LicenseCode;
            oDoc.Bookmarks["ZZJG3"].Range.Text  = c.UnitName;
            oDoc.Bookmarks["ZZJG4"].Range.Text  = c.OrgnizationType;
            oDoc.Bookmarks["ZZJG5"].Range.Text  = c.IssuanceOrg;
            oDoc.Bookmarks["ZZJG6"].Range.Text  = c.Code;
            oDoc.Bookmarks["ZZJG7"].Range.Text  = c.RegAddress;
            oDoc.Bookmarks["ZZJG8"].Range.Text  = c.IssuanceDate.ToLongDateString();
            oDoc.Bookmarks["ZZJG9"].Range.Text  = "无";
            oDoc.Bookmarks["ZZJG10"].Range.Text = c.RegisterNo;
            oDoc.Bookmarks["ZZJG11"].Range.Text = c.DocNumber;
        }
Пример #4
0
        private void insertMedicineBussiness(Word._Document oDoc, Guid id)
        {
            if (id == Guid.Empty)
            {
                return;
            }
            var mb = baseform.PharmacyDatabaseService.GetMedicineBusinessLicense(out msg, id);

            if (mb == null)
            {
                return;
            }
            oDoc.Bookmarks["MB1"].Select();
            oDoc.Bookmarks["MB1"].Range.Text  = mb.Name;
            oDoc.Bookmarks["MB2"].Range.Text  = mb.LicenseCode;
            oDoc.Bookmarks["MB3"].Range.Text  = mb.UnitName;
            oDoc.Bookmarks["MB4"].Range.Text  = mb.RegAddress;
            oDoc.Bookmarks["MB5"].Range.Text  = mb.IssuanceOrg;
            oDoc.Bookmarks["MB6"].Range.Text  = mb.IssuanceDate.ToLongDateString();
            oDoc.Bookmarks["MB7"].Range.Text  = mb.OutDate.ToLongDateString();
            oDoc.Bookmarks["MB8"].Range.Text  = mb.LegalPerson;
            oDoc.Bookmarks["MB9"].Range.Text  = mb.Header;
            oDoc.Bookmarks["MB10"].Range.Text = mb.QualityHeader;
            oDoc.Bookmarks["MB11"].Range.Text = mb.WarehouseAddress;
            oDoc.Bookmarks["MB12"].Range.Text = mb.BusinessScope;
        }
Пример #5
0
        private void InsertMMInst(Word._Document oDoc, Guid id)
        {
            if (id == Guid.Empty)
            {
                return;
            }
            Models.MmedicalInstitutionPermit mp = new Models.MmedicalInstitutionPermit();
            mp.Id = id;
            var c = baseform.PharmacyDatabaseService.GetMmedicalInstitutionPermit(mp, out msg).FirstOrDefault();

            if (c == null)
            {
                return;
            }
            oDoc.Bookmarks["JG1"].Select();
            oDoc.Bookmarks["JG1"].Range.Text  = c.Name;
            oDoc.Bookmarks["JG2"].Range.Text  = c.UnitName;
            oDoc.Bookmarks["JG3"].Range.Text  = c.LegalPerson;
            oDoc.Bookmarks["JG4"].Range.Text  = c.LicenseCode;
            oDoc.Bookmarks["JG5"].Range.Text  = c.RegAddress;
            oDoc.Bookmarks["JG6"].Range.Text  = c.RegisterAddress;
            oDoc.Bookmarks["JG7"].Range.Text  = c.OgnTpye;
            oDoc.Bookmarks["JG8"].Range.Text  = c.WarehouseAddress;
            oDoc.Bookmarks["JG9"].Range.Text  = c.IssuanceOrg;
            oDoc.Bookmarks["JG10"].Range.Text = c.DocNumber;
            oDoc.Bookmarks["JG11"].Range.Text = c.IssuanceDate.ToLongDateString();
            oDoc.Bookmarks["JG12"].Range.Text = c.OutDate.ToLongDateString();
            oDoc.Bookmarks["JG13"].Range.Text = c.UseMedicalScope;
            oDoc.Bookmarks["JG14"].Range.Text = c.memo;
        }
Пример #6
0
        private void insertGsp(Word._Document oDoc, Guid id, Guid UnitId)
        {
            if (id == Guid.Empty)
            {
                return;
            }
            Models.GSPLicense gsp = baseform.PharmacyDatabaseService.GetGSPLicense(out msg, id);
            if (gsp == null)
            {
                return;
            }
            oDoc.Bookmarks["GSP1"].Select();
            oDoc.Bookmarks["GSP1"].Range.Text = gsp.Name;
            oDoc.Bookmarks["GSP2"].Range.Text = gsp.LicenseCode;
            oDoc.Bookmarks["GSP3"].Range.Text = gsp.UnitName;
            oDoc.Bookmarks["GSP4"].Range.Text = gsp.IssuanceOrg;
            oDoc.Bookmarks["GSP5"].Range.Text = gsp.RegAddress;
            oDoc.Bookmarks["GSP6"].Range.Text = gsp.IssuanceDate.ToLongDateString();
            oDoc.Bookmarks["GSP7"].Range.Text = gsp.OutDate.ToLongDateString();

            oDoc.Bookmarks["GSP8"].Range.Text  = baseform.PharmacyDatabaseService.GetBusinessType(out msg, gsp.BusinessTypeId).Name;
            oDoc.Bookmarks["GSP9"].Range.Text  = gsp.Header;
            oDoc.Bookmarks["GSP10"].Range.Text = gsp.LegalPerson;
            oDoc.Bookmarks["GSP11"].Range.Text = gsp.QualityHeader;
            oDoc.Bookmarks["GSP12"].Range.Text = gsp.WarehouseAddress;
            string[] Bscope = b == null?baseform.PharmacyDatabaseService.GetBusinessScopeCodesByPurchaseUnitGuid(out msg, UnitId) : baseform.PharmacyDatabaseService.GetBusinessScopeCodesBySupplyUnitGuid(out msg, UnitId);;
            oDoc.Bookmarks["GSP13"].Range.Text = string.Join(",", Bscope);
        }
Пример #7
0
        private void insertInstP(Word._Document oDoc, Guid id)
        {
            if (id == Guid.Empty)
            {
                return;
            }
            var c = baseform.PharmacyDatabaseService.GetInstrumentsProductionLicense(out msg, id);

            if (c == null)
            {
                return;
            }
            oDoc.Bookmarks["QXSC1"].Select();
            oDoc.Bookmarks["QXSC1"].Range.Text  = c.Name;
            oDoc.Bookmarks["QXSC2"].Range.Text  = c.LicenseCode;
            oDoc.Bookmarks["QXSC3"].Range.Text  = c.UnitName;
            oDoc.Bookmarks["QXSC4"].Range.Text  = c.IssuanceOrg;
            oDoc.Bookmarks["QXSC5"].Range.Text  = c.RegAddress;
            oDoc.Bookmarks["QXSC6"].Range.Text  = c.IssuanceDate.ToLongDateString();
            oDoc.Bookmarks["QXSC7"].Range.Text  = c.OutDate.ToLongDateString();
            oDoc.Bookmarks["QXSC8"].Range.Text  = c.LegalPerson;
            oDoc.Bookmarks["QXSC9"].Range.Text  = c.Header;
            oDoc.Bookmarks["QXSC10"].Range.Text = c.ProductScope;
            oDoc.Bookmarks["QXSC11"].Range.Text = c.ProductAddress;
        }
Пример #8
0
        //质量协议书
        private void insertQualityAgreement(Word._Document oDoc)
        {
            string qa           = b == null?p.QualityAgreement: b.QualityAgreement;
            var    c            = qa.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries);
            string unitName     = string.Empty;
            string SignDate     = "";
            string outvalidDate = "";
            string DocNumber    = "";

            c.ForEach(r =>
            {
                var detail  = r.Split(new string[] { "," }, StringSplitOptions.None);
                unitName   += detail[0] + "\r\n";
                DateTime dt = DateTime.Now;
                DateTime.TryParseExact(detail[2], "yyyyMMdd", null, System.Globalization.DateTimeStyles.None, out dt);
                SignDate += dt.ToLongDateString() + "\r\n";
                DateTime.TryParseExact(detail[3], "yyyyMMdd", null, System.Globalization.DateTimeStyles.None, out dt);
                outvalidDate += dt.ToLongDateString() + "\r\n";
                DocNumber    += detail[4] + "\r\n";
            });
            oDoc.Bookmarks["QA1"].Select();
            oDoc.Bookmarks["QA1"].Range.Text = unitName.Trim(new char[] { '\r', '\n' });
            oDoc.Bookmarks["QA2"].Range.Text = SignDate.Trim(new char[] { '\r', '\n' });
            oDoc.Bookmarks["QA3"].Range.Text = outvalidDate.Trim(new char[] { '\r', '\n' });
            oDoc.Bookmarks["QA4"].Range.Text = DocNumber.Trim(new char[] { '\r', '\n' });
        }
Пример #9
0
        private void insertTax(Word._Document oDoc, Guid id)
        {
            if (id == Guid.Empty)
            {
                return;
            }
            var c = baseform.PharmacyDatabaseService.GetTaxRegisterLicense(out msg, id);

            if (c == null)
            {
                return;
            }
            oDoc.Bookmarks["SW1"].Select();
            oDoc.Bookmarks["SW1"].Range.Text  = c.Name;
            oDoc.Bookmarks["SW2"].Range.Text  = c.LicenseCode;
            oDoc.Bookmarks["SW3"].Range.Text  = c.taxpayerName;
            oDoc.Bookmarks["SW4"].Range.Text  = c.taxpayerNumber;
            oDoc.Bookmarks["SW5"].Range.Text  = c.LegalPerson;
            oDoc.Bookmarks["SW6"].Range.Text  = c.DocNumber;
            oDoc.Bookmarks["SW7"].Range.Text  = c.IssuanceOrg;
            oDoc.Bookmarks["SW8"].Range.Text  = c.BusinessScope;
            oDoc.Bookmarks["SW9"].Range.Text  = c.RegAddress;
            oDoc.Bookmarks["SW10"].Range.Text = c.IssuanceDate.ToLongDateString();
            oDoc.Bookmarks["SW11"].Range.Text = c.OutDate.ToLongDateString();
        }
Пример #10
0
        private void insertSCXKZ(Word._Document oDoc, Guid id)
        {
            if (id == Guid.Empty)
            {
                return;
            }
            var c = baseform.PharmacyDatabaseService.GetMedicineProductionLicense(out msg, id);

            if (c == null)
            {
                return;
            }

            oDoc.Bookmarks["SCXKZ1"].Select();
            oDoc.Bookmarks["SCXKZ1"].Range.Text  = c.Name;
            oDoc.Bookmarks["SCXKZ2"].Range.Text  = c.LicenseCode;
            oDoc.Bookmarks["SCXKZ3"].Range.Text  = b.Name;
            oDoc.Bookmarks["SCXKZ4"].Range.Text  = c.RegAddress;
            oDoc.Bookmarks["SCXKZ5"].Range.Text  = c.IssuanceOrg;
            oDoc.Bookmarks["SCXKZ6"].Range.Text  = c.IssuanceDate.ToLongDateString();
            oDoc.Bookmarks["SCXKZ7"].Range.Text  = c.OutDate.ToLongDateString();
            oDoc.Bookmarks["SCXKZ8"].Range.Text  = c.LegalPerson;
            oDoc.Bookmarks["SCXKZ9"].Range.Text  = c.Header;
            oDoc.Bookmarks["SCXKZ10"].Range.Text = c.CorporateNature;
            oDoc.Bookmarks["SCXKZ11"].Range.Text = c.ProductScope;
            oDoc.Bookmarks["SCXKZ12"].Range.Text = c.ProductAddress;
            oDoc.Bookmarks["SCXKZ13"].Range.Text = c.CategoryCode;
        }
Пример #11
0
 private void InsertDrugInfo(Word._Document oDoc)
 {
     oDoc.Bookmarks["T1"].Select();
     oDoc.Bookmarks["T1"].Range.Text = BugsBox.Pharmacy.AppClient.Common.PharmacyClientConfig.Config.Store.Name;
     System.Reflection.PropertyInfo[] pinfos = d.GetType().GetProperties();
     for (int i = 1; i <= 49; i++)
     {
         var    v   = pinfos[i].GetValue(d, null);
         string idx = "D" + i.ToString();
         oDoc.Bookmarks[idx].Select();
         oDoc.Bookmarks[idx].Range.Text = v == null?"": v.ToString();
     }
 }
Пример #12
0
 private void insertMarks(Word._Document oDoc, int type)
 {
     oDoc.Bookmarks["M0"].Select();
     oDoc.Bookmarks["M0"].Range.Text  = BugsBox.Pharmacy.AppClient.Common.PharmacyClientConfig.Config.Store.Name;
     oDoc.Bookmarks["M1"].Range.Text  = b.CreateDate;
     oDoc.Bookmarks["M2"].Range.Text  = b.Code;
     oDoc.Bookmarks["M3"].Range.Text  = b.Name;
     oDoc.Bookmarks["M4"].Range.Text  = b.UnitType;
     oDoc.Bookmarks["M5"].Range.Text  = b.Code;
     oDoc.Bookmarks["M6"].Range.Text  = b.SupplyCateGory;
     oDoc.Bookmarks["M7"].Range.Text  = b.DetailedAddress;
     oDoc.Bookmarks["M8"].Range.Text  = b.ContactName;
     oDoc.Bookmarks["M9"].Range.Text  = b.ContactTel;
     oDoc.Bookmarks["M10"].Range.Text = b.Fax;
     oDoc.Bookmarks["M11"].Range.Text = b.PinyinCode;
 }
Пример #13
0
 private void insertPurchaseBasicInfo(Word._Document oDoc)
 {
     oDoc.Bookmarks["M0"].Select();
     oDoc.Bookmarks["M0"].Range.Text  = BugsBox.Pharmacy.AppClient.Common.PharmacyClientConfig.Config.Store.Name;
     oDoc.Bookmarks["M1"].Range.Text  = p.CreateDate;
     oDoc.Bookmarks["M2"].Range.Text  = p.Code;
     oDoc.Bookmarks["B1"].Range.Text  = p.Name;
     oDoc.Bookmarks["B2"].Range.Text  = p.Code;
     oDoc.Bookmarks["B3"].Range.Text  = p.UnitType;
     oDoc.Bookmarks["B4"].Range.Text  = p.LegalPerson;
     oDoc.Bookmarks["B5"].Range.Text  = p.ContactName;
     oDoc.Bookmarks["B6"].Range.Text  = p.Fax;
     oDoc.Bookmarks["B7"].Range.Text  = p.PinyinCode;
     oDoc.Bookmarks["B8"].Range.Text  = p.Email;
     oDoc.Bookmarks["B9"].Range.Text  = p.WebAddress;
     oDoc.Bookmarks["B10"].Range.Text = p.District;
     oDoc.Bookmarks["B11"].Range.Text = string.Empty;
     oDoc.Bookmarks["B12"].Range.Text = p.ReceiveAddress;
     oDoc.Bookmarks["B13"].Range.Text = p.DetailedAddress;
 }
Пример #14
0
        //委托书
        private void insertDelegate(Word._Document oDoc)
        {
            string delegateDetail = b == null?p.DelegateContract: b.DelegateContent;
            var    c     = delegateDetail.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries);
            string dw    = string.Empty;
            string fr    = string.Empty;
            string wtr   = string.Empty;
            string wtrzh = string.Empty;
            string wtqs  = string.Empty;
            string wtjs  = string.Empty;
            string dah   = string.Empty;

            foreach (var r in c)
            {
                var detail = r.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                dw    += detail[0] + "\r\n";
                fr    += detail[2] + "\r\n";
                wtr   += detail[3] + "\r\n";
                wtrzh += detail[4] + "\r\n";
                DateTime dts = DateTime.Now;
                DateTime.TryParseExact(detail[5], "yyyyMMdd", null, System.Globalization.DateTimeStyles.None, out dts);
                wtqs += dts.ToLongDateString() + "\r\n";
                DateTime.TryParseExact(detail[6], "yyyyMMdd", null, System.Globalization.DateTimeStyles.None, out dts);
                wtjs += dts.ToLongDateString() + "\r\n";
                if (detail.Count() >= 8)
                {
                    dah += detail[7] == null ? "\r\n" : detail[7] + "\r\n";
                }
            }

            oDoc.Bookmarks["WT1"].Select();
            oDoc.Bookmarks["WT1"].Range.Text = dw.Trim(new char[] { '\r', '\n' });
            oDoc.Bookmarks["WT3"].Range.Text = fr.Trim(new char[] { '\r', '\n' });
            oDoc.Bookmarks["WT4"].Range.Text = wtr.Trim(new char[] { '\r', '\n' });
            oDoc.Bookmarks["WT5"].Range.Text = wtrzh.Trim(new char[] { '\r', '\n' });
            oDoc.Bookmarks["WT6"].Range.Text = dah.Trim(new char[] { '\r', '\n' });
            oDoc.Bookmarks["WT7"].Range.Text = wtqs.Trim(new char[] { '\r', '\n' });
            oDoc.Bookmarks["WT8"].Range.Text = wtjs.Trim(new char[] { '\r', '\n' });
        }
Пример #15
0
        private void InsertGMP(Word._Document oDoc, Guid id)
        {
            if (id == Guid.Empty)
            {
                return;
            }
            var c = baseform.PharmacyDatabaseService.GetGMPLicense(out msg, id);

            if (c == null)
            {
                return;
            }
            oDoc.Bookmarks["GMP1"].Select();
            oDoc.Bookmarks["GMP1"].Range.Text = c.Name;
            oDoc.Bookmarks["GMP2"].Range.Text = c.LicenseCode;
            oDoc.Bookmarks["GMP3"].Range.Text = c.UnitName;
            oDoc.Bookmarks["GMP4"].Range.Text = c.IssuanceOrg;
            oDoc.Bookmarks["GMP5"].Range.Text = c.IssuanceDate.ToLongDateString();
            oDoc.Bookmarks["GMP6"].Range.Text = c.OutDate.ToLongDateString();
            oDoc.Bookmarks["GMP7"].Range.Text = c.RegAddress;
            oDoc.Bookmarks["GMP8"].Range.Text = c.CertificationScope;
        }
Пример #16
0
        private void insertBussiness(Word._Document oDoc, Guid id)
        {
            if (id == Guid.Empty)
            {
                return;
            }
            var c = baseform.PharmacyDatabaseService.GetBusinessLicense(out msg, id);

            oDoc.Bookmarks["YYZZ1"].Select();
            oDoc.Bookmarks["YYZZ1"].Range.Text  = c.Name;
            oDoc.Bookmarks["YYZZ2"].Range.Text  = c.LicenseCode;
            oDoc.Bookmarks["YYZZ3"].Range.Text  = c.UnitName;
            oDoc.Bookmarks["YYZZ4"].Range.Text  = c.RegAddress;
            oDoc.Bookmarks["YYZZ5"].Range.Text  = c.IssuanceOrg;
            oDoc.Bookmarks["YYZZ6"].Range.Text  = c.IssuanceDate.ToLongDateString();
            oDoc.Bookmarks["YYZZ7"].Range.Text  = c.RegisteredCapital.ToString();
            oDoc.Bookmarks["YYZZ8"].Range.Text  = c.PaidinCapital.ToString();
            oDoc.Bookmarks["YYZZ9"].Range.Text  = c.CorporateNature;
            oDoc.Bookmarks["YYZZ10"].Range.Text = c.EstablishmentDate.ToLongDateString();
            oDoc.Bookmarks["YYZZ11"].Range.Text = c.BusinessScope;
            oDoc.Bookmarks["YYZZ12"].Range.Text = c.OutDate.ToLongDateString();
        }
Пример #17
0
        //银行账号
        private void insertBank(Word._Document oDoc)
        {
            string bank     = b.BankAccount;
            var    c        = bank.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries);
            string unitName = "";
            string bankName = "";
            string acount   = "";
            string memo     = "";

            c.ForEach(r =>
            {
                var detail = r.Split(new string[] { "," }, StringSplitOptions.None);
                unitName  += detail[0] + "\r\n";
                bankName  += detail[1] + "\r\n";
                acount    += detail[2] + "\r\n";
                memo      += detail[3] + "\r\n";
            });
            oDoc.Bookmarks["BK1"].Select();
            oDoc.Bookmarks["BK1"].Range.Text = unitName.Trim(new char[] { '\r', '\n' });
            oDoc.Bookmarks["BK2"].Range.Text = bankName.Trim(new char[] { '\r', '\n' });
            oDoc.Bookmarks["BK3"].Range.Text = acount.Trim(new char[] { '\r', '\n' });
            oDoc.Bookmarks["BK4"].Range.Text = memo.Trim(new char[] { '\r', '\n' });
        }
Пример #18
0
        private void insertHealth(Word._Document oDoc, Guid id)
        {
            if (id == Guid.Empty)
            {
                return;
            }
            var c = baseform.PharmacyDatabaseService.GetHealthLicense(out msg, id);

            if (c == null)
            {
                return;
            }
            oDoc.Bookmarks["WS1"].Select();
            oDoc.Bookmarks["WS1"].Range.Text = c.Name;
            oDoc.Bookmarks["WS2"].Range.Text = c.LicenseCode;
            oDoc.Bookmarks["WS3"].Range.Text = c.UnitName;
            oDoc.Bookmarks["WS4"].Range.Text = c.Header;
            oDoc.Bookmarks["WS5"].Range.Text = c.RegAddress;
            oDoc.Bookmarks["WS6"].Range.Text = c.LicenseContent;
            oDoc.Bookmarks["WS7"].Range.Text = c.DocNumber;
            oDoc.Bookmarks["WS8"].Range.Text = c.OutDate.ToLongDateString();
            oDoc.Bookmarks["WS9"].Range.Text = c.IssuanceOrg;
        }
Пример #19
0
        /// <summary>
        /// 读取 word文档 返回内容
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        public static string GetWordContent(string filePath)
        {
            try
            {
                Word._Application app   = new Word.Application();
                Type           wordType = app.GetType();
                Word._Document doc      = null;
                object         unknow   = Type.Missing;
                app.Visible = false;
                object file = filePath;
                doc = app.Documents.Open(ref file,
                                         ref unknow, ref unknow, ref unknow, ref unknow,
                                         ref unknow, ref unknow, ref unknow, ref unknow,
                                         ref unknow, ref unknow, ref unknow, ref unknow,
                                         ref unknow, ref unknow, ref unknow);
                int           count = doc.Paragraphs.Count;
                StringBuilder sb    = new StringBuilder();
                for (int i = 1; i <= count; i++)
                {
                    sb.Append(doc.Paragraphs[i].Range.Text.Trim());
                }

                doc.Close(ref unknow, ref unknow, ref unknow);
                wordType.InvokeMember("Quit", System.Reflection.BindingFlags.InvokeMethod, null, app, null);
                doc = null;
                app = null;
                //垃圾回收
                //GC.Collect();
                //GC.WaitForPendingFinalizers();
                return(sb.ToString());
            }
            catch
            {
                return("");
            }
        }
        /// <summary>
        /// 导出所选后备干部简要情况登记表
        /// </summary>
        /// <param name="idlist">所选后备干部id号集合</param>
        public void exportword(ArrayList idlist)  //建议把Datatable类型的参数传过来,建议读视图。
        {
            //弹出对话框,选择保存的路径
            #region
            string         savepath = "";
            SaveFileDialog sa       = new SaveFileDialog();
            sa.Filter   = "Document(*.doc)|*.doc";
            sa.FileName = "简要情况登记表";
            if (sa.ShowDialog() == DialogResult.OK)
            {
                savepath = sa.FileName;
            }
            else
            {
                return;
            }
            #endregion

            //创建word应用程序
            wordappliction = new Word.Application();

            //打开指定路径的内容
            #region
            object filepath = System.Windows.Forms.Application.StartupPath + "\\wordModel" + "\\简要情况.doc";
            mydoc = wordappliction.Documents.Open(ref filepath, ref missing, ref readOnly,
                                                  ref missing, ref missing, ref missing, ref missing, ref missing,
                                                  ref missing, ref missing, ref missing, ref isVisible, ref missing,
                                                  ref missing, ref missing, ref missing);
            #endregion
            ////设置word创建的word程序的可见性
            wordappliction.Visible = true;

            //将整个活动区域全部复制
            #region
            mydoc.ActiveWindow.Selection.WholeStory();
            mydoc.ActiveWindow.Selection.Copy();
            #endregion

            string selectid = "";

            for (int i = 0; i < idlist.Count; i++)
            {
                if (i == idlist.Count - 1)
                {
                    selectid = selectid + "'" + idlist[i] + "'";
                }
                else
                {
                    selectid = selectid + "'" + idlist[i] + "',";
                }
            }

            ImageCollection(selectid);

            //读取后备干部的相关信息
            string        sql        = "select * from TB_CommonInfo order by rank, joinTeam desc";
            string        cond       = "cid in (" + selectid + ")";
            DataOperation dataOp     = new DataOperation();
            DataTable     datatableT = dataOp.GetOneDataTable_sql(sql);
            DataTable     datatable  = new DataTable();
            datatable = datatableT.Clone();
            DataView dv = datatableT.AsDataView();
            dv.RowFilter = cond;
            datatable    = dv.ToTable();

            Object myobj = Missing.Value;
            for (int i = 0; i < datatable.Rows.Count - 1; i++)
            {
                //加入两段避免了最后一行文本被弄到下面
                Word.Paragraph para1;
                Word.Paragraph para2;
                para1 = mydoc.Content.Paragraphs.Add(ref myobj);
                para2 = mydoc.Content.Paragraphs.Add(ref myobj);
                object pBreak = (int)WdBreakType.wdSectionBreakNextPage;
                para2.Range.InsertBreak(ref pBreak);
                //调用粘贴方法即可粘贴剪贴板中的内容。
                para2.Range.Paste();
            }
            Shape s = null;
            for (int i = 0; i < datatable.Rows.Count; i++)
            {
                mydoc.ActiveWindow.Selection.WholeStory();
                wordappliction.Selection.Tables[2 * i + 1].Cell(1, 2).Range.Text = datatable.Rows[i]["name"].ToString(); //姓名
                wordappliction.Selection.Tables[2 * i + 1].Cell(1, 4).Range.Text = datatable.Rows[i]["sex"].ToString();  //性别;
                string age = datatable.Rows[i]["birthday"].ToString().Replace("年", ".");

                int nowAge = 0;
                int temp1  = Convert.ToInt32(datatable.Rows[i]["birthday"].ToString().Substring(5, 2));
                int now1   = Convert.ToInt32(DateTime.Now.ToString("MM"));
                int temp2  = Convert.ToInt32(datatable.Rows[i]["birthday"].ToString().Substring(0, 4));
                int now2   = Convert.ToInt32(DateTime.Now.ToString("yyyy"));
                if (temp1 <= now1)
                {
                    nowAge = now2 - temp2;
                }
                else
                {
                    nowAge = now2 - temp2 - 1;
                }
                wordappliction.Selection.Tables[2 * i + 1].Cell(1, 6).Range.Text = age.Replace("月", "") + "\n(" + nowAge + "岁)"; //出生年月

                string filepath1 = System.Windows.Forms.Application.StartupPath + "\\图片夹\\" + datatable.Rows[i]["cid"].ToString() + ".jpg";

                if (System.IO.File.Exists(filepath1))
                {
                    double height    = 0.0;
                    double width     = 0.0;
                    Image  pic       = Image.FromFile(filepath1); //strFilePath是该图片的绝对路径
                    int    intWidth  = pic.Width;                 //长度像素值
                    int    intHeight = pic.Height;                //高度像素值
                    pic.Dispose();
                    if ((double)intHeight / intWidth > 118 / 91.0)
                    {
                        height = 118;
                        width  = 118 * (double)intWidth / intHeight;
                    }
                    else
                    {
                        width  = 91;
                        height = 91 * (double)intHeight / intWidth;
                    }
                    object LinkToFile       = false;
                    object SaveWithDocument = true;
                    object Anchor           = wordappliction.Selection.Tables[2 * i + 1].Cell(1, 7).Range;

                    wordappliction.ActiveDocument.InlineShapes.AddPicture(filepath1, ref LinkToFile, ref SaveWithDocument, ref Anchor);

                    wordappliction.ActiveDocument.InlineShapes[1].Select();
                    wordappliction.ActiveDocument.InlineShapes[1].Width = (int)width;   //图片宽度

                    wordappliction.ActiveDocument.InlineShapes[1].Height = (int)height; //图片高度
                    try
                    {
                        s = wordappliction.ActiveDocument.InlineShapes[1].ConvertToShape();
                        s.WrapFormat.Type = Word.WdWrapType.wdWrapNone;
                        s = null;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    mydoc.ActiveWindow.Selection.WholeStory();
                }

                wordappliction.Selection.Tables[2 * i + 1].Cell(2, 2).Range.Text = datatable.Rows[i]["nation"].ToString();                                                      //民族
                wordappliction.Selection.Tables[2 * i + 1].Cell(2, 4).Range.Text = datatable.Rows[i]["native"].ToString();                                                      //籍贯
                wordappliction.Selection.Tables[2 * i + 1].Cell(2, 6).Range.Text = datatable.Rows[i]["birthplace"].ToString();                                                  //出生地
                string partytime = datatable.Rows[i]["partyTime"].ToString().Replace("年", ".");
                wordappliction.Selection.Tables[2 * i + 1].Cell(3, 2).Range.Text = partytime.Replace("月", "");                                                                  //入党时间
                string worktime = datatable.Rows[i]["workTime"].ToString().Replace("年", ".");
                wordappliction.Selection.Tables[2 * i + 1].Cell(3, 4).Range.Text  = worktime.Replace("月", "");                                                                  //参加工作时间
                wordappliction.Selection.Tables[2 * i + 1].Cell(3, 6).Range.Text  = datatable.Rows[i]["health"].ToString();                                                     //健康状况
                wordappliction.Selection.Tables[2 * i + 1].Cell(4, 2).Range.Text  = datatable.Rows[i]["technicalPost"].ToString();                                              //专业技术职务
                wordappliction.Selection.Tables[2 * i + 1].Cell(4, 4).Range.Text  = datatable.Rows[i]["specialtySkill"].ToString();                                             //熟悉专业有何专长
                wordappliction.Selection.Tables[2 * i + 1].Cell(5, 3).Range.Text  = datatable.Rows[i]["fullEducation"].ToString() + datatable.Rows[i]["fullDegree"].ToString(); //全日制教育
                wordappliction.Selection.Tables[2 * i + 1].Cell(5, 5).Range.Text  = datatable.Rows[i]["fullSchool"].ToString() + datatable.Rows[i]["fullSpecialty"].ToString(); //毕业院校及专业
                wordappliction.Selection.Tables[2 * i + 1].Cell(6, 3).Range.Text  = datatable.Rows[i]["workEducation"].ToString() + datatable.Rows[i]["workDegree"].ToString(); //在职教育
                wordappliction.Selection.Tables[2 * i + 1].Cell(6, 5).Range.Text  = datatable.Rows[i]["workGraduate"].ToString() + datatable.Rows[i]["workSpecialty"].ToString();
                wordappliction.Selection.Tables[2 * i + 1].Cell(7, 2).Range.Text  = datatable.Rows[i]["position"].ToString();
                wordappliction.Selection.Tables[2 * i + 1].Cell(8, 2).Range.Text  = datatable.Rows[i]["knowField"].ToString();
                wordappliction.Selection.Tables[2 * i + 1].Cell(9, 2).Range.Text  = datatable.Rows[i]["trainDirection"].ToString();       //"培养方向";
                wordappliction.Selection.Tables[2 * i + 1].Cell(10, 2).Range.Text = datatable.Rows[i]["trainMeasure"].ToString();         //"培养措施";
                wordappliction.Selection.Tables[2 * i + 1].Cell(11, 2).Range.Text = "\n" + HBresume(datatable.Rows[i]["CID"].ToString()); //"简历";

                //第二页:奖惩情况,年度考核,家庭成员关系
                mydoc.ActiveWindow.Selection.WholeStory();                                                                                      //表示在选中的范围内
                wordappliction.Selection.Tables[2 * i + 2].Cell(1, 2).Range.Text = HBrewardsAndpunishment(datatable.Rows[i]["CID"].ToString()); //"奖惩情况";
                wordappliction.Selection.Tables[2 * i + 2].Cell(2, 2).Range.Text = HByearcheck(datatable.Rows[i]["CID"].ToString());            // "年度考核结果";\

                //得到该干部的家庭信息
                DataTable famliy_dt = dataOp.GetOneDataTable_sql("select * from TB_Family where cid ='" + datatable.Rows[i]["CID"].ToString() + "'");

                int n = famliy_dt.Rows.Count; //家庭人员的个数
                for (int j = 0; j < n; j++)
                {
                    wordappliction.Selection.Tables[2 * i + 2].Cell(j + 4, 2).Range.Text = famliy_dt.Rows[j]["relationship"].ToString(); //"称谓";
                    wordappliction.Selection.Tables[2 * i + 2].Cell(j + 4, 3).Range.Text = famliy_dt.Rows[j]["name"].ToString();         //"姓名";
                    if (famliy_dt.Rows[j]["age"].ToString() == "0")
                    {
                        wordappliction.Selection.Tables[2 * i + 2].Cell(j + 4, 4).Range.Text = "";
                    }
                    else
                    {
                        wordappliction.Selection.Tables[2 * i + 2].Cell(j + 4, 4).Range.Text = famliy_dt.Rows[j]["age"].ToString(); //"年龄";
                    }
                    wordappliction.Selection.Tables[2 * i + 2].Cell(j + 4, 5).Range.Text = famliy_dt.Rows[j]["party"].ToString();   //"政治面貌";
                    if (famliy_dt.Rows[j]["remark"].ToString().Trim() == "已故")
                    {
                        wordappliction.Selection.Tables[2 * i + 2].Cell(j + 4, 6).Range.Text = famliy_dt.Rows[j]["deptJob"].ToString() + "(已故)";//"工作单位及职务";
                    }
                    else
                    {
                        wordappliction.Selection.Tables[2 * i + 2].Cell(j + 4, 6).Range.Text = famliy_dt.Rows[j]["deptJob"].ToString();//"工作单位及职务";
                    }
                }
            }
            //把文件保存在选定的保存路径上
            #region
            object path = savepath;
            //wordappliction.Documents.Save(path);
            mydoc.SaveAs(ref path, ref myobj, ref myobj, ref myobj, ref myobj, ref myobj,
                         ref myobj, ref myobj, ref myobj, ref myobj, ref myobj, ref myobj,
                         ref myobj, ref myobj, ref myobj, ref myobj);
            #endregion

            //关闭退出文档
            #region
            //关闭文档
            mydoc.Close(ref myobj, ref myobj, ref myobj);

            //退出应用程序。
            wordappliction.Quit();
            #endregion
            MessageBox.Show("导出成功!");
            return;
        }
        private void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (testStandardEnum == TestStandardEnum.default1711 && comboBox1.Text != "EN1111-2017温控报告")
                {
                    MessageBox.Show("请选择正确的模板!");
                    this.Close();
                }
                if (testStandardEnum == TestStandardEnum.default2806 && comboBox1.Text != "2806温控报告")
                {
                    MessageBox.Show("请选择正确的模板!");
                    this.Close();
                }
                object oMissing = System.Reflection.Missing.Value;
                //创建一个word实例
                Word._Application oWord = new Word.Application();
                //设置为不可见
                oWord.Visible = false;
                //模板文件地址,这里假设在程序根目录
                object oTemplate = System.AppDomain.CurrentDomain.BaseDirectory + "//" + comboBox1.Text + ".dot";
                //以模板为基础生成文档
                Word._Document oDoc = oWord.Documents.Add(ref oTemplate, ref oMissing, ref oMissing, ref oMissing);

                #region 2806
                if (testStandardEnum == TestStandardEnum.default2806)
                {
                    //声明书签数组
                    object[] oBookMark = new object[46];
                    //赋值书签名
                    oBookMark[0]  = "Pc";
                    oBookMark[1]  = "Tc";
                    oBookMark[2]  = "Ph";
                    oBookMark[3]  = "Th";
                    oBookMark[4]  = "Qm";
                    oBookMark[5]  = "Tm";
                    oBookMark[6]  = "A_1_Qc";
                    oBookMark[7]  = "A_1_Tc";
                    oBookMark[8]  = "A_1_Tcdiff";
                    oBookMark[9]  = "A_2_Qc";
                    oBookMark[10] = "A_2_Tc";
                    oBookMark[11] = "A_2_Tcdiff";
                    oBookMark[12] = "B_1_Qh";
                    oBookMark[13] = "B_1_Th";
                    oBookMark[14] = "B_2_Qh";
                    oBookMark[15] = "B_2_Th";
                    oBookMark[16] = "B_2_Thdiff";

                    oBookMark[17] = "C_1_Tm";
                    oBookMark[18] = "C_1_3";
                    oBookMark[19] = "C_1_5";
                    oBookMark[20] = "C_1_Tmdiff";
                    oBookMark[21] = "C_2_Tm";
                    oBookMark[22] = "C_2_Tmdiff";
                    oBookMark[23] = "C_3_Tm";
                    oBookMark[24] = "C_3_3";
                    oBookMark[25] = "C_3_5";
                    oBookMark[26] = "C_3_Tmdiff";
                    oBookMark[27] = "C_4_Tm";
                    oBookMark[28] = "C_4_Tmdiff";

                    oBookMark[29] = "H_1_Tm";
                    oBookMark[30] = "H_1_3";
                    oBookMark[31] = "H_1_5";
                    oBookMark[32] = "H_1_Tmdiff";
                    oBookMark[33] = "H_2_Tm";
                    oBookMark[34] = "H_2_Tmdiff";
                    oBookMark[35] = "H_3_Tm";
                    oBookMark[36] = "H_3_3";
                    oBookMark[37] = "H_3_5";
                    oBookMark[38] = "H_3_Tmdiff";
                    oBookMark[39] = "H_4_Tm";
                    oBookMark[40] = "H_4_Tmdiff";

                    oBookMark[41] = "Up_Tm";
                    oBookMark[42] = "Up_Tmdiff";
                    oBookMark[43] = "Back_Tm";
                    oBookMark[44] = "Back_Tmdiff";
                    oBookMark[45] = "TmMax";

                    //赋值任意数据到书签的位置
                    oDoc.Bookmarks.get_Item(ref oBookMark[0]).Range.Text = model_2806.Pc + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[1]).Range.Text = model_2806.Tc + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[2]).Range.Text = model_2806.Ph + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[3]).Range.Text = model_2806.Th + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[4]).Range.Text = model_2806.Qm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[5]).Range.Text = model_2806.Tm + "";

                    oDoc.Bookmarks.get_Item(ref oBookMark[6]).Range.Text  = model_2806.A_1_Qc + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[7]).Range.Text  = model_2806.A_1_Tc + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[8]).Range.Text  = model_2806.A_1_Tcdiff + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[9]).Range.Text  = model_2806.A_2_Qc + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[10]).Range.Text = model_2806.A_2_Tc + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[11]).Range.Text = model_2806.A_2_Tcdiff + "";

                    oDoc.Bookmarks.get_Item(ref oBookMark[12]).Range.Text = model_2806.B_1_Qh + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[13]).Range.Text = model_2806.B_1_Th + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[14]).Range.Text = model_2806.B_2_Qh + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[15]).Range.Text = model_2806.B_2_Th + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[16]).Range.Text = model_2806.B_2_Thdiff + "";

                    oDoc.Bookmarks.get_Item(ref oBookMark[17]).Range.Text = model_2806.C_1_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[18]).Range.Text = model_2806.C_1_3 + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[19]).Range.Text = model_2806.C_1_5 + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[20]).Range.Text = model_2806.C_1_Tmdiff + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[21]).Range.Text = model_2806.C_2_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[22]).Range.Text = model_2806.C_2_Tmdiff + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[23]).Range.Text = model_2806.C_3_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[24]).Range.Text = model_2806.C_3_3 + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[25]).Range.Text = model_2806.C_3_5 + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[26]).Range.Text = model_2806.C_3_Tmdiff + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[27]).Range.Text = model_2806.C_4_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[28]).Range.Text = model_2806.C_4_Tmdiff + "";

                    oDoc.Bookmarks.get_Item(ref oBookMark[29]).Range.Text = model_2806.H_1_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[30]).Range.Text = model_2806.H_1_3 + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[31]).Range.Text = model_2806.H_1_5 + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[32]).Range.Text = model_2806.H_1_Tmdiff + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[33]).Range.Text = model_2806.H_2_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[34]).Range.Text = model_2806.H_2_Tmdiff + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[35]).Range.Text = model_2806.H_3_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[36]).Range.Text = model_2806.H_3_3 + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[37]).Range.Text = model_2806.H_3_5 + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[38]).Range.Text = model_2806.H_3_Tmdiff + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[39]).Range.Text = model_2806.H_4_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[40]).Range.Text = model_2806.H_4_Tmdiff + "";

                    oDoc.Bookmarks.get_Item(ref oBookMark[41]).Range.Text = model_2806.Up_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[42]).Range.Text = model_2806.Up_Tmdiff + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[43]).Range.Text = model_2806.Back_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[44]).Range.Text = model_2806.Back_Tmdiff + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[45]).Range.Text = model_2806.TmMax + "";
                }
                #endregion

                #region 1111
                if (testStandardEnum == TestStandardEnum.default1711)
                {
                    //声明书签数组
                    object[] oBookMark = new object[42];
                    //赋值书签名
                    oBookMark[0] = "Pc";
                    oBookMark[1] = "Tc";
                    oBookMark[2] = "Ph";
                    oBookMark[3] = "Th";
                    oBookMark[4] = "Qm";
                    oBookMark[5] = "Tm";

                    oBookMark[6]  = "A_1_Qc";
                    oBookMark[7]  = "A_1_Tc";
                    oBookMark[8]  = "A_1_Tcdiff";
                    oBookMark[9]  = "A_2_Qc";
                    oBookMark[10] = "A_3_Tm";
                    oBookMark[11] = "A_3_Tmdiff";

                    oBookMark[12] = "H_1_Tm";
                    oBookMark[13] = "H_1_3";
                    oBookMark[14] = "H_1_Tmdiff";
                    oBookMark[15] = "H_2_Tm";
                    oBookMark[16] = "H_2_Tmdiff";

                    oBookMark[17] = "C_1_Tm";
                    oBookMark[18] = "C_1_3";
                    oBookMark[19] = "C_1_Tmdiff";
                    oBookMark[20] = "C_2_Tm";
                    oBookMark[21] = "C_2_Tmdiff";

                    oBookMark[22] = "Cool_1_Tm";
                    oBookMark[23] = "Cool_1_3";
                    oBookMark[24] = "Cool_1_Tmdiff";
                    oBookMark[25] = "Cool_2_Tm";
                    oBookMark[26] = "Cool_2_Tmdiff";

                    oBookMark[27] = "Steady_1_Tm";
                    oBookMark[28] = "Steady_1_Tmdiff";
                    oBookMark[29] = "Steady_2_Tm";
                    oBookMark[30] = "Steady_2_Tmdiff";
                    oBookMark[31] = "Steady_2_3";

                    oBookMark[32] = "Steady_3_Tm";
                    oBookMark[33] = "Steady_3_Tmdiff";
                    oBookMark[34] = "Steady_4_Tm";
                    oBookMark[35] = "Steady_4_Tmdiff";
                    oBookMark[36] = "Steady_4_3";

                    oBookMark[37] = "FLow_1_Qm";
                    oBookMark[38] = "FLow_1_Tm";
                    oBookMark[39] = "FLow_1_Tmdiff";
                    oBookMark[40] = "FLow_2_Tm";
                    oBookMark[41] = "FLow_2_Tmdiff";

                    //赋值任意数据到书签的位置
                    oDoc.Bookmarks.get_Item(ref oBookMark[0]).Range.Text = model_1111.Pc + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[1]).Range.Text = model_1111.Tc + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[2]).Range.Text = model_1111.Ph + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[3]).Range.Text = model_1111.Th + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[4]).Range.Text = model_1111.Qm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[5]).Range.Text = model_1111.Tm + "";

                    oDoc.Bookmarks.get_Item(ref oBookMark[6]).Range.Text  = model_1111.A_1_Qc + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[7]).Range.Text  = model_1111.A_1_Tc + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[8]).Range.Text  = model_1111.A_1_Tcdiff + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[9]).Range.Text  = model_1111.A_2_Qc + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[10]).Range.Text = model_1111.A_3_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[11]).Range.Text = model_1111.A_3_Tmdiff + "";

                    oDoc.Bookmarks.get_Item(ref oBookMark[12]).Range.Text = model_1111.H_1_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[13]).Range.Text = model_1111.H_1_3 + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[14]).Range.Text = model_1111.H_1_Tmdiff + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[15]).Range.Text = model_1111.H_2_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[16]).Range.Text = model_1111.H_2_Tmdiff + "";

                    oDoc.Bookmarks.get_Item(ref oBookMark[17]).Range.Text = model_1111.C_1_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[18]).Range.Text = model_1111.C_1_3 + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[19]).Range.Text = model_1111.C_1_Tmdiff + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[20]).Range.Text = model_1111.C_2_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[21]).Range.Text = model_1111.C_2_Tmdiff + "";

                    oDoc.Bookmarks.get_Item(ref oBookMark[22]).Range.Text = model_1111.Cool_1_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[23]).Range.Text = model_1111.Cool_1_3 + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[24]).Range.Text = model_1111.Cool_1_Tmdiff + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[25]).Range.Text = model_1111.Cool_2_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[26]).Range.Text = model_1111.Cool_2_Tmdiff + "";

                    oDoc.Bookmarks.get_Item(ref oBookMark[27]).Range.Text = model_1111.Steady_1_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[28]).Range.Text = model_1111.Steady_1_Tmdiff + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[29]).Range.Text = model_1111.Steady_2_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[30]).Range.Text = model_1111.Steady_2_Tmdiff + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[31]).Range.Text = model_1111.Steady_2_3 + "";

                    oDoc.Bookmarks.get_Item(ref oBookMark[32]).Range.Text = model_1111.Steady_3_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[33]).Range.Text = model_1111.Steady_3_Tmdiff + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[34]).Range.Text = model_1111.Steady_4_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[35]).Range.Text = model_1111.Steady_4_Tmdiff + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[36]).Range.Text = model_1111.Steady_4_3 + "";

                    oDoc.Bookmarks.get_Item(ref oBookMark[37]).Range.Text = model_1111.FLow_1_Qm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[38]).Range.Text = model_1111.FLow_1_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[39]).Range.Text = model_1111.FLow_1_Tmdiff + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[40]).Range.Text = model_1111.FLow_2_Tm + "";
                    oDoc.Bookmarks.get_Item(ref oBookMark[41]).Range.Text = model_1111.FLow_2_Tmdiff + "";
                }
                #endregion

                //弹出保存文件对话框,保存生成的Word
                SaveFileDialog sfd = new SaveFileDialog();
                sfd.Filter     = "Word Document(*.doc)|*.doc";
                sfd.DefaultExt = "Word Document(*.doc)|*.doc";
                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    object filename = sfd.FileName;

                    oDoc.SaveAs(ref filename, ref oMissing, ref oMissing, ref oMissing,
                                ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                                ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                                ref oMissing, ref oMissing);
                    oDoc.Close(ref oMissing, ref oMissing, ref oMissing);
                    //关闭word
                    oWord.Quit(ref oMissing, ref oMissing, ref oMissing);
                    MessageBox.Show("保存成功!");
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
                return;
            }
        }
        /// <summary>
        /// 导出word的方法
        /// </summary>
        /// <param name="idlist">导出后备干部的id号集合</param>
        public void exportword(ArrayList idlist)  //建议把Datatable类型的参数传过来,建议读视图。
        {
            //表头信息
            #region
            string title = null;
            if (this.Unitclass.Equals("省直单位"))
            {
                if (this.Qd.Equals("正职"))
                {
                    title = "正厅级后备干部考察对象";
                }

                else if (this.Qd.Equals("副职"))
                {
                    title = "副厅级后备干部考察对象";
                }
            }
            else if (this.Unitclass.Equals("省辖市"))
            {
                title = "党政" + this.Qd + "后备干部考察对象";
            }
            else if (this.Unitclass.Equals("省管高校"))
            {
                if (this.Qd.Equals("正职"))
                {
                    title = "正校级后备干部考察对象";
                }
                else
                if (this.Qd.Equals("副职"))
                {
                    title = "副校级后备干部考察对象";
                }
            }
            else if (this.Unitclass.Equals("省管企业"))
            {
                title = "领导班子" + this.Qd + "后备干部考察对象";
            }
            if (this.Unitclass.Equals("市直单位"))
            {
                if (this.Qd.Equals("正职"))
                {
                    title = "正县级后备干部考察对象";
                }

                else if (this.Qd.Equals("副职"))
                {
                    title = "副县级后备干部考察对象";
                }
            }
            else if (this.Unitclass.Equals("县(市、区)"))
            {
                title = "党政" + this.Qd + "后备干部考察对象";
            }
            else if (this.Unitclass.Equals("市管学校"))
            {
                if (this.Qd.Equals("正职"))
                {
                    title = "正校级后备干部考察对象";
                }

                else if (this.Qd.Equals("副职"))
                {
                    title = "副校级后备干部考察对象";
                }
            }
            else if (this.Unitclass.Equals("市管企业"))
            {
                title = "领导班子" + this.Qd + "后备干部考察对象";
            }
            else if (this.Unitclass.Equals("县(市、区)直"))
            {
                if (this.Qd.Equals("正职"))
                {
                    title = "正科级后备干部考察对象";
                }

                else if (this.Qd.Equals("副职"))
                {
                    title = "副科级后备干部考察对象";
                }
            }
            else if (this.Unitclass.Equals("乡(镇、街道)"))
            {
                title = "党政" + this.Qd + "后备干部考察对象";
            }
            else if (this.Unitclass.Equals("县管学校"))
            {
                if (this.Qd.Equals("正职"))
                {
                    title = "正校级后备干部考察对象";
                }

                else if (this.Qd.Equals("副职"))
                {
                    title = "副校级后备干部考察对象";
                }
            }
            else if (this.Unitclass.Equals("县管企业"))
            {
                title = "领导班子" + this.Qd + "后备干部考察对象";
            }


            #endregion

            //选择保存路径
            #region
            string         savepath = "";
            SaveFileDialog sa       = new SaveFileDialog();
            sa.Filter   = "Document(*.doc)|*.doc";
            sa.FileName = "信息采集表";
            if (sa.ShowDialog() == DialogResult.OK)
            {
                savepath = sa.FileName;
            }
            else
            {
                return;
            }
            #endregion

            //创建word应用程序
            wordappliction = new Word.Application();

            //打开模板
            object filepath = System.Windows.Forms.Application.StartupPath + "\\wordModel" + "\\信息采集表.doc";
            mydoc = wordappliction.Documents.Open(ref filepath, ref missing, ref readOnly,
                                                  ref missing, ref missing, ref missing, ref missing, ref missing,
                                                  ref missing, ref missing, ref missing, ref isVisible, ref missing,
                                                  ref missing, ref missing, ref missing);
            //打开模板复制其中的表
            #region
            mydoc.ActiveWindow.Selection.WholeStory();
            mydoc.ActiveWindow.Selection.Select();
            mydoc.ActiveWindow.Selection.Copy();
            #endregion

            string selectid = "";

            for (int i = 0; i < idlist.Count; i++)
            {
                if (i == idlist.Count - 1)
                {
                    selectid = selectid + "'" + idlist[i] + "'";
                }
                else
                {
                    selectid = selectid + "'" + idlist[i] + "',";
                }
            }

            //读取后备干部的相关信息
            string        sql        = "select CID,name,department,position from TB_CommonInfo order by rank, joinTeam desc";
            string        cond       = "cid in (" + selectid + ")";
            DataOperation dataOp     = new DataOperation();
            DataTable     datatableT = dataOp.GetOneDataTable_sql(sql);
            DataTable     datatable  = new DataTable();
            datatable = datatableT.Clone();
            DataView dv = datatableT.AsDataView();
            dv.RowFilter = cond;
            datatable    = dv.ToTable();

            //根据datatable中数据的数量进行文档的拷贝粘贴
            for (int i = 0; i < datatable.Rows.Count - 1; i++)
            #region
            {
                //加入两段避免了最后一行文本被弄到下面
                Word.Paragraph para1;
                Word.Paragraph para2;
                para1 = mydoc.Content.Paragraphs.Add(ref missing);
                para2 = mydoc.Content.Paragraphs.Add(ref missing);
                object pBreak = (int)WdBreakType.wdSectionBreakNextPage;
                para2.Range.InsertBreak(ref pBreak);
                //调用粘贴方法即可粘贴剪贴板中的内容。
                para2.Range.Paste();
            }
            #endregion

            //遍历datatable,读取后备干部信息,将后备干部信息写入文档
            for (int i = 0; i < datatable.Rows.Count; i++)
            #region
            {
                //表一:干部考察对象
                mydoc.Tables[i * 9 + 1].Cell(1, 1).Range.Text = title;
                mydoc.Tables[i * 9 + 1].Cell(4, 1).Range.InsertAfter(datatable.Rows[i]["department"].ToString());
                mydoc.Tables[i * 9 + 1].Cell(5, 1).Range.InsertAfter(datatable.Rows[i]["name"].ToString());
                mydoc.Tables[i * 9 + 1].Cell(6, 1).Range.InsertAfter(datatable.Rows[i]["position"].ToString());

                //表二:家庭主要成员及重要社会关系
                #region
                //得到该干部的家庭信息
                DataTable datatable2 = dataOp.GetOneDataTable_sql("select * from TB_Family where cid ='" + datatable.Rows[i]["CID"].ToString() + "'");
                int       n          = datatable2.Rows.Count;
                for (int j = 0; j < n; j++)
                {
                    mydoc.Tables[i * 9 + 2].Cell(j + 2, 1).Range.Text = datatable2.Rows[j]["relationship"].ToString();
                    mydoc.Tables[i * 9 + 2].Cell(j + 2, 2).Range.Text = datatable2.Rows[j]["name"].ToString();
                    string age = datatable2.Rows[j]["birthday"].ToString().Replace("年", ".");
                    mydoc.Tables[i * 9 + 2].Cell(j + 2, 3).Range.Text = age.Replace("月", "");
                    mydoc.Tables[i * 9 + 2].Cell(j + 2, 4).Range.Text = datatable2.Rows[j]["country"].ToString();
                    mydoc.Tables[i * 9 + 2].Cell(j + 2, 5).Range.Text = datatable2.Rows[j]["party"].ToString();
                    mydoc.Tables[i * 9 + 2].Cell(j + 2, 6).Range.Text = datatable2.Rows[j]["nation"].ToString();
                    mydoc.Tables[i * 9 + 2].Cell(j + 2, 7).Range.Text = datatable2.Rows[j]["deptJob"].ToString();
                    mydoc.Tables[i * 9 + 2].Cell(j + 2, 8).Range.Text = datatable2.Rows[j]["remark"].ToString();
                }
                #endregion

                datatable2.Clear();
                //表三:海外学习
                #region
                datatable2 = dataOp.GetOneDataTable_sql("select * from TB_SAbroad where cid ='" + datatable.Rows[i]["CID"].ToString() + "'");
                n          = datatable2.Rows.Count;
                for (int j = 0; j < n; j++)
                {
                    mydoc.Tables[i * 9 + 3].Cell(j + 2, 1).Range.Text = datatable2.Rows[j]["startTime"].ToString();
                    mydoc.Tables[i * 9 + 3].Cell(j + 2, 2).Range.Text = datatable2.Rows[j]["endTime"].ToString();
                    mydoc.Tables[i * 9 + 3].Cell(j + 2, 3).Range.Text = datatable2.Rows[j]["country"].ToString();
                    mydoc.Tables[i * 9 + 3].Cell(j + 2, 4).Range.Text = datatable2.Rows[j]["academy"].ToString();
                    mydoc.Tables[i * 9 + 3].Cell(j + 2, 5).Range.Text = datatable2.Rows[j]["degree"].ToString();
                }
                #endregion

                datatable2.Clear();
                //表四:海外工作
                #region
                datatable2 = dataOp.GetOneDataTable_sql("select * from TB_WAbroad where cid ='" + datatable.Rows[i]["CID"].ToString() + "'");
                n          = datatable2.Rows.Count;
                for (int j = 0; j < n; j++)
                {
                    mydoc.Tables[i * 9 + 4].Cell(j + 2, 1).Range.Text = datatable2.Rows[j]["startTime"].ToString();
                    mydoc.Tables[i * 9 + 4].Cell(j + 2, 2).Range.Text = datatable2.Rows[j]["endTime"].ToString();
                    mydoc.Tables[i * 9 + 4].Cell(j + 2, 3).Range.Text = datatable2.Rows[j]["abroadCountry"].ToString();
                    mydoc.Tables[i * 9 + 4].Cell(j + 2, 4).Range.Text = datatable2.Rows[j]["departmentPosition"].ToString();
                    mydoc.Tables[i * 9 + 4].Cell(j + 2, 5).Range.Text = datatable2.Rows[j]["specialtyArea"].ToString();
                }
                #endregion

                //重大事项信息
                #region
                datatable2 = dataOp.GetOneDataTable_sql("select * from TB_GreatContent where CID = '" + datatable.Rows[i]["CID"].ToString() + "'");
                for (int r = 0; r < datatable2.Rows.Count; r++)
                {
                    string connect = null;
                    //第五张表
                    #region
                    if (datatable2.Rows[r]["matter"].ToString().Equals("1"))
                    {
                        connect = datatable2.Rows[r]["content"].ToString();
                        if (connect == null || connect.Equals(""))
                        {
                            connect = "无";
                        }
                        mydoc.Tables[i * 9 + 5].Cell(2, 2).Range.Text = connect;
                        continue;
                    }
                    else if (datatable2.Rows[r]["matter"].ToString().Equals("2"))
                    {
                        connect = datatable2.Rows[r]["content"].ToString();
                        if (connect == null || connect.Equals(""))
                        {
                            connect = "无";
                        }
                        mydoc.Tables[i * 9 + 5].Cell(3, 2).Range.Text = connect;
                        continue;
                    }
                    else if (datatable2.Rows[r]["matter"].ToString().Equals("3"))
                    {
                        connect = datatable2.Rows[r]["content"].ToString();
                        if (connect == null || connect.Equals(""))
                        {
                            connect = "无";
                        }
                        mydoc.Tables[i * 9 + 5].Cell(4, 2).Range.Text = connect;
                        continue;
                    }
                    else if (datatable2.Rows[r]["matter"].ToString().Equals("4"))
                    {
                        connect = datatable2.Rows[r]["content"].ToString();
                        if (connect == null || connect.Equals(""))
                        {
                            connect = "无";
                        }
                        mydoc.Tables[i * 9 + 5].Cell(5, 2).Range.Text = connect;
                        continue;
                    }
                    else if (datatable2.Rows[r]["matter"].ToString().Equals("5"))
                    {
                        connect = datatable2.Rows[r]["content"].ToString();
                        if (connect == null || connect.Equals(""))
                        {
                            connect = "无";
                        }
                        mydoc.Tables[i * 9 + 5].Cell(6, 2).Range.Text = connect;
                        continue;
                    }
                    #endregion
                    //第六张表
                    #region
                    else if (datatable2.Rows[r]["matter"].ToString().Equals("6"))
                    {
                        connect = datatable2.Rows[r]["content"].ToString();
                        if (connect == null || connect.Equals(""))
                        {
                            connect = "无";
                        }
                        mydoc.Tables[i * 9 + 6].Cell(2, 2).Range.Text = connect;
                        continue;
                    }

                    else if (datatable2.Rows[r]["matter"].ToString().Equals("7"))
                    {
                        connect = datatable2.Rows[r]["content"].ToString();
                        if (connect == null || connect.Equals(""))
                        {
                            connect = "无";
                        }
                        mydoc.Tables[i * 9 + 6].Cell(3, 2).Range.Text = connect;
                        continue;
                    }
                    else if (datatable2.Rows[r]["matter"].ToString().Equals("8"))
                    {
                        connect = datatable2.Rows[r]["content"].ToString();
                        if (connect == null || connect.Equals(""))
                        {
                            connect = "无";
                        }
                        mydoc.Tables[i * 9 + 6].Cell(4, 2).Range.Text = connect;
                        continue;
                    }
                    else if (datatable2.Rows[r]["matter"].ToString().Equals("9"))
                    {
                        connect = datatable2.Rows[r]["content"].ToString();
                        if (connect == null || connect.Equals(""))
                        {
                            connect = "无";
                        }
                        mydoc.Tables[i * 9 + 6].Cell(5, 2).Range.Text = connect;
                        continue;
                    }
                    #endregion
                }
                #endregion


                datatable2.Clear();
                //表七:熟悉外语语种
                #region
                datatable2 = dataOp.GetOneDataTable_sql("select * from TB_FamiliarForeign where cid ='" + datatable.Rows[i]["CID"].ToString() + "'");
                n          = datatable2.Rows.Count;
                for (int j = 0; j < n; j++)
                {
                    string level = datatable2.Rows[j]["level"].ToString();
                    mydoc.Tables[i * 9 + 7].Cell(j + 3, 2).Range.Text = datatable2.Rows[j]["foreignKind"].ToString();

                    if (level.Equals("精通"))
                    {
                        mydoc.Tables[i * 9 + 7].Cell(j + 3, 3).Range.Text = "√";
                    }
                    else if (level.Equals("熟练"))
                    {
                        mydoc.Tables[i * 9 + 7].Cell(j + 3, 4).Range.Text = "√";
                    }
                    else if (level.Equals("良好"))
                    {
                        mydoc.Tables[i * 9 + 7].Cell(j + 3, 5).Range.Text = "√";
                    }
                    else if (level.Equals("一般"))
                    {
                        mydoc.Tables[i * 9 + 7].Cell(j + 3, 6).Range.Text = "√";
                    }
                }
                #endregion

                datatable2.Clear();
                //表八:参加培训及实践锻炼情况
                #region
                datatable2 = dataOp.GetOneDataTable_sql("select * from TB_TrainExercise where cid ='" + datatable.Rows[i]["CID"].ToString() + "'");

                for (int r = 0; r < datatable2.Rows.Count; r++)
                {
                    string starttime = datatable2.Rows[r]["startTime"].ToString().Replace("年", ".");
                    string endtime   = datatable2.Rows[r]["endTime"].ToString().Replace("年", ".");
                    if (datatable2.Rows[r]["reportMatter"].ToString().Equals("参加培训情况"))
                    {
                        mydoc.Tables[i * 9 + 8].Cell(2, 2).Range.InsertAfter(starttime.Replace("月", ".").Replace("日", "") + "到" + endtime.Replace("月", ".").Replace("日", "") + ":" + datatable2.Rows[r]["Content"].ToString() + "\n");
                    }
                    if (datatable2.Rows[r]["reportMatter"].ToString().Equals("参加实践锻炼情况"))
                    {
                        mydoc.Tables[i * 9 + 8].Cell(3, 2).Range.InsertAfter(starttime.Replace("月", ".").Replace("日", "") + "到" + endtime.Replace("月", ".").Replace("日", "") + ":" + datatable2.Rows[r]["Content"].ToString() + "\n");
                    }
                }
                #endregion

                datatable2.Clear();
                //表九:培养锻炼措施需求
                datatable2 = dataOp.GetOneDataTable_sql("select * from TB_TrainMethord where cid ='" + datatable.Rows[i]["CID"].ToString() + "'");

                for (int r = 0; r < datatable2.Rows.Count; r++)
                {
                    #region
                    string select = datatable2.Rows[r]["options"].ToString();
                    if (select.Equals("1"))
                    {
                        mydoc.Tables[i * 9 + 9].Cell(1, 2).Range.Text = "√"; continue;
                    }
                    else if (select.Equals("2"))
                    {
                        mydoc.Tables[i * 9 + 9].Cell(2, 2).Range.Text = "√"; continue;
                    }
                    else if (select.Equals("3"))
                    {
                        mydoc.Tables[i * 9 + 9].Cell(3, 2).Range.Text = "√"; continue;
                    }
                    else if (select.Equals("4"))
                    {
                        mydoc.Tables[i * 9 + 9].Cell(4, 2).Range.Text = "√"; continue;
                    }
                    else if (select.Equals("5"))
                    {
                        mydoc.Tables[i * 9 + 9].Cell(5, 2).Range.Text = "√"; continue;
                    }
                    else if (select.Equals("6"))
                    {
                        mydoc.Tables[i * 9 + 9].Cell(6, 2).Range.Text = "√"; continue;
                    }
                    else if (select.Equals("7"))
                    {
                        mydoc.Tables[i * 9 + 9].Cell(7, 2).Range.Text = "√"; continue;
                    }
                    else if (select.Equals("8"))
                    {
                        mydoc.Tables[i * 9 + 9].Cell(8, 2).Range.Text = "√"; continue;
                    }
                    else if (select.Equals("9"))
                    {
                        mydoc.Tables[i * 9 + 9].Cell(9, 2).Range.Text = "√"; continue;
                    }
                    else if (select.Equals("10"))
                    {
                        mydoc.Tables[i * 9 + 9].Cell(10, 2).Range.Text = "√"; continue;
                    }
                    else if (select.Equals("11"))
                    {
                        mydoc.Tables[i * 9 + 9].Cell(11, 2).Range.Text = "√"; continue;
                    }
                    else if (select.Equals("12"))
                    {
                        mydoc.Tables[i * 9 + 9].Cell(12, 2).Range.Text = "√"; continue;
                    }
                    else if (select.Equals("13"))
                    {
                        mydoc.Tables[i * 9 + 9].Cell(13, 2).Range.Text = "√"; continue;
                    }
                    else if (select.Equals("14"))
                    {
                        mydoc.Tables[i * 9 + 9].Cell(14, 2).Range.Text = "√";
                        mydoc.Tables[i * 9 + 9].Cell(15, 1).Range.Text = datatable2.Rows[r]["note14"].ToString();
                        continue;
                    }
                    #endregion
                }
                datatable2.Clear();
            }
            #endregion
            //#region
            object path = savepath;
            //wordappliction.Documents.Save(path);
            object myobj = System.Reflection.Missing.Value;;
            mydoc.SaveAs(ref path, ref myobj, ref myobj, ref myobj, ref myobj, ref myobj,
                         ref myobj, ref myobj, ref myobj, ref myobj, ref myobj, ref myobj,
                         ref myobj, ref myobj, ref myobj, ref myobj);
            //关闭退出文档
            #region
            //关闭文档
            mydoc.Close(ref myobj, ref myobj, ref myobj);
            //退出应用程序。
            wordappliction.Quit();
            #endregion
            MessageBox.Show("导出成功!");
        }
Пример #23
0
        /// <summary>
        /// 导出审批表word
        /// </summary>
        /// <param name="path">文件路径</param>
        /// <param name="Type">0-首营供货商,1-首营客户,2-首营药品</param>
        /// <returns></returns>
        public bool CreateWord(string Filename, string Name, int Type)
        {
            Word._Application oWord = new Word.Application();
            Word._Document    oDoc  = null;
            try
            {
                object oMissing = System.Reflection.Missing.Value;

                oWord.Visible = false;
                object oTemplate = Filename;
                oDoc = oWord.Documents.Open(ref oTemplate, ref oMissing, ref oMissing, ref oMissing);
                oDoc.Activate();

                #region 这是首营信息们
                if (b != null)
                {
                    this.insertMarks(oDoc, 0);
                    this.insertGsp(oDoc, b.GSPLCID, b.id);
                    this.insertMedicineBussiness(oDoc, b.MedicineBusinessLCID);
                    this.insertBussiness(oDoc, b.BusinessLCID);
                    this.insertOrg(oDoc, b.OrganizationCodeLCID);
                    this.insertTax(oDoc, b.TaxRegisterLCID);
                    this.insertInstB(oDoc, b.InstrumentsBusinessLCID);
                    this.insertInstP(oDoc, b.InstrumentsProductionLCID);
                    this.insertHealth(oDoc, b.HealthLCID);
                    this.InsertGMP(oDoc, b.GMPLCID);
                    this.insertDelegate(oDoc);
                    this.insertSCXKZ(oDoc, b.MedicineProductionLCID);
                    this.insertQualityAgreement(oDoc);
                    this.insertBank(oDoc);

                    Service.Models.QueryApprovalFlowRecordModel aq = new  Service.Models.QueryApprovalFlowRecordModel
                    {
                        FlowId = b.ApprovalFlowId
                    };

                    var c = baseform.PharmacyDatabaseService.SearchApprovalFlowRecordsByQueryModel(out msg, aq).OrderBy(r => r.ApproveTime).ToList();

                    if (oDoc.Bookmarks["flow1"] != null)
                    {
                        for (int i = 0; i < c.Count; i++)
                        {
                            oDoc.Bookmarks["flow" + (i + 1)].Select();
                            oDoc.Bookmarks["flow" + (i + 1)].Range.Text = c[i].Comment;
                            var o = ListUsers.Where(r => r.Id == c[i].ApproveUserId).FirstOrDefault();
                            oDoc.Bookmarks["flowuser" + (i + 1)].Range.Text = o.Employee.Name + "  " + c[i].ApproveTime.ToLongDateString();
                        }
                    }
                }

                if (p != null)
                {
                    this.insertPurchaseBasicInfo(oDoc);
                    this.insertGsp(oDoc, p.GSPLCID, p.Id);
                    this.insertMedicineBussiness(oDoc, p.MedicineBusinessLCID);
                    this.insertBussiness(oDoc, p.BusinessLCID);
                    this.insertOrg(oDoc, p.OrganizationCodeLCID);
                    this.insertTax(oDoc, p.TaxRegisterLCID);
                    this.insertInstB(oDoc, p.InstrumentsBusinessLCID);
                    this.insertInstP(oDoc, p.InstrumentsProductionLCID);
                    this.insertHealth(oDoc, p.HealthLCID);
                    this.InsertGMP(oDoc, p.GMPLCID);
                    this.insertLn(oDoc, p.LnstitutionLegalPersonLCID);
                    this.InsertMMInst(oDoc, p.MmedicalInstitutionLCID);
                    this.insertDelegate(oDoc);
                    this.insertQualityAgreement(oDoc);
                }

                if (d != null)
                {
                    this.InsertDrugInfo(oDoc);
                }

                #region 医疗器械信息
                if (Inst != null)
                {
                    oDoc.Bookmarks["T1"].Select();
                    oDoc.Bookmarks["T1"].Range.Text = BugsBox.Pharmacy.AppClient.Common.PharmacyClientConfig.Config.Store.Name;

                    oDoc.Bookmarks["D1"].Range.Text  = Inst.ProductGeneralName;
                    oDoc.Bookmarks["D2"].Range.Text  = Inst.LicensePermissionNumber;
                    oDoc.Bookmarks["D3"].Range.Text  = Inst.PerformanceStandards;
                    oDoc.Bookmarks["D4"].Range.Text  = Inst.StandardCode;
                    oDoc.Bookmarks["D5"].Range.Text  = Inst.Code;
                    oDoc.Bookmarks["D6"].Range.Text  = Inst.DocCode;
                    oDoc.Bookmarks["D7"].Range.Text  = Inst.Pinyin;
                    oDoc.Bookmarks["D8"].Range.Text  = Inst.BarCode;
                    oDoc.Bookmarks["D11"].Range.Text = Inst.DictionaryMeasurementUnitCode;
                    oDoc.Bookmarks["D12"].Range.Text = Inst.DictionaryDosageCode;
                    oDoc.Bookmarks["D13"].Range.Text = Inst.DictionarySpecificationCode;
                    oDoc.Bookmarks["D14"].Range.Text = Inst.FactoryName;
                    oDoc.Bookmarks["D15"].Range.Text = Inst.Contact;
                    oDoc.Bookmarks["D16"].Range.Text = Inst.BusinessScopeCode;
                    oDoc.Bookmarks["D17"].Range.Text = Inst.IsApproval;
                    oDoc.Bookmarks["D18"].Range.Text = Inst.Valid;
                    oDoc.Bookmarks["D19"].Range.Text = Inst.WareHouses;
                    oDoc.Bookmarks["D20"].Range.Text = Inst.WareHouseZone;
                    oDoc.Bookmarks["D21"].Range.Text = Inst.DrugStorageTypeCode;
                    oDoc.Bookmarks["D22"].Range.Text = Inst.MaxInventoryCount.ToString();
                    oDoc.Bookmarks["D23"].Range.Text = Inst.MinInventoryCount.ToString();
                    oDoc.Bookmarks["D24"].Range.Text = Inst.ValidPeriod.ToString() + "个月";
                    oDoc.Bookmarks["D25"].Range.Text = Inst.DrugCategoryCode;
                    oDoc.Bookmarks["D26"].Range.Text = Inst.Price.ToString();
                    oDoc.Bookmarks["D27"].Range.Text = Inst.SalePrice.ToString();
                    oDoc.Bookmarks["D28"].Range.Text = Inst.LimitedUpPrice.ToString();
                    oDoc.Bookmarks["D29"].Range.Text = Inst.LimitedLowPrice.ToString();
                    oDoc.Bookmarks["D31"].Range.Text = Inst.Description;
                    oDoc.Bookmarks["D48"].Range.Text = Inst.CreateTime.ToString();
                    oDoc.Bookmarks["D49"].Range.Text = Inst.CreateUserName;
                }
                #endregion

                #region 保健食品信息
                if (this.Food != null)
                {
                    oDoc.Bookmarks["T1"].Select();
                    oDoc.Bookmarks["T1"].Range.Text = BugsBox.Pharmacy.AppClient.Common.PharmacyClientConfig.Config.Store.Name;

                    oDoc.Bookmarks["D1"].Range.Text  = Food.ProductGeneralName;
                    oDoc.Bookmarks["D2"].Range.Text  = Food.LicensePermissionNumber;
                    oDoc.Bookmarks["D3"].Range.Text  = Food.PerformanceStandards;
                    oDoc.Bookmarks["D4"].Range.Text  = Food.LicensePermissionOutValidDate.ToShortDateString();
                    oDoc.Bookmarks["D5"].Range.Text  = Food.Code;
                    oDoc.Bookmarks["D6"].Range.Text  = Food.DocCode;
                    oDoc.Bookmarks["D7"].Range.Text  = Food.Pinyin;
                    oDoc.Bookmarks["D8"].Range.Text  = Food.BarCode;
                    oDoc.Bookmarks["D11"].Range.Text = Food.DictionaryMeasurementUnitCode;
                    oDoc.Bookmarks["D12"].Range.Text = Food.DictionaryDosageCode;
                    oDoc.Bookmarks["D13"].Range.Text = Food.DictionarySpecificationCode;
                    oDoc.Bookmarks["D14"].Range.Text = Food.FactoryName;
                    oDoc.Bookmarks["D15"].Range.Text = Food.Contact;
                    oDoc.Bookmarks["D16"].Range.Text = Food.BusinessScopeCode;
                    oDoc.Bookmarks["D17"].Range.Text = Food.IsApproval;
                    oDoc.Bookmarks["D18"].Range.Text = Food.Valid;
                    oDoc.Bookmarks["D19"].Range.Text = Food.WareHouses;
                    oDoc.Bookmarks["D20"].Range.Text = Food.WareHouseZone;
                    oDoc.Bookmarks["D21"].Range.Text = Food.DrugStorageTypeCode;
                    oDoc.Bookmarks["D22"].Range.Text = Food.MaxInventoryCount.ToString();
                    oDoc.Bookmarks["D23"].Range.Text = Food.MinInventoryCount.ToString();
                    oDoc.Bookmarks["D24"].Range.Text = Food.ValidPeriod.ToString() + "个月";
                    oDoc.Bookmarks["D25"].Range.Text = Food.IsImport;



                    oDoc.Bookmarks["D26"].Range.Text = Food.Price.ToString();
                    oDoc.Bookmarks["D27"].Range.Text = Food.SalePrice.ToString();
                    oDoc.Bookmarks["D28"].Range.Text = Food.LimitedUpPrice.ToString();
                    oDoc.Bookmarks["D29"].Range.Text = Food.LimitedLowPrice.ToString();

                    oDoc.Bookmarks["D30"].Range.Text = Food.Origin;
                    oDoc.Bookmarks["D31"].Range.Text = Food.Description;

                    oDoc.Bookmarks["D48"].Range.Text = Food.CreateTime.ToString();
                    oDoc.Bookmarks["D49"].Range.Text = Food.CreateUserName;
                }

                #endregion

                #endregion

                #region word保存
                System.Windows.Forms.SaveFileDialog sfd = new System.Windows.Forms.SaveFileDialog();
                sfd.Filter     = "Word Document(*.doc)|*.doc";
                sfd.DefaultExt = "Word Document(*.doc)|*.doc";
                sfd.FileName   = Name + DateTime.Now.Ticks + ".doc";
                if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    object filename = sfd.FileName;
                    oDoc.SaveAs(ref filename, ref oMissing, ref oMissing, ref oMissing,
                                ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                                ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                                ref oMissing, ref oMissing);
                    oDoc.Close(ref oMissing, ref oMissing, ref oMissing);
                    if (oDoc != null)
                    {
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(oDoc);
                        oDoc = null;
                    }
                    if (oWord != null)
                    {
                        oWord.Quit();
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(oWord);
                        oWord = null;
                    }
                    return(true);
                }
                else
                {
                    if (oDoc != null)
                    {
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(oDoc);
                        oDoc = null;
                    }
                    if (oWord != null)
                    {
                        oWord.Quit(Word.WdSaveOptions.wdDoNotSaveChanges);
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(oWord);
                        oWord = null;
                    }
                    return(false);
                }
            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show(Name + ":审批信息表导出失败!");
                if (oWord != null)
                {
                    oWord.Quit(Word.WdSaveOptions.wdDoNotSaveChanges);
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(oWord);
                    oWord = null;
                }
                if (oDoc != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(oDoc);
                    oDoc = null;
                }
                return(false);
            }
            finally
            {
                if (oWord != null)
                {
                    oWord.Quit();
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(oWord);
                    oWord = null;
                }
                if (oDoc != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(oDoc);
                    oDoc = null;
                }
            }
            #endregion
        }
Пример #24
0
        private void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                object oMissing = System.Reflection.Missing.Value;
                //创建一个word实例
                Word._Application oWord = new Word.Application();
                //设置为不可见
                oWord.Visible = false;

                //模板文件地址,这里假设在程序根目录
                object oTemplate          = System.AppDomain.CurrentDomain.BaseDirectory + "//" + comboBox1.Text + ".dot";
                string pic65Path          = System.AppDomain.CurrentDomain.BaseDirectory + "//出水温度稳定性65℃.jpg";
                string pic50Path          = System.AppDomain.CurrentDomain.BaseDirectory + "//出水温度稳定性50℃.jpg";
                string picSenstivityPath1 = System.AppDomain.CurrentDomain.BaseDirectory + "//保真度曲线.jpg";
                string picSenstivityPath2 = System.AppDomain.CurrentDomain.BaseDirectory + "//灵敏度曲线.jpg";
                //以模板为基础生成文档
                Word._Document oDoc = oWord.Documents.Add(ref oTemplate, ref oMissing, ref oMissing, ref oMissing);
                oWord = oDoc.Application;
                if (isTest)
                {
                    foreach (Bookmark bk in oDoc.Bookmarks)
                    {
                        if (bk.Name == "Tm_65_3")
                        {
                            bk.Range.Text = model.Tm_65_3 + "";
                        }
                        if (bk.Name == "Tm_65_3diff")
                        {
                            bk.Range.Text = model.Tm_65_3diff + "";
                        }
                        if (bk.Name == "Tm_65_6")
                        {
                            bk.Range.Text = model.Tm_65_6 + "";
                        }
                        if (bk.Name == "Tm_65_6diff")
                        {
                            bk.Range.Text = model.Tm_65_6diff + "";
                        }
                        if (bk.Name == "Tm_50_3")
                        {
                            bk.Range.Text = model.Tm_50_3 + "";
                        }
                        if (bk.Name == "Tm_50_3diff")
                        {
                            bk.Range.Text = model.Tm_50_3diff + "";
                        }
                        if (bk.Name == "Tm_50_6")
                        {
                            bk.Range.Text = model.Tm_50_6 + "";
                        }
                        if (bk.Name == "Tm_50_6diff")
                        {
                            bk.Range.Text = model.Tm_50_6diff + "";
                        }
                        if (bk.Name == "tmDiff")
                        {
                            bk.Range.Text = model.Tm_50_3 + "";
                        }
                        if (bk.Name == "G1")
                        {
                            bk.Range.Text = model.Tm_50_3diff + "";
                        }
                        if (bk.Name == "G2")
                        {
                            bk.Range.Text = model.Tm_50_6 + "";
                        }

                        if (bk.Name == "Tm_65_pic" && File.Exists(pic65Path))
                        {
                            bk.Select();
                            Selection sel = oWord.Selection;
                            sel.InlineShapes.AddPicture(pic65Path);
                        }
                        if (bk.Name == "Tm_50_pic" && File.Exists(pic50Path))
                        {
                            bk.Select();
                            Selection sel = oWord.Selection;
                            sel.InlineShapes.AddPicture(pic50Path);
                        }
                        if (bk.Name == "picSenstivity1" && File.Exists(picSenstivityPath1))
                        {
                            bk.Select();
                            Selection sel = oWord.Selection;
                            sel.InlineShapes.AddPicture(picSenstivityPath1);
                        }
                        if (bk.Name == "picSenstivity2" && File.Exists(picSenstivityPath2))
                        {
                            bk.Select();
                            Selection sel = oWord.Selection;
                            sel.InlineShapes.AddPicture(picSenstivityPath2);
                        }
                    }
                    //object[] oBookMark = new object[10];
                    //oBookMark[0] = "Tm_65_3";
                    //oBookMark[1] = "Tm_65_3diff";
                    //oBookMark[2] = "Tm_65_6";
                    //oBookMark[3] = "Tm_65_6diff";
                    //oBookMark[4] = "Tm_65_pic";
                    //oBookMark[5] = "Tm_50_3";
                    //oBookMark[6] = "Tm_50_3diff";
                    //oBookMark[7] = "Tm_50_6";
                    //oBookMark[8] = "Tm_50_6diff";
                    //oBookMark[9] = "Tm_50_pic";

                    ////赋值任意数据到书签的位置
                    //oDoc.Bookmarks.get_Item(ref oBookMark[0]).Range.Text = model.Tm_65_3 + "";
                    //oDoc.Bookmarks.get_Item(ref oBookMark[1]).Range.Text = model.Tm_65_3diff + "";
                    //oDoc.Bookmarks.get_Item(ref oBookMark[2]).Range.Text = model.Tm_65_6 + "";
                    //oDoc.Bookmarks.get_Item(ref oBookMark[3]).Range.Text = model.Tm_65_6diff + "";
                    //oDoc.Bookmarks.get_Item(ref oBookMark[5]).Range.Text = model.Tm_50_3 + "";
                    //oDoc.Bookmarks.get_Item(ref oBookMark[6]).Range.Text = model.Tm_50_3diff + "";
                    //oDoc.Bookmarks.get_Item(ref oBookMark[7]).Range.Text = model.Tm_50_6 + "";
                    //oDoc.Bookmarks.get_Item(ref oBookMark[8]).Range.Text = model.Tm_50_6diff + "";

                    //Bookmark bk_65_pic= oDoc.Bookmarks.get_Item(ref oBookMark[4]);
                    //bk_65_pic.Select();
                    //Selection sel = oWord.Selection;
                    //sel.InlineShapes.AddPicture(pic65Path);


                    //Bookmark bk_50_pic = oDoc.Bookmarks.get_Item(ref oBookMark[9]);
                    //bk_50_pic.Select();
                    //sel.InlineShapes.AddPicture(pic50Path);
                }


                //#region 2806
                //if (testStandardEnum == TestStandardEnum.default2806)
                //{
                //    //声明书签数组
                //    object[] oBookMark = new object[46];
                //    //赋值书签名
                //    oBookMark[0] = "Pc";
                //    oBookMark[1] = "Tc";
                //    oBookMark[2] = "Ph";
                //    oBookMark[3] = "Th";
                //    oBookMark[4] = "Qm";
                //    oBookMark[5] = "Tm";
                //    oBookMark[6] = "A_1_Qc";
                //    oBookMark[7] = "A_1_Tc";
                //    oBookMark[8] = "A_1_Tcdiff";
                //    oBookMark[9] = "A_2_Qc";
                //    oBookMark[10] = "A_2_Tc";
                //    oBookMark[11] = "A_2_Tcdiff";
                //    oBookMark[12] = "B_1_Qh";
                //    oBookMark[13] = "B_1_Th";
                //    oBookMark[14] = "B_2_Qh";
                //    oBookMark[15] = "B_2_Th";
                //    oBookMark[16] = "B_2_Thdiff";

                //    oBookMark[17] = "C_1_Tm";
                //    oBookMark[18] = "C_1_3";
                //    oBookMark[19] = "C_1_5";
                //    oBookMark[20] = "C_1_Tmdiff";
                //    oBookMark[21] = "C_2_Tm";
                //    oBookMark[22] = "C_2_Tmdiff";
                //    oBookMark[23] = "C_3_Tm";
                //    oBookMark[24] = "C_3_3";
                //    oBookMark[25] = "C_3_5";
                //    oBookMark[26] = "C_3_Tmdiff";
                //    oBookMark[27] = "C_4_Tm";
                //    oBookMark[28] = "C_4_Tmdiff";

                //    oBookMark[29] = "H_1_Tm";
                //    oBookMark[30] = "H_1_3";
                //    oBookMark[31] = "H_1_5";
                //    oBookMark[32] = "H_1_Tmdiff";
                //    oBookMark[33] = "H_2_Tm";
                //    oBookMark[34] = "H_2_Tmdiff";
                //    oBookMark[35] = "H_3_Tm";
                //    oBookMark[36] = "H_3_3";
                //    oBookMark[37] = "H_3_5";
                //    oBookMark[38] = "H_3_Tmdiff";
                //    oBookMark[39] = "H_4_Tm";
                //    oBookMark[40] = "H_4_Tmdiff";

                //    oBookMark[41] = "Up_Tm";
                //    oBookMark[42] = "Up_Tmdiff";
                //    oBookMark[43] = "Back_Tm";
                //    oBookMark[44] = "Back_Tmdiff";
                //    oBookMark[45] = "TmMax";

                //    //赋值任意数据到书签的位置
                //    oDoc.Bookmarks.get_Item(ref oBookMark[0]).Range.Text = model_2806.Pc + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[1]).Range.Text = model_2806.Tc + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[2]).Range.Text = model_2806.Ph + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[3]).Range.Text = model_2806.Th + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[4]).Range.Text = model_2806.Qm + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[5]).Range.Text = model_2806.Tm + "";

                //    oDoc.Bookmarks.get_Item(ref oBookMark[6]).Range.Text = model_2806.A_1_Qc + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[7]).Range.Text = model_2806.A_1_Tc + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[8]).Range.Text = model_2806.A_1_Tcdiff + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[9]).Range.Text = model_2806.A_2_Qc + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[10]).Range.Text = model_2806.A_2_Tc + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[11]).Range.Text = model_2806.A_2_Tcdiff + "";

                //    oDoc.Bookmarks.get_Item(ref oBookMark[12]).Range.Text = model_2806.B_1_Qh + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[13]).Range.Text = model_2806.B_1_Th + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[14]).Range.Text = model_2806.B_2_Qh + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[15]).Range.Text = model_2806.B_2_Th + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[16]).Range.Text = model_2806.B_2_Thdiff + "";

                //    oDoc.Bookmarks.get_Item(ref oBookMark[17]).Range.Text = model_2806.C_1_Tm + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[18]).Range.Text = model_2806.C_1_3 + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[19]).Range.Text = model_2806.C_1_5 + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[20]).Range.Text = model_2806.C_1_Tmdiff + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[21]).Range.Text = model_2806.C_2_Tm + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[22]).Range.Text = model_2806.C_2_Tmdiff + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[23]).Range.Text = model_2806.C_3_Tm + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[24]).Range.Text = model_2806.C_3_3 + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[25]).Range.Text = model_2806.C_3_5 + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[26]).Range.Text = model_2806.C_3_Tmdiff + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[27]).Range.Text = model_2806.C_4_Tm + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[28]).Range.Text = model_2806.C_4_Tmdiff + "";

                //    oDoc.Bookmarks.get_Item(ref oBookMark[29]).Range.Text = model_2806.H_1_Tm + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[30]).Range.Text = model_2806.H_1_3 + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[31]).Range.Text = model_2806.H_1_5 + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[32]).Range.Text = model_2806.H_1_Tmdiff + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[33]).Range.Text = model_2806.H_2_Tm + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[34]).Range.Text = model_2806.H_2_Tmdiff + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[35]).Range.Text = model_2806.H_3_Tm + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[36]).Range.Text = model_2806.H_3_3 + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[37]).Range.Text = model_2806.H_3_5 + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[38]).Range.Text = model_2806.H_3_Tmdiff + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[39]).Range.Text = model_2806.H_4_Tm + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[40]).Range.Text = model_2806.H_4_Tmdiff + "";

                //    oDoc.Bookmarks.get_Item(ref oBookMark[41]).Range.Text = model_2806.Up_Tm + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[42]).Range.Text = model_2806.Up_Tmdiff + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[43]).Range.Text = model_2806.Back_Tm + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[44]).Range.Text = model_2806.Back_Tmdiff + "";
                //    oDoc.Bookmarks.get_Item(ref oBookMark[45]).Range.Text = model_2806.TmMax + "";
                //}
                //#endregion



                //弹出保存文件对话框,保存生成的Word
                SaveFileDialog sfd = new SaveFileDialog();
                sfd.Filter     = "Word Document(*.doc)|*.doc";
                sfd.DefaultExt = "Word Document(*.doc)|*.doc";
                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    object filename = sfd.FileName;

                    oDoc.SaveAs(ref filename, ref oMissing, ref oMissing, ref oMissing,
                                ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                                ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                                ref oMissing, ref oMissing);
                    oDoc.Close(ref oMissing, ref oMissing, ref oMissing);
                    //关闭word
                    oWord.Quit(ref oMissing, ref oMissing, ref oMissing);
                    MessageBox.Show("保存成功!");
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
                return;
            }
        }