Created
September 4, 2021 16:33
-
-
Save GroupDocsGists/ea7405ab3694830098c08589057c385c to your computer and use it in GitHub Desktop.
Convert XML data to Generate PDF and Word Reports using Template in CSharp
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 XML data using TXT template in CSharp | |
// Define datasource, template, and output report files. | |
string xmlDataSource = @"dataPath/Managers.xml"; | |
string templateFilePath = @"templatePath/xml-template.txt"; | |
string reportFilePath = @"reportsPath/xml-to-pdf-report.pdf"; | |
// Load XML data source | |
XmlDataSource dataSource = new XmlDataSource(xmlDataSource); | |
// Assemble document to generate PDF | |
DocumentAssembler assembler = new DocumentAssembler(); | |
assembler.AssembleDocument(templateFilePath, reportFilePath, new DataSourceInfo(dataSource, "managers")); |
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 MS Word Report from XML data using text template in CSharp | |
// Define datasource, template, and output report files. | |
string xmlDataSource = @"dataPath/Managers.xml"; | |
string templateFilePath = @"templatePath/xml-template.txt"; | |
string reportFilePath = @"reportsPath/xml-to-word-report.docx"; | |
// Load XML data source | |
XmlDataSource dataSource = new XmlDataSource(xmlDataSource); | |
// Assemble document to generate Word Report | |
DocumentAssembler assembler = new DocumentAssembler(); | |
assembler.AssembleDocument(templateFilePath, reportFilePath, new DataSourceInfo(dataSource, "managers")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment