API Reference

Detailed and full API reference helps you master Tekla development

This is the most recent version of Tekla Open API.
For older versions, please visit Tekla Warehouse.

OperationCreateReportFromSelected Method

Creates a report from the selected objects using the given template name and filename.

If a path is not given in the filename, the file is created to the folder defined with the advanced option XS_REPORT_OUTPUT_DIRECTORY.

If the given folder does not exist, the report creation fails.

See Tekla Structures Help for more information about reports.

Namespace:  Tekla.Structures.Model.Operations
Assembly:  Tekla.Structures.Model (in Tekla.Structures.Model.dll) Version: 2023.0.1
Syntax
public static bool CreateReportFromSelected(
	string TemplateName,
	string FileName,
	string Title1,
	string Title2,
	string Title3
)

Parameters

TemplateName
Type: SystemString
The name of the report template to be used in report creation. The name must contain more than three characters.
FileName
Type: SystemString
The name of the created report. The name must contain more than three characters.
Title1
Type: SystemString
The first title for the created report.
Title2
Type: SystemString
The second title for the created report.
Title3
Type: SystemString
The third title for the created report.

Return Value

Type: Boolean
True if the report is created.
Exceptions
ExceptionCondition
ArgumentNullExceptionThrown when the TemplateName or FileName is null.
ArgumentExceptionThrown when the TemplateName or FileName is too short.
Examples
using Tekla.Structures.Model;
using Tekla.Structures.Model.Operations;
using Tekla.Structures.Geometry3d;

using System.Collections;

public class Example
{
       public void Example1()
       {
           Model Model = new Model();

           Beam B = new Beam(new Point(0,0,0), new Point(0,0,6000));
           Beam B1 = new Beam(new Point(0,1000,0), new Point(0,1000,6000));
           Beam B2 = new Beam(new Point(0,2000,0), new Point(0,2000,6000));

           B.Insert();
           B1.Insert();
           B2.Insert();

           ArrayList ObjectsToSelect = new ArrayList();
           ObjectsToSelect.Add(B);
           ObjectsToSelect.Add(B2);
           Model.CommitChanges();

           Tekla.Structures.Model.UI.ModelObjectSelector ModelSelector = new Tekla.Structures.Model.UI.ModelObjectSelector();
           ModelSelector.Select(ObjectsToSelect);

           Operation.CreateReportFromSelected("Assembly_list", "Assembly_list_selected.xsr", "MyTitle", "", "");
           Operation.DisplayReport("Assembly_list_selected.xsr");
       }
}
See Also