Custom Table Format

Custom Table Format

ndillner343SKL
Enthusiast Enthusiast
508 Views
2 Replies
Message 1 of 3

Custom Table Format

ndillner343SKL
Enthusiast
Enthusiast

Hello, I'm using the following code to create a custom table. But the table isn't coming out exactly how I want it to. Is there a way to not show the Title block? Also, currently it list them from the bottom-up. I would like them to be listed from the top-down. Is there a way to change the direction of the table using iLogic?

 

 

Sub Table1()
	Dim oDwgDoc As DrawingDocument = ThisApplication.ActiveDocument
	Dim oSheet As Sheet = oDwgDoc.Sheets.Item(1)

'	 the column titles
	Dim oTitles(1) As String
	oTitles(0) = ""
	oTitles(1) = ""

'	 the contents Of the custom table (contents are row-wise)
	Dim oContents(41) As String
	
     oContents(0) = ""
     oContents(2) = ""
     oContents(4) = ""
     oContents(6) = ""
     oContents(8) = ""
     oContents(10) = ""
     oContents(12) = ""
     oContents(14) = ""
     oContents(16) = ""
     oContents(18) = ""
     oContents(20) = ""
     oContents(22) = ""
     oContents(24) = ""
     oContents(26) = ""
     oContents(28) = ""
     oContents(30) = ""
     oContents(32) = ""
     oContents(34) = ""
     oContents(36) = ""
     oContents(38) = ""
     oContents(40) = ""

     oContents(1) = ""
     oContents(3) = ""
     oContents(5) = ""
     oContents(7) = ""
     oContents(9) = ""
     oContents(11) = ""
     oContents(13) = ""
     oContents(15) = ""
     oContents(17) = ""
     oContents(19) = ""
     oContents(21) = ""
     oContents(23) = ""
     oContents(25) = ""
     oContents(27) = ""
     oContents(29) = ""
     oContents(31) = ""
     oContents(33) = ""
     oContents(35) = ""
     oContents(37) = ""
     oContents(39) = ""
     oContents(41) = ""
	
	' the column widths (defaults to the column title width if not specified)
	Dim oColumnWidths(1) As Double
	oColumnWidths(0) = 8
	oColumnWidths(1) = 8

	oPlacementPoint = ThisApplication.TransientGeometry.CreatePoint2d(38, 26)
	' Create the custom table
	Dim oCustomTable As CustomTable
	
	oCustomTable = oSheet.CustomTables.Add("Table1", oPlacementPoint, _
	2, 21, oTitles, oContents, oColumnWidths)

	' Change the 3rd column to be left justified.
'	oCustomTable.Columns.Item(1).ValueHorizontalJustification = kAlignTextLeft
'	oCustomTable.Columns.Item(4).ValueHorizontalJustification = kAlignTextLeft

	' Create a table format object
	Dim oFormat As TableFormat
	oFormat = oSheet.CustomTables.CreateTableFormat

	' inside line color to red.
	oFormat.OutsideLineColor = ThisApplication.TransientObjects.CreateColor(0, 0, 0)
	oFormat.InsideLineColor = ThisApplication.TransientObjects.CreateColor(0, 0, 0)

	' outside line weight.
	oFormat.OutsideLineWeight = 0.05
	oFormat.InsideLineWeight = 0.05

	' Modify the table formats
	oCustomTable.OverrideFormat = oFormat
End Sub

 

0 Likes
Accepted solutions (1)
509 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor
Accepted solution

Hi @ndillner343SKL.  I think that these three lines could be used just after you have created the table, to set those things the way you want them.

oCustomTable.ShowTitle = False
oCustomTable.HeadingPlacement = HeadingPlacementEnum.kHeadingAtTop
oCustomTable.TableDirection = TableDirectionEnum.kTopDownDirection

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡 or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

ndillner343SKL
Enthusiast
Enthusiast

This did it. Thank you very much!

0 Likes