Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Report Class / Export Method
Exported report file type.
Path to the directory where you want to save the exported report file.
Custom name of the exported report file. If not filled the name of the report is use.
Example
In This Topic
    Export Method (Report)
    In This Topic
    Export this report to a file.
    Syntax

    Parameters

    exportReportType
    Exported report file type.
    directoryPath
    Path to the directory where you want to save the exported report file.
    customReportName
    Custom name of the exported report file. If not filled the name of the report is use.
    Exceptions
    ExceptionDescription
    Argument is null.
    This directory was not found.
    Example
    The following example shows how to export a report to a file.
    // 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
    *
    */
    See Also