VB to change Custom Table Title and Header Cell / Row Height

VB to change Custom Table Title and Header Cell / Row Height

Anonymous
Not applicable
3,314 Views
3 Replies
Message 1 of 4

VB to change Custom Table Title and Header Cell / Row Height

Anonymous
Not applicable

When you make a custom table in VB.net, adding in the Row Height property in the custom table create line only changes the data cell row heights, not the title cells or the header cell.  How do yo do set the title/header cell row heights ?

 

Dim oRowHeights_FS(11) As Double
oRowHeights_FS(0) = 0.6
oRowHeights_FS(1) = 0.6
oRowHeights_FS(2) = 0.6
oRowHeights_FS(3) = 0.6
oRowHeights_FS(4) = 0.6
oRowHeights_FS(5) = 0.6
oRowHeights_FS(6) = 0.6
oRowHeights_FS(7) = 0.6
oRowHeights_FS(8) = 0.6
oRowHeights_FS(9) = 0.6
oRowHeights_FS(10) = 0.6
oRowHeights_FS(11) = 0.6

Dim position_FrameShear As Point2d = _invApp.TransientGeometry.CreatePoint2d((oInvSheet.Border.RangeBox.MinPoint.X + 16), (oInvSheet.Border.RangeBox.MaxPoint.Y))

Dim oCustomTable_FrameShear As CustomTable
oCustomTable_FrameShear = oInvSheet.CustomTables.Add(vValue_FrameType & " " & vValue_Hand & " Frame Shear List", position_FrameShear, 6, 12, oTitles_FrameShear, oContents_FrameShear, oColumnWidths_FrameShear, oRowHeights_FS)

 

0 Likes
Accepted solutions (1)
3,315 Views
3 Replies
Replies (3)
Message 2 of 4

xiaodong_liang
Autodesk Support
Autodesk Support
Accepted solution

hi,

 

you will need to set the table style. e.g.

 

Public Sub CreateCustomTable()
    ' Set a reference to the drawing document.
    ' This assumes a drawing document is active.
    Dim oDrawDoc As DrawingDocument
    Set oDrawDoc = ThisApplication.ActiveDocument
    
    ' Set a reference to the active sheet.
    Dim oSheet As Sheet
    Set oSheet = oDrawDoc.ActiveSheet
    
    ' Set the column titles
    Dim oTitles(1 To 3) As String
    oTitles(1) = "Part Number"
    oTitles(2) = "Quantity"
    oTitles(3) = "Material"
    
    ' Set the contents of the custom table (contents are set row-wise)
    Dim oContents(1 To 9) As String
    oContents(1) = "1"
    oContents(2) = "1"
    oContents(3) = "Brass"
    oContents(4) = "2"
    oContents(5) = "2"
    oContents(6) = "Aluminium"
    oContents(7) = "3"
    oContents(8) = "1"
    oContents(9) = "Steel"
    
    ' Set the column widths (defaults to the column title width if not specified)
    Dim oColumnWidths(1 To 3) As Double
    oColumnWidths(1) = 2.5
    oColumnWidths(2) = 2.5
    oColumnWidths(3) = 4
      
      Dim oRowHeights_FS(2) As Double
oRowHeights_FS(0) = 1
oRowHeights_FS(1) = 1
oRowHeights_FS(2) = 1
 
 
     oDrawDoc.StylesManager.ActiveStandardStyle.ActiveObjectDefaults.TableStyle.HeadingGap = 1
    
    ' Create the custom table
    Dim oCustomTable As CustomTable
    Set oCustomTable = oSheet.CustomTables.Add("My Table", ThisApplication.TransientGeometry.CreatePoint2d(15, 15), _
                                        3, 3, oTitles, oContents, oColumnWidths, oRowHeights_FS)
   
    
End Sub

 

Message 3 of 4

Anonymous
Not applicable

Finally got around to trying this and it does indeed work, thank you. 

 

Wanted to add for future reference that my initial thought was setting the number would be the actual row height, when indeed, as the code states, it's a gap, so it's the space around the text in the column heading.  I set it to .150  and it worked great.

 

oDrawDoc.StylesManager.ActiveStandardStyle.ActiveObjectDefaults.TableStyle.HeadingGap = 0.150

 

0 Likes
Message 4 of 4

ndillner343SKL
Enthusiast
Enthusiast

Hi! Is there a way to use this method. But then also hide the title block and have it list the columns from the top - down. It's easy to do within the style editor but I'd like to be able to do it with iLogic. 

0 Likes