ViewScheduleGroupHeaders Method |
Groups schedule header cells.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntaxpublic void GroupHeaders(
int top,
int left,
int bottom,
int right,
string caption
)
Public Sub GroupHeaders (
top As Integer,
left As Integer,
bottom As Integer,
right As Integer,
caption As String
)
public:
void GroupHeaders(
int top,
int left,
int bottom,
int right,
String^ caption
)
member GroupHeaders :
top : int *
left : int *
bottom : int *
right : int *
caption : string -> unit
Parameters
- top Int32
-
The index of the top row of the selected headers.
- left Int32
-
The index of the left column of the selected headers.
- bottom Int32
-
The index of the bottom row of the selected headers.
- right Int32
-
The index of the right column of the selected headers.
- caption String
-
The header caption.
Exceptions
Examplepublic static void CreateSingleCategoryScheduleWithGroupedColumnHeaders(Document doc)
{
using (Transaction t = new Transaction(doc, "Create single-category with grouped column headers"))
{
t.Start();
ViewSchedule vs = ViewSchedule.CreateSchedule(doc, new ElementId(BuiltInCategory.OST_Windows));
AddRegularFieldToSchedule(vs, new ElementId(BuiltInParameter.WINDOW_HEIGHT));
AddRegularFieldToSchedule(vs, new ElementId(BuiltInParameter.WINDOW_WIDTH));
AddRegularFieldToSchedule(vs, new ElementId(BuiltInParameter.ALL_MODEL_MARK));
AddRegularFieldToSchedule(vs, new ElementId(BuiltInParameter.ALL_MODEL_COST));
doc.Regenerate();
vs.GroupHeaders(0, 0, 0, 1, "Size");
vs.GroupHeaders(0, 2, 0, 3, "Other");
vs.GroupHeaders(0, 0, 0, 3, "All");
t.Commit();
}
}
public static void AddRegularFieldToSchedule(ViewSchedule schedule, ElementId paramId)
{
ScheduleDefinition definition = schedule.Definition;
SchedulableField schedulableField =
definition.GetSchedulableFields().FirstOrDefault<SchedulableField>(sf => sf.ParameterId == paramId);
if (schedulableField != null)
{
definition.AddField(schedulableField);
}
}
Public Shared Sub CreateSingleCategoryScheduleWithGroupedColumnHeaders(doc As Document)
Using t As New Transaction(doc, "Create single-category with grouped column headers")
t.Start()
Dim vs As ViewSchedule = ViewSchedule.CreateSchedule(doc, New ElementId(BuiltInCategory.OST_Windows))
AddRegularFieldToSchedule(vs, New ElementId(BuiltInParameter.WINDOW_HEIGHT))
AddRegularFieldToSchedule(vs, New ElementId(BuiltInParameter.WINDOW_WIDTH))
AddRegularFieldToSchedule(vs, New ElementId(BuiltInParameter.ALL_MODEL_MARK))
AddRegularFieldToSchedule(vs, New ElementId(BuiltInParameter.ALL_MODEL_COST))
doc.Regenerate()
vs.GroupHeaders(0, 0, 0, 1, "Size")
vs.GroupHeaders(0, 2, 0, 3, "Other")
vs.GroupHeaders(0, 0, 0, 3, "All")
t.Commit()
End Using
End Sub
Public Shared Sub AddRegularFieldToSchedule(schedule As ViewSchedule, paramId As ElementId)
Dim definition As ScheduleDefinition = schedule.Definition
Dim schedulableField As SchedulableField = definition.GetSchedulableFields().FirstOrDefault(Function(sf) sf.ParameterId = paramId)
If schedulableField IsNot Nothing Then
definition.AddField(schedulableField)
End If
End Sub
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also