这篇文章给大家介绍c#中怎么利用Aspose打印Word,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。
创建域
以word2013为例,插入-文本-文档部件-域,选择MergeField


下图示例就是插入域完毕的文档

使用Aspose.Word
注册Aspose.Words 去水印
string licenseFile = System.IO.Path.Combine(ModelPath, @"Model\Aspose.Words.lic");
if (File.Exists(licenseFile))
{
Aspose.Words.License license = new Aspose.Words.License();
license.SetLicense(licenseFile);
}域替换
Document doc = new Document(System.IO.Path.Combine(ModelPath, TempWordName));
DocumentBuilder builder = new DocumentBuilder(doc);
if (titleField != null && valueField != null)
//文档域的字段赋值
doc.MailMerge.Execute(titleField, valueField);
doc.Save(SavePath + ExportWordName);
关于c#中怎么利用Aspose打印Word就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。