I need to align View Schedule Headings to the left but dont see provisions in the Revit API for this.
I see "ScheduleHorizontalAlignment" for aligning data.
I see "ScheduleHeadingOrientation" for orienting the Heading horizontally/vertically.
Am i missing this or is there truly no way of doing this yet?
Dear Chris,
Thank you for your query.
Indeed, the only reference I see to ScheduleHorizontalAlignment is in the ScheduleField.HorizontalAlignment property:
Have you tried SetStyle.TableCellStyle and a left FontHorizontalAlignment using HorizontalAlignmentStyle.Left?
For safety's sake, I also asked the development team for advice.
I hope this helps.
Best regards,
Jeremy
Jeremy,
Thank you for your time reviewing my question.
After posting my question I did attempt to alter the View Schedule using .SetStyle but had no favorable result.
Snippet
// Didnt seem to alter anything. var style1 = vicMark.GetStyle(); style1.FontHorizontalAlignment = HorizontalAlignmentStyle.Left; style1.IsFontUnderline = true; vicMark.SetStyle(style1);
Perhaps we will have the ability to control headings in the future.
Thanks again for your time in this matter and other in our community.
Chris
Hi,
In case if you haven't found it yet try to set the override option of cells.
TableCellStyleOverrideOptions tableStyleOverride = new TableCellStyleOverrideOptions();
tableStyleOverride.HorizontalAlignment = true;
tableStyleOverride.Underline = true;
TableCellStyle style1 = new TableCellStyle();
style1.SetCellStyleOverrideOptions(tableStyleOverride); style1.FontHorizontalAlignment = HorizontalAlignmentStyle.Left; style1.IsFontUnderline = true; vicMark.SetStyle(style1);
You don't need to input any code! You can just select the text itself and hit Align Left. To select the text click once in the box then hit Align Left. I will add a screen shot.
I want to adjust the header and the cell underneath => horizontalalignment to the left
when i use the suggested code snippet i only see it change for the celltext not the header
How do i align the header text to the left?
Is it possible in the UI? If not, the API will not help.
Wow, this was four years ago already.
jeroen.vanvlierden, after attempting Jeremy's suggestions and not getting a favorable result, I gave up on the effort. I see that "rakotoarisoa.m" posted the clip of code I tried with additional lines. I have not tried that, and I'm curious if they had favorable results. I suppose there were, but I can't discern from the message. Is that the code snippet you mentioned that you tried?
Yes, it was. The code I was writing last week had to do with updating a lot of schedules in batch mode, where 1 schedule is the template for the definition of all the others. Everything worked, except for the outlining of the header. The user has done it manually afterwards, because I could not get it to work. All the other properties worked so it was not too much of a problem.
Thank you for the feedback! Perhaps one day there will be parity between what we can do with the Ribbon and what we can do with the API. Good news is that in Revit 2024 we will have dark mode! 😐
How i wish needs could be met before wants.