Changing the Font of schedule headers with SetCellStyle

Changing the Font of schedule headers with SetCellStyle

Rockit_for_Revit
Advocate Advocate
608 Views
2 Replies
Message 1 of 3

Changing the Font of schedule headers with SetCellStyle

Rockit_for_Revit
Advocate
Advocate

Hello,

I have project with hundreds of schedules created with the rows in the headers.

I would like to use the following code to change the font of each of the cells in the headers.

 

For intHeaderRow As Integer = 0 To intScheduleRowColumnCountHeaderRows
                                For intHeaderColumn As Integer = 0 To intScheduleRowColumnCountHeaderColumns
                                    Dim objTableCellStyle As TableCellStyle = objTableSectionData.GetTableCellStyle(intHeaderRow, intHeaderColumn)
                                    If Not objTableCellStyle.FontName.Equals(strNewFontName) Then
                                        If objTableSectionData.AllowOverrideCellStyle(intHeaderRow, intHeaderColumn) Then
                                            'Dim tcs As TableCellStyle = New TableCellStyle()
                                            Dim options As TableCellStyleOverrideOptions = New TableCellStyleOverrideOptions With {
                                                .FontSize = False
                                            }
                                            objTableCellStyle.FontName = strNewFontName
                                            objTableCellStyle.SetCellStyleOverrideOptions(options)
                                            objTableSectionData.SetCellStyle(intHeaderRow, intHeaderColumn, objTableCellStyle)
                                        End If
                                    End If
                                Next
                            Next

This code works well & changes the font, however it does not preserve the size or the boldness of the cell.

The size gets changed to the same as what is set in the schedule appearance header text.

Any ideas?

Kind Regards

David

 

0 Likes
Accepted solutions (1)
609 Views
2 Replies
Replies (2)
Message 2 of 3

JimJia
Alumni
Alumni

Dear David,

 

Can you provide a reproducible case for it? I didn't find problematic code in your sample code. 


In order to explore this matter further, we will need to provide a minimal reproducible case for the development team to analyse in depth.


In order to understand exactly what you mean and be able to research possible reasons for the discrepancy between the observed and expected behaviour, they require:
· A short exact description of what you are trying to achieve.
· The behavior you observe versus what you expect, and why this is a problem.
· A complete yet minimal Revit sample model to run a test in.
· A complete yet minimal macro embedded in the sample model or Visual Studio solution with add-in manifest that can be compiled, loaded, run and debugged with a single click to analyse its behavior live in the sample model.
· Detailed step-by-step instructions for reproducing the issue, e.g. which element to pick, what command to launch etc.
· http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

 

 


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
0 Likes
Message 3 of 3

Rockit_for_Revit
Advocate
Advocate
Accepted solution

Thank you,

This is now solved.

0 Likes