csharp 在groupdocs.assembly 1.3.0.cs中生成报告

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp 在groupdocs.assembly 1.3.0.cs中生成报告相关的知识,希望对你有一定的参考价值。

// For complete examples and data files, please go to https://github.com/groupdocsassembly/GroupDocs_Assembly_NET
private static TemplateEditor ProcessWord()
       {
           var templatePath = Path.Combine(_dirPath, "WordTemplate.docx");

           WordsTemplateEditor templateEditor = new WordsTemplateEditor(templatePath);

           if (!templateEditor.IsSupported)
           {
               throw new NotSupportedException("Document is not supported");
           }

           var hasFields = templateEditor.HasFields;
           var words = templateEditor.GetWords();
           if (!hasFields)
           {
               if (words.Length == 0)
               {
                   throw new Exception("Document is empty. Library is not working with empty Word document!");
               }
           }

           var insertField = new Groupdocs.Assembly.Words.TextField
           {
               Name = "MergeField",
               Position = words[0].Position,
               Length = words[0].Value.Length
           };

           if (!templateEditor.IsFieldExist(insertField.Name))
           {
               templateEditor.AddField(insertField);
           }
           else
           {
               var deletingField = templateEditor.GetField(insertField.Name);
               templateEditor.RemoveField(deletingField);
           }

           templateEditor.Save();

           return templateEditor;
       }

以上是关于csharp 在groupdocs.assembly 1.3.0.cs中生成报告的主要内容,如果未能解决你的问题,请参考以下文章

Scorpio-CSharp总链接

关于异常Microsoft.CSharp.RuntimeBinder.RuntimeBinderException

csharp 在实际控制之前捕捉击键

csharp 在Startup.cs上设置招摇

csharp 在课堂上获取所有属性

csharp Crystal报告显示在WEB上