LibreOffice Writer Macro to set table width

I can’t make heads nor tails out of the documentation for uno in relation to text tables and how to use if from the Macro Basic…

sub TableFix
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem What goes here to set table width to automatic?


rem move on to next table ready for retrigger (and/or other macros to format contents)
dispatcher.executeDispatch(document, ".uno:JumpToNextTable", "", 0, Array())

Noting that the record macro doesn’t capture anything in dialog boxes and the keybinds don’t include table relative mode…
I’m at a loss for how to set the table to 100% width in a macro, and need to be able to do so. (Literally several thousand to do)
I can probably figure out the rest of it if I can get how to access the table property for setting the width.

It also doesn’t help that the one example I’ve found in the docs for setting table width in the docs is for creating a table, not modifying an existing.

My goal functionality is click into table, key-trigger a macro (easily set using the tools→customize dialog), have the macro do the equivalent of table→properties tab 0 width = automatic, tab 1, deselect can break across pages/columns, enter, hop to next table (which as can be seen, I can already do.

Macro with API:

Sub changeWidthsInTextTable
	dim oDoc as object, oTable as object, oVCur as object, oRow as object, oCell as object, oTableCursor as object, aSeps()
	oDoc=ThisComponent
	rem insert table
	oTable=oDoc.createInstance("com.sun.star.text.TextTable")
	with oTable
		.initialize(3, 4) '3 rows, 4 columns
		.RelativeWidth=100
		.HoriOrient=0
	end with
	oVCur=oDoc.CurrentController.ViewCursor
	oDoc.Text.insertTextContent(oVCur.End, oTable, false)

	'1st change of cell-width -> OK
	oRow=oTable.Rows(0) '1st row
	aSeps=oRow.TableColumnSeparators
	aSeps(0).Position=500
	oRow.TableColumnSeparators=aSeps()
	
	'2nd change
	oRow=oTable.Rows(2) '3rd row	
	
	'aSeps=oRow.TableColumnSeparators
	
	aSeps(0).Position=1500
	oRow.TableColumnSeparators=aSeps()

	rem functional with one variable aSeps2() used more times
	dim a$, i%, aSeps2()
	const max=3
	for i=1 to max
		a=CInt(inputbox("Index of row - step " & i & "/" & max, "Change cell in 1st column to 80% width", i-1))
		oRow=oTable.Rows(a)
		aSeps2=oRow.TableColumnSeparators 'no error
		aSeps2(0).Position=aSeps2(0).Position*0.8 'set only 80% of width
		oRow.TableColumnSeparators=aSeps2()
	next i
End Sub

The macro is little bit complicated bacause there is bug 157053 – Writer: error for re-used variable when macro changes the witdh of cells in TextTable

Wrong kind of work, Kamil. Not answering my qyestion.
①You’re inserting a new table.
② you’re setting individual column widths.

Since the tables I’m reformatting ALREADY EXIST, create new table is worthless. Not even helpful, since that’s basically just a rewrite of the documentation which I’ve already noted I can’t grasp the nuances of.

Moreover, I can’t even create new table and copy/paste, since these tables have many merged cells, so creating a new and copying in will automatically break them and lose data. (I’ve tried that).

(In other words, it’s clear you didn’t read the last paragraph of my request.)

I’m sorry, my answer was in a hurry, unfortunately I haven’t a lot of time now. Many UNO commands need a parameters, and Macro Recorder doesn’t record the parameters for some UNO commands.
I don’t know the exact way you asked, I know to set Width of Table with the ColumnSeparators.
You can get inserted table like: oTable=oDoc.TextTables.getByIndex(0) or oTable=oDoc.TextTables.getByName("My Table").
Can you upload the example with your table, it will be better.