In lilo starbase how to apply OptimalWidth for writer Tables?

In lilo starbase how to apply OptimalWidth for writer Tables?

I use Table.HoriOrient = com.sun.star.text.HoriOrientation.FULL in order to expand writer table from one edge to the other.

However, text is not aligned properly. OptimalWidth from writer doing that.

However, i dont know how to access it through starbase,

https://www.openoffice.org/api/docs/common/ref/com/sun/star/table/TableColumn.html

If it is unaccessible that way,
Can I write a function to do that?

Column and row properties lack any type of formatting in starbase lilo.

lilo starbase

Do you mean the LibreOffice StarBasic really???

Have you tried to examine the programming object by MRI ot XrayTool for the existing properties and methods?

1 Like

You can use UNO command SetOptimalColumnWidth

Sub textTableOptionalWidth
	dim oDoc as object, oTable as object, document as object, dispatcher as object, oCur as object
	oDoc=ThisComponent
	document=oDoc.CurrentController.Frame
	dispatcher=createUnoService("com.sun.star.frame.DispatchHelper")	
	oTable=oDoc.TextTables(0) 'your table
	'oTable=oDoc.TextTables.getByName("Table1")
	oCur=oTable.createCursorByCellName("A1") 'table cursor in 1st cell
	oCur.goToEnd(true) 'table cursor to all cells
	oDoc.CurrentController.Select(oCur) 'select table cursor
	dispatcher.executeDispatch(document, ".uno:SetOptimalColumnWidth", "", 0, Array()) 'optional columns in all table
	dispatcher.executeDispatch(document, ".uno:Escape", "", 0, Array()) 'deselect
End Sub