Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Schedule title/header text padding

6 REPLIES 6
Reply
Message 1 of 7
nur91m
930 Views, 6 Replies

Schedule title/header text padding

I'm creating an addin which will create a clone schedule from another one. But rows and columns will be in a header section. It gives me more control to change width and height of cells. Here, cloned schedule is shown on the left side in the picture. All rows and cols are created by plugin based on the values of right schedule. I need cloned schedule look the same as right schedule. The problem is around the text there is a small padding which crops the last letters. Is there a way to remove that padding? Revit file is attached.

nur91m_0-1644490788069.png

 

Labels (3)
6 REPLIES 6
Message 2 of 7
stever66
in reply to: nur91m

I don't believe there is any setting for the padding.  But I do notice that the text on the left is centered vertically.   But the text on the right is aligned with the top.  

 

Maybe that has something to do with the difference.   


You can also make a schedule template, and then apply that template to your new schedule.   That might be another way to try to get them to look the same.

 

Message 3 of 7
nur91m
in reply to: nur91m

Thank you for your reply. Cells have the identical settings. Font type, size, style, V/H alignments, border styles, background colors. All settings were copied from right schedulle as is. I attached revit file you can see it. 

Message 4 of 7
RPTHOMAS108
in reply to: nur91m

Have you tried getting the row height from the body of the original:

TableSectionData.GetRowHeight(Index) all rows in original should be uniform if content is not wrapped.

 

Then applying to cloned using TableSectionData.SetRowHeight(Index)

 

The original just uses the font alone as the guide to row height even if text type set has a border offset etc. Header section can be resized so probably starts with an unknown padding (overall cell height) which is then inherited when you add rows to the header.

Message 5 of 7
nur91m
in reply to: RPTHOMAS108

Yeah, I'm setting the height of rows as you said. Here is the code that sets all parameters

// Set cell values, styles and row height,
for (int row = 0; row < sourceScheduleRows.Count; row++)
{
  if (row != 0) headerSection.InsertRow(headerSection.NumberOfRows);
  var rowAttribute = sourceScheduleRows[row];
  headerSection.SetRowHeight(row, rowAttribute.RowHeight);
  for (int col = 0; col < headerSection.NumberOfColumns; col++)
   {
     var cellText = rowAttribute.ItemsArray[col];
     headerSection.SetCellText(row, col, cellText);
     var style = dataTableColumnAttributes.ColumnStyles[col];
     headerSection.SetCellStyle(col, style);
   }
}
Message 6 of 7
stever66
in reply to: nur91m

The fonts are different, but changing them to be the same doesn't fix the problem.

 

I'm not sure exactly how your created these.  The other schedule has 3 fields scheduled, with one hidden, which makes sense.  But the other schedule only has one URL field scheduled, but there are 2 columns.  I don't know where the second column is coming from.   

 

One appears to be a multicategory schedule, but the other is not.   

 

The schedule views look completely different.  I'm not even sure how you get a schedule view to look like the second one with the really big cells.  See  the attached image.

 

I also notice one schedule has the ability to align text vertically and horizontally.   That gets rid of the top "padding", but the cell sizes don't change.  One schedule also lets you change formatting for each cell, while the other one only lets you change the formatting for an entire column.


Applying view templates doesn't work either.  So I'm at a loss what's going on.

 

Message 7 of 7
RPTHOMAS108
in reply to: nur91m

Seems to be working ok for me.

 

Try setting the row height after you set the text.

 

 

Public Function Obj_220210a(commandData As ExternalCommandData, ByRef message As String, elements As ElementSet) As Result
        Dim app = commandData.Application
        Dim uidoc = commandData.Application.ActiveUIDocument
        Dim IntDoc = uidoc.Document

        Dim VS As ViewSchedule = TryCast(IntDoc.ActiveView, ViewSchedule)
        If VS Is Nothing Then Return Result.Cancelled Else

        Dim TD As TableData = VS.GetTableData
        Dim TSD As TableSectionData = TD.GetSectionData(SectionType.Body)

        Using tx As New Transaction(IntDoc, "Duplicate")
            If tx.Start = TransactionStatus.Started Then

                Dim VS0 As ViewSchedule = ViewSchedule.CreateSchedule(IntDoc, New ElementId(BuiltInCategory.OST_StructuralFraming))
                Dim TD0 As TableData = VS0.GetTableData
                Dim TSD0 As TableSectionData = TD0.GetSectionData(SectionType.Header)

                For ColI = 0 To TSD.NumberOfColumns - 2 '1 column already exists
                    Dim ColWidth As Double = TSD.GetColumnWidth(ColI)
                    TSD0.InsertColumn(0)
                    TSD0.SetColumnWidth(ColI, ColWidth)
                Next


                For RowI = 0 To TSD.NumberOfRows - 1
                    Dim RowHeight As Double = TSD.GetRowHeight(RowI)
                    If RowI > 0 Then
                        TSD0.InsertRow(RowI) '1 row already exists
                    End If

                    For ColI = 0 To TSD.NumberOfColumns - 1
                        Dim T As String = VS.GetCellText(SectionType.Body, RowI, ColI)
                        TSD0.SetCellText(RowI, ColI, T)
                    Next
                    TSD0.SetRowHeight(RowI, RowHeight)
                Next

                tx.Commit()
            End If
        End Using


        Return Result.Succeeded
    End Function

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community