Autodesk Inventor Customization
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
VB to change Custom Table Title and Header Cell / Row Height
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
234 Views, 2 Replies
09-06-2012 12:38 PM
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)
Solved! Go to Solution.
Re: VB to change Custom Table Title and Header Cell / Row Height
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
09-11-2012 06:26 PM in reply to:
nickv02
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.ActiveO bjectDefaults.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
Xiaodong Liang
Developer Technical Services
Autodesk Developer Network
Re: VB to change Custom Table Title and Header Cell / Row Height
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-02-2012 09:43 AM in reply to:
xiaodong.liang
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
