// Variant is obtained before...
Variant variant = ...
// Select desired report from the variant.
Report report = variant.GetReports().First(r => r.Name == "SampleReport");
// Open of the report is not mandatory.
// report.Open(false, false);
// Prepare folder where you want to store exported files.
string directory = @"C:\ExportedReports";
// Export the report to XML file with name taken from HpD project.
report.Export(ExportReportType.XmlReport, directory);
// Export the report to CSV file with name taken from HpD project.
report.Export(ExportReportType.CsvReport, directory);
// Export the report to TXT file with custom name.
report.Export(ExportReportType.XmlReport, directory, "TextReport");
// Export the report to MS Excel file with custom name.
report.Export(ExportReportType.XlsxReport, directory, "ExcelReport.xlsx");
// If the report is open, close it.
// report.Close();
/* Content of the selected folder:
*
* C:\
* |
* -- ExportedReports\
* |
* |- ExcelReport.xlsx
* |- SampleReport.csv
* |- SampleReport.xml
* -- TextReport.txt
*
*/