문제를 해결하기 위해 타사 라이브러리에 관심이 있으시면 GemBox.Document 구성 요소를 사용해보십시오. 테이블의
' Use the component in free mode.
ComponentInfo.SetLicense("FREE-LIMITED-KEY")
' Define DataTable with two columns: 'Name' and 'Surname', and fill it with some data.
' You don't have to do this if you already have a DataTable instance.
Dim dataTable = New DataTable("People")
dataTable.Columns.Add(New DataColumn("Name", GetType(String)))
dataTable.Columns.Add(New DataColumn("Surname", GetType(String)))
dataTable.Rows.Add("John", "Doe")
dataTable.Rows.Add("Fred", "Nurk")
dataTable.Rows.Add("Hans", "Meier")
dataTable.Rows.Add("Ivan", "Horvat")
' Create and save a template document.
' You don't have to do this if you already have a template document.
' This code is only provided as a reference how template document should look like.
Dim document = New DocumentModel()
document.Sections.Add(
New Section(document,
New Table(document,
New TableRow(document,
New TableCell(document,
New Paragraph(document, "Name")),
New TableCell(document,
New Paragraph(document, "Surname"))),
New TableRow(document,
New TableCell(document,
New Paragraph(document,
New Field(document, FieldType.MergeField, "RangeStart:People"),
New Field(document, FieldType.MergeField, "Name"))),
New TableCell(document,
New Paragraph(document,
New Field(document, FieldType.MergeField, "Surname"),
New Field(document, FieldType.MergeField, "RangeEnd:People")))))))
document.Save("TemplateDocument.docx", SaveOptions.DocxDefault)
' Load a template document.
document = DocumentModel.Load("TemplateDocument.docx", LoadOptions.DocxDefault)
' Mail merge template document with DataTable.
' Important: DataTable.TableName and RangeStart/RangeEnd merge field names must match.
document.MailMerge.ExecuteRange(dataTable)
' Save the mail merged document.
document.Save("Document.docx", SaveOptions.DocxDefault)
' Open the documents with MS Word.
Process.Start("TemplateDocument.docx")
Process.Start("Document.docx")
어떤 종류 : 여기
은 샘플 VB.NET 코드를 어떻게 (코드에서 템플릿 문서를 만들어 및 파일에서로드하여)을하는 것입니다? 당신의 워드 문서 또는 데이터베이스 테이블에있는 테이블 또는 무엇? –Word 문서 내부 테이블. 내가 여기서하려고하는 것은 메일 머릿속의 데이터로 테이블을 채우는 것이다. 데이터를 디스패 레이싱 할 수는 있지만 테이블에 셀 단위로 셀을 넣을 수는 없습니다. – user1484788