Custom Table Preset Style API

Custom Table Preset Style API

Anonymous
Not applicable
923 Views
3 Replies
Message 1 of 4

Custom Table Preset Style API

Anonymous
Not applicable

If I have a custom table, I understand how to change the style manually.  But how do I select a custom preset style?

 

customtablestyle.jpg

 

I can see the following line items under the API map.

customtablesapi.jpg

However the object browser doesn't show much to work with under TableFormat

tableformat.jpg

TableStyle seems to have a more line items, particularly "StyleLocation" and "StyleType" but I am not really sure if they are what I am after particularly since they are listed as "Read Only"

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

WCrihfield
Mentor
Mentor

In iLogic, if you have identified the Table object you want, you can use the following line to set its TableStyle.

Assuming oCTable is the variable that is identified as your Table, and oTableStyle1 is the variable identified as your TableStyle:

 

oCTable.Style = oTableStyle1

 

I hope this helps.
If this solves your problem, or answers your questions, please click 'Accept As Solution".
Or, if this helps you reach your goal, please click 'LIKES" 👍.

Also, if you're interested, here are a few of the 'Ideas' I'd like to get implemented.
If you agree with any of them, please vote for them.

  • MessageBox, InputBox, and InputListBox Size & Format Options Click Here
  • Constrain & Dimension Images In Assembly Sketches & Drawing Sketches (TitleBlock Sketches & SketchedSymbols) Click Here
  • Save Section View Status In DesignViewRepresentation (So It Can Be Used In The Drawing) Click Here
  • Add SolidBodies Folder In iLogic Rule Editor Model Tab Click Here
  • Convert All Views To Raster Before Autosave Stores To 'OldVersions' Folder Click Here

Inventor 2020 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 4

Anonymous
Not applicable

I get the following error when trying to select which tablestyle to use.

 

"Object reference not set to an instance of an object."

 

Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDrawDoc.ActiveSheet
Dim oTitles(0 To 13) As String
	oTitles(0)="..."
        ...
	oTitles(13)="..."
Dim oContents(0 To 13) As String
	oContents(0)="..."
        ...
	oContents(13)="..."
Dim oCTable As CustomTable = oSheet.CustomTables.Add("Table Name", ThisApplication.TransientGeometry.CreatePoint2d(15, 15), 14, 1, oTitles, oContents)
Dim oTableStyle1 As TableStyle
oTableStyle1.Name = "Insert Style Name"
oCTable.Style = oTableStyle1
0 Likes
Message 4 of 4

WCrihfield
Mentor
Mentor
Accepted solution

Go to: Manage tab / Styles and Standards panel / and open Styles Editor.

Expand the node beside Table, to see the available TableStyles.

You have to specify the exact name of one of those available styles in your code, where TableStyle1 is.

 

 

Dim oTableStyle1 As TableStyle
Set oTableStyle1 = oDrawDoc.StylesManager.TableStyles.Item("Table (ANSI)")

 

Where you've already defined oDrawDoc = ThisApplication.ActiveDocument

 

 Styles Editor Pic.png

Wesley Crihfield

EESignature

(Not an Autodesk Employee)