Macro to set column width of table.

asked 2018-12-19 07:04:13 +0100

Aniruddha Mohod gravatar image

updated 2018-12-29 06:41:27 +0100

I can set the column width of first table in a document to optimum. How can I set it for all tables.

Sub SetTableOptimumWidth

Dim oDispHelper 'Dispatch helper Dim oFrame 'Current window frame. Dim oTable 'First table in the document. Dim oVCursor 'The view cursor Dim s$

oTable = ThisComponent.getTextTables().getByIndex(0) ThisComponent.getCurrentController().select(oTable) oVCursor = ThisComponent.getCurrentController().getViewCursor() oVCursor.gotoEnd(True) oVCursor.gotoEnd(True) oFrame = ThisComponent.CurrentController.Frame oDispHelper = createUnoService("com.sun.star.frame.DispatchHelper") s$ = ".uno:SetOptimalColumnWidth" oDispHelper.executeDispatch(oFrame, s, "", 0, Array()) End Sub

edit retag flag offensive close merge delete