Reply

Finding specific Table object

[ Edited ]

I am attempting to populate a table in a draft file. However, there does not appear to be any way of finding a specific table, except by index or table title. Is anyone else aware of a way to do this.

 

In my case I have tables on three separate sheets and none of them have a title. So how can I distinguish which one is which through the api.

 

here are the properties and methods associated with SolidEdgeDraft.Table

AnchorPoint

Application

Cell

ColumnHeaderPosition

Columns

Delete

Margin

MaximumRows

PageGap

Parent

ReverseDisplayOrder

Rows

SetOrigin

ShowColumnHeader

TableStyle

Titles

Update

 

Note there is also no Layer or AttributeSet listed, so I can't even use them to figure it out.

 

Thanks in advance.

Carl Breving

S&C Electric Co.

 

Posted by: Carl Breving
Post date: 5/1/2012 1:37:07 PM

1 REPLY

Re: Finding specific Table object

[ Edited ]

Carl,

 

you can add one more invisible Column to the end of each Table (Show property set to False) and set its Header property to any name you want to search for.

 

Then you check for the table name by doing the following comparison:

 

'----------------------------------------------------------------------
' Find a specific table in the active draft document
'----------------------------------------------------------------------
Dim objDoc As SolidEdgeDraft.DraftDocument = objApp.ActiveDocument
Dim strTableName As String = "MyTable"
For Each objTable As Table In objDoc.Tables
If Not objTable.Columns.Item(objTable.Columns.Count).Show And _
  objTable.Columns.Item(objTable.Columns.Count).Header = strTableName Then
  ' Table found
End If
Next

 

Posted by: Martin Bernhard
Post date: 5/3/2012 5:26:09 AM