Skip to content

Instantly share code, notes, and snippets.

@conholdate-gists
Last active April 28, 2021 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conholdate-gists/332145f637123e03307e8f213c9ca2f0 to your computer and use it in GitHub Desktop.
Save conholdate-gists/332145f637123e03307e8f213c9ca2f0 to your computer and use it in GitHub Desktop.
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