'Catia VBA, How to set table autoFit in drawing

I want to set a table autofit in Catia drawing. But I can't find any command. I'm looking forward to getting some guidance. Thanks

[enter image description here]

There is my simple code.

Dim oDoc As Document
    Dim oView As DrawingView
    Dim oTable As DrawingTables
    
    Set oDoc = CATIA.ActiveDocument
    Set oSheets = oDoc.Sheets
    Set oViews = oSheets.ActiveSheet.Views
    Set oView = oViews.ActiveView
    Set oTable = oView.Tables

    For i = 1 To oTable.Count
        'Debug.Print oneTab.Name
        'oTable.Item(i).AnchorPoint = CatTableBottomRight
    Next


Solution 1:[1]

By setting the row size and the column size to 0, auto-fit is activated.

Set oTables = oView.Tables

For i = 1 To oTables.Count
   Set oTable = oTables.Item(i)
   for j = 1 to oTable.NumberOfRows
      oTable.SetRowSize j, 0
   next
   for j = 1 to oTable.NumberOfColumns
      oTable.SetColumnSize j, 0
   next
next

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shrotter