Revit 2025 API
Table |
Sets cell style override options of this cell.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public void SetCellStyleOverrideOptions( TableCellStyleOverrideOptions helper )
Public Sub SetCellStyleOverrideOptions ( helper As TableCellStyleOverrideOptions )
public: void SetCellStyleOverrideOptions( TableCellStyleOverrideOptions^ helper )
member SetCellStyleOverrideOptions : helper : TableCellStyleOverrideOptions -> unit
Parameters

Exception | Condition |
---|---|
ArgumentNullException | A non-optional argument was null |

public static void ApplyFormattingToField(ViewSchedule schedule, int fieldIndex) { // Get the field. ScheduleDefinition definition = schedule.Definition; ScheduleField field = definition.GetField(fieldIndex); // Build unit formatting for the field. FormatOptions options = field.GetFormatOptions(); options.UseDefault = false; options.SetUnitTypeId(UnitTypeId.SquareInches); options.SetSymbolTypeId(SymbolTypeId.InSup2); // Build style overrides for the field // Use override options to indicate fields that are overridden and apply changes TableCellStyle style = field.GetStyle(); TableCellStyleOverrideOptions overrideOptions = style.GetCellStyleOverrideOptions(); overrideOptions.BackgroundColor = true; style.BackgroundColor = new Color(0x00, 0x00, 0xFF); overrideOptions.FontColor = true; style.TextColor = new Color(0xFF, 0xFF, 0xFF); overrideOptions.Italics = true; style.IsFontItalic = true; style.SetCellStyleOverrideOptions(overrideOptions); double width = field.GridColumnWidth; using (Transaction t = new Transaction(schedule.Document, "Set style etc")) { t.Start(); field.SetStyle(style); field.SetFormatOptions(options); // Change column width (affects width in grid and on sheet) - units are in Revit length units - ft. field.GridColumnWidth = width + 0.5; t.Commit(); } }
Public Shared Sub ApplyFormattingToField(schedule As ViewSchedule, fieldIndex As Integer) ' Get the field. Dim definition As ScheduleDefinition = schedule.Definition Dim field As ScheduleField = definition.GetField(fieldIndex) ' Build unit formatting for the field. Dim options As FormatOptions = field.GetFormatOptions() options.UseDefault = False options.SetUnitTypeId(UnitTypeId.SquareInches) options.SetSymbolTypeId(SymbolTypeId.InSup2) ' Build style overrides for the field ' Use override options to indicate fields that are overridden and apply changes Dim style As TableCellStyle = field.GetStyle() Dim overrideOptions As TableCellStyleOverrideOptions = style.GetCellStyleOverrideOptions() overrideOptions.BackgroundColor = True style.BackgroundColor = New Color(&H0, &H0, &HFF) overrideOptions.FontColor = True style.TextColor = New Color(&HFF, &HFF, &HFF) overrideOptions.Italics = True style.IsFontItalic = True style.SetCellStyleOverrideOptions(overrideOptions) Dim width As Double = field.GridColumnWidth Using t As New Transaction(schedule.Document, "Set style etc") t.Start() field.SetStyle(style) field.SetFormatOptions(options) ' Change column width (affects width in grid and on sheet) - units are in Revit length units - ft. field.GridColumnWidth = width + 0.5 t.Commit() End Using 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