TableCellStyleSetCellStyleOverrideOptions Method |
Sets cell style override options of this cell.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntaxpublic void SetCellStyleOverrideOptions(
TableCellStyleOverrideOptions helper
)
Public Sub SetCellStyleOverrideOptions (
helper As TableCellStyleOverrideOptions
)
public:
void SetCellStyleOverrideOptions(
TableCellStyleOverrideOptions^ helper
)
member SetCellStyleOverrideOptions :
helper : TableCellStyleOverrideOptions -> unit
Parameters
- helper TableCellStyleOverrideOptions
-
Exceptions
Examplepublic static void ApplyFormattingToField(ViewSchedule schedule, int fieldIndex)
{
ScheduleDefinition definition = schedule.Definition;
ScheduleField field = definition.GetField(fieldIndex);
FormatOptions options = field.GetFormatOptions();
options.UseDefault = false;
options.SetUnitTypeId(UnitTypeId.SquareInches);
options.SetSymbolTypeId(SymbolTypeId.InSup2);
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);
field.GridColumnWidth = width + 0.5;
t.Commit();
}
}
Public Shared Sub ApplyFormattingToField(schedule As ViewSchedule, fieldIndex As Integer)
Dim definition As ScheduleDefinition = schedule.Definition
Dim field As ScheduleField = definition.GetField(fieldIndex)
Dim options As FormatOptions = field.GetFormatOptions()
options.UseDefault = False
options.SetUnitTypeId(UnitTypeId.SquareInches)
options.SetSymbolTypeId(SymbolTypeId.InSup2)
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)
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