Is there a way of formating the columns so that the Column Header's text will be under each other, instead of continuing forward?
Example:
Item
Number instead of Item Number
Solved! Go to Solution.
Solved by bobvdd. Go to Solution.
if you want to wrap the column headers in a parts list table whenever there is a space in the header text, run below macro.
If tyou want to do the same in a generic table, below technique will not work unfortunately.
Public Sub SplitHeaderPartslist() Dim oDrawDoc As DrawingDocument Set oDrawDoc = ThisApplication.ActiveDocument Dim oSheet As Sheet Set oSheet = oDrawDoc.ActiveSheet Dim oPartslistTable As PartsList Set oPartslistTable = oSheet.PartsLists.Item(1) Dim oColumn As PartsListColumn For Each oColumn In oPartslistTable.PartsListColumns Dim strarray() As String strarray = Split(oColumn.Title, " ") oColumn.Title = "" Dim i As Integer For i = 0 To UBound(strarray) oColumn.Title = oColumn.Title & strarray(i) & Chr(13) & Chr(10) Next i Next oColumn End Sub
Cheers
Bob
Here is the modfified code to make it work on a generic table.
Public Sub SplitHeaderCustomTable() Dim oDrawDoc As DrawingDocument Set oDrawDoc = ThisApplication.ActiveDocument Dim oSheet As Sheet Set oSheet = oDrawDoc.ActiveSheet Dim oGenericTable As CustomTable Set oGenericTable = oSheet.CustomTables.Item(1) Dim oColumn As Column For Each oColumn In oGenericTable.Columns Dim strarray() As String strarray = Split(oColumn.Title, " ") oColumn.Title = strarray(0) Dim i As Integer For i = 0 To UBound(strarray) If i > 0 Then oColumn.Title = oColumn.Title & Chr(13) & Chr(10) & strarray(i) End If Next i Next oColumn End Sub
Enjoy
Bob
Tools > Options > VBA editor
Copy and paste in a new module in the Default.ivb file (Application project), if you want to use this code across multiple drawings.
You can run the macro with ALT+F8.
Cheers
Bob
Make sure you have your drawing active in Inventor and then in the editor hit the "black triangle" . See image.
Cheers
bob
I got the length of the heard kinda fixed. But cant edit the text to fit correctly.
See attached picture.
The code systematically splits all strings that have a space in them.
If you want to have a text like "DIA. A" on a single line, your will have to enter it as "DIA._A" or change the VBA code.
If you want something like this where only the first 3 strings are wrapped
Use this code
Public Sub SplitHeaderCustomTable() Dim oDrawDoc As DrawingDocument Set oDrawDoc = ThisApplication.ActiveDocument Dim oSheet As Sheet Set oSheet = oDrawDoc.ActiveSheet Dim oGenericTable As CustomTable Set oGenericTable = oSheet.CustomTables.Item(1) Dim oColumn As Column For Each oColumn In oGenericTable.Columns Dim strarray() As String strarray = Split(oColumn.Title, " ") oColumn.Title = strarray(0) Dim i As Integer For i = 0 To UBound(strarray) If i > 0 And i <= 3 Then oColumn.Title = oColumn.Title & Chr(13) & Chr(10) & strarray(i) End If If i > 3 Then oColumn.Title = oColumn.Title & " " & strarray(i) End If Next i Next oColumn End Sub
Bob