Created
August 15, 2021 08:50
-
-
Save GroupDocsGists/39a6cdabd9133f9b8349b78e95b56a4b to your computer and use it in GitHub Desktop.
Generate PDF and Word Reports from CSV data using Template in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generate PDF Report from CSV data using TXT template in C# with GroupDocs.Assembly API | |
// Define datasource, template, and output report files. | |
string csvDataSource = @"path/person.csv"; | |
string templateFilePath = @"path/csv-template.txt"; | |
string reportFilePath = @"path/csv-to-pdf-report.pdf"; | |
// Load CSV Data Source | |
CsvDataSource dataSource = new CsvDataSource(csvDataSource, new CsvDataLoadOptions(true)); | |
// Generate Report in PDF format | |
DocumentAssembler assembler = new DocumentAssembler(); | |
assembler.AssembleDocument(templateFilePath, reportFilePath, new DataSourceInfo(dataSource, "persons")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generate Word DOCX Report from CSV data using TXT template in C# with GroupDocs.Assembly API | |
// Define datasource, template, and output report files. | |
string csvDataSource = @"path/person.csv"; | |
string templateFilePath = @"path/csv-template.txt"; | |
string reportFilePath = @"path/csv-to-pdf-report.docx"; | |
// Load CSV Data Source | |
CsvDataSource dataSource = new CsvDataSource(csvDataSource, new CsvDataLoadOptions(true)); | |
// Generate Report in DOCX format | |
DocumentAssembler assembler = new DocumentAssembler(); | |
assembler.AssembleDocument(templateFilePath, reportFilePath, new DataSourceInfo(dataSource, "persons")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment