import clr
clr.AddReference(“RevitAPI”)
clr.AddReference(“System.Core”)
import System
clr.ImportExtensions(System.Linq)
from Autodesk.Revit.DB import *
clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
views = IN[0]
title = IN[1]
width = IN[2]
name = IN[3]
align = IN[4]
sh = views.Where(lambda x: x.Name==IN[1]).First()
ush = UnwrapElement(sh)
df = ush.Definition
td = ush.GetTableData()
tsd = td.GetSectionData(SectionType.Footer)
fields = []
for i in range(df.GetFieldCount()):
if not df.GetField(i).IsHidden:
fields.append(df.GetField(i))
for i, f in enumerate(fields):
f.ColumnHeading = name[i]
f.GridColumnWidth = int(width[i])*0.00328084
if align[i]==”l”:
f.HorizontalAlignment = ScheduleHorizontalAlignment.Left
if align[i]==”c”:
f.HorizontalAlignment = ScheduleHorizontalAlignment.Center
if align[i]==”r”:
f.HorizontalAlignment = ScheduleHorizontalAlignment.Right
OUT = df.GetField(0).ColumnHeading