Exemplo n.º 1
0
 public void SaveRedTitle(MissiveRedTitle model)
 {
     if (model.TemplateId == 0)
     {
         model.Template = null;
     }
     Core.MissiveManager.SaveRedTitle(model);
 }
Exemplo n.º 2
0
 public void SaveRedTitle(MissiveRedTitle model)
 {
     if (DB.MissiveRedTitles.Any(e => e.Name == model.Name && e.ID != model.ID))
     {
         throw new Exception("该文件字已经添加过");
     }
     DB.MissiveRedTitles.AddOrUpdate(model);
     DB.SaveChanges();
 }
Exemplo n.º 3
0
        public void AddRedTitle(Missive model, MissiveRedTitle redTitle)
        {
            if (redTitle.TemplateId == 0 || redTitle.Template == null)
            {
                return;
            }
            if (model.ContentId > 0 && model.Content == null)
            {
                model.Content = Core.FileManager.GetModel(model.ContentId);
            }
            var fileDoc     = WordHelper.CreateDoc(model.Content.PhysicalPath);
            var redTitleDoc = WordHelper.CreateDoc(redTitle.Template.PhysicalPath);
            var doc         = new XWPFDocument(redTitleDoc.Package);

            doc.CopyElements(fileDoc);
            doc.ReplaceContent("{文件字号}", model.WJ_ZH);
            doc.SaveAs(model.Content.AbsolutelyPath);
        }