Ejemplo n.º 1
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);
        }