Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Variant Class / CreateReport Method
Name of the new report.
Sources of the report. See GetAllWireHarnessInfos and GetAllCableUnitInfos.
Type of the report. See Report.GetReportTypes.
The path to a report template file (*.hxrt).
Select electrical configuration for creating this report.
Example
In This Topic
    CreateReport Method
    In This Topic
    Create a new report.
    Syntax

    Parameters

    name
    Name of the new report.
    sources
    Sources of the report. See GetAllWireHarnessInfos and GetAllCableUnitInfos.
    type
    Type of the report. See Report.GetReportTypes.
    templatePath
    The path to a report template file (*.hxrt).
    electricalConfiguration
    Select electrical configuration for creating this report.

    Return Value

    New report.
    Exceptions
    ExceptionDescription
    The object is in invalid state. Obtain a new one.

    Internal error of HpD or HpD API.

    IMPORTANT: Throwing this exception changes HpD Api's state to Failed.

    This operation was denied because of your license.
    Argument is invalid. The exception is thrown when a wrong argument is passed to the method or the setter of property.
    Report with this name already exists.
    Example
    // Make list of all harnesses.
    // You can use both harnesses and cable units for report derivation. Its common base is DerivationSource class.
    List<DerivationSource> sources = variant.GetAllWireHarnessInfos().Cast<DerivationSource>().ToList();
    
    // You could add all cable units as well.
    // sources.AddRange(variant.GetAllCableUnitInfos().Cast<DerivationSource>());
    
    // Select an Aggregated BOM report type.
    // We use "Name" property because it does not depend on localization. "LocalizedName" does.
    // To see see all the report type names, list all report types using Report.GetReportTypes().
    ReportType reportType = Report.GetReportTypes().Where(n => n.Name == "AggregatedBOMReporter").FirstOrDefault();
    
    // Create a new Aggregated BOM report from all harnesses in a variant.
    Report report = variant.CreateReport("My new report name", sources, reportType);
    
    // Save the project so the new report is saved into the project structure.
    project.Save();
    See Also