Skip to content

Instantly share code, notes, and snippets.

@conholdate-gists
Last active April 28, 2021 10:37
Generate Reports from Excel Data in C# using GroupDocs.Assembly for .NET
Generate Reports from Excel Data using C#
1. Get Excel Data Source
2. Define Template
3. Generate Report
string ExcelDataFile = "Contracts_Data.xlsx";
string strDocumentTemplate = "Template.docx";
string strDocumentReport = "Output.docx";
// Define data table from Excel file
DocumentTableOptions options = new DocumentTableOptions
{
FirstRowContainsColumnNames = true
};
DocumentTable table = new DocumentTable(ExcelDataFile, 0, options);
// Assemble a document using the external document table as a data source.
DocumentAssembler assembler = new DocumentAssembler();
assembler.AssembleDocument(strDocumentTemplate, strDocumentReport,
new DataSourceInfo(table, "contracts"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment