【发布时间】:2017-05-06 04:03:34
【问题描述】:
创建标签的最佳方式是使用现有的行业标准工具,例如 Microsoft word。
您如何执行此操作并设置运输标签?
我不确定如何将合并字段映射到数据网格视图列。这是我到目前为止的代码:
// Create a new empty document.
DocumentModel document = new DocumentModel();
// Add document content.
document.Sections.Add(
new Section(document,
new Paragraph(document,
new Field(document, FieldType.MergeField, "FullName"))));
// Save the document to a file and open it with Microsoft Word.
document.Save("TemplateDocument.docx");
// If document appears empty in Microsoft Word, press Alt + F9.
Process.Start("TemplateDocument.docx");
// Initialize mail merge data source.
var dataSource = new { FullName = "John Doe" };
// Execute mail merge.
document.MailMerge.Execute(dataSource);
// Save the document to a file and open it with Microsoft Word.
document.Save("Document.docx");
Process.Start("Document.docx");
【问题讨论】:
-
你的问题非常不清楚。
-
如果您以编程方式生成文档,则根本不需要使用邮件合并。