
System.Object
EPLAN.Harness.API.ApiObject
EPLAN.Harness.API.Projects.Documents.ProjectEntity
EPLAN.Harness.API.Projects.Documents.Document
EPLAN.Harness.API.Projects.Documents.RevisionableDocument
EPLAN.Harness.API.Projects.Documents.Report
// Make list of all harnesses. // You can use both harnesses and cable units for report derivation. Its common base is the 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 the "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(); // Open the report. report.Open(false, false); // Get a report data. This action is slow as the object with all the data is constructed each time the property is accessed. // Note that we get ReportData object once and then use it for all the queries. ReportData reportTable = report.Data; // You can simply get the report dimensions. Please note that unused columns are also included. Console.WriteLine($"The report has {reportTable.ColumnCount} columns and {reportTable.RowCount} rows."); // Print all the used columns' names. //Console.Write("Report has following used columns: "); Console.WriteLine("Report has following used columns: "); foreach (ColumnDescription column in reportTable.Columns) { // Print only used columns. if (column.Used) Console.Write($"{column.Name}; "); } Console.WriteLine(); // Pick a column with a name "Length". ColumnDescription lengthColumn = reportTable.Columns.Where(n => n.Name == "Length").FirstOrDefault(); // Print the whole column: Console.WriteLine("Length column:"); for (int i = 0; i < reportTable.RowCount; i++) { // You can use ColumnDescription for indexing. Property value = reportTable[i, lengthColumn]; // Empty fields are set to null. if (value != null) Console.Write($"{value.ToString()}; "); else Console.Write("<empty>; "); } Console.WriteLine(); // Print the first row: Console.WriteLine("First row:"); for (int i = 0; i < reportTable.ColumnCount; i++) { // You can use coordinates for indexing. Note that unused columns are also present in the table. Property value = reportTable[0, i]; // Empty fields are set to null. if (value != null) Console.Write($"{value.ToString()}; "); else Console.Write("<empty>; "); } Console.WriteLine(); // WRONG! Constructing whole table when accessing each field in a row. //for (int i = 0; i < reportTable.ColumnCount; i++) //{ // // You can use coordinates for indexing. // Property value = report.Data[0, i]; // <<< SLOW! Getter of the Data property constructs the whole table each time! // // Empty fields are set to null. // if (value != null) // _context.ConsoleOutput(value.ToString()); //} // Close the report. report.Close();
Name | Description | |
---|---|---|
![]() | BackupExists | Does this document have a backup file on the disc? (Inherited from EPLAN.Harness.API.Projects.Documents.Document) |
![]() | CreatedBy | Overridden. Name of the document author. |
![]() | CreatedDate | Overridden. When was the document created. |
![]() | Data | Allows you to access the report table. The document must be open. |
![]() | Description | Overridden. Description of the document. |
![]() | ElectricalConfigurationInfo | Get electrical configuration of this report. |
![]() | HasFocus | Does this document have focus in the UI? (Inherited from EPLAN.Harness.API.Projects.Documents.Document) |
![]() | HasRevision | Does this document have a revision? (Inherited from EPLAN.Harness.API.Projects.Documents.RevisionableDocument) |
![]() | ID | ID of the HpD object. (Inherited from EPLAN.Harness.API.ApiObject) |
![]() | IsOpened | Is this document opened? (Inherited from EPLAN.Harness.API.Projects.Documents.Document) |
![]() | IsOpenedAsReadOnly | Is this document open as read only? (Inherited from EPLAN.Harness.API.Projects.Documents.Document) |
![]() | IsRevision | Is this document part of a revision? (Inherited from EPLAN.Harness.API.Projects.Documents.RevisionableDocument) |
![]() | IsUpToDate | Was the report updated after the last change of its sources? |
![]() | IsValid | Overridden. Tells you whether this object is valid or not. |
![]() | LastModified | Overridden. When was the document last modified. |
![]() | LastModifiedBy | Overridden. The user who modified the document last. |
![]() | LastUpdated | Date and time of the last update. See Update. |
![]() | Name | Overridden. Name of the document. |
![]() | Path | Overridden. Path to the document file. |
![]() | ReportType | Get the type of this report. Document must be open. |
![]() | Revisions | List all revisions this document has. (Inherited from EPLAN.Harness.API.Projects.Documents.RevisionableDocument) |
![]() | RevisionText | Note related to revision of this document. (Inherited from EPLAN.Harness.API.Projects.Documents.RevisionableDocument) |
![]() | Settings | Settings of the report. |
![]() | UserDefinedProperties | Overridden. List of User-defined properties of this document or project. |
![]() | Variant | Gets parent variant of this document. (Inherited from EPLAN.Harness.API.Projects.Documents.RevisionableDocument) |
Name | Description | |
---|---|---|
![]() | AddReportSources | Add new sources for this report. |
![]() | Close | Close this document. (Inherited from EPLAN.Harness.API.Projects.Documents.Document) |
![]() | Equals | Is this document equal to the following object? (Inherited from EPLAN.Harness.API.Projects.Documents.Document) |
![]() | Export | Export this report to a file. |
![]() | GetAllCableUnitInfos | Gets all cable units which can be used as report sources of this report. |
![]() | GetAllHarnessInfos | Gets all wire harnesses which can be used as report sources of this report. |
![]() | GetHashCode | Serves as the default hash function. (Inherited from EPLAN.Harness.API.Projects.Documents.Document) |
![]() | GetReportSources | Gets all sources from which this report is created. |
![]() ![]() | GetReportTypes | Returns list of report types"/>. |
![]() | Open | Overridden. Open this document. |
![]() | Promote | If this document is part of a revision, it gets promoted to a normal document. (Inherited from EPLAN.Harness.API.Projects.Documents.RevisionableDocument) |
![]() | Remove | Overridden. Remove the document. |
![]() | RemoveReportSources | Remove some sources of this report. |
![]() | Restore | Restore this document from backup. (Inherited from EPLAN.Harness.API.Projects.Documents.Document) |
![]() | Revise | Create new revision of this document. (Inherited from EPLAN.Harness.API.Projects.Documents.RevisionableDocument) |
![]() | Save | Save this document. (Inherited from EPLAN.Harness.API.Projects.Documents.Document) |
![]() | SaveAsTemplate | Save this document as template. (Inherited from EPLAN.Harness.API.Projects.Documents.RevisionableDocument) |
![]() | ToString | Returns a string that represents the current object. (Inherited from EPLAN.Harness.API.ApiObject) |
![]() | Update | Update the report. Any changes in source documents will show up in the report. |