Michael Wazlowski wrote:
I also thought about using:

        cellRange = table.getCellRangeByPosition(1,0,1,numRows-1)
        doc.getCurrentController().select(cellRange)

but then I can't figure out how to get the cell range into the view cursor.

Can somebody point me to a solution for selecting a single column of a simple text table so I can use setOptimalColumnWidth
I just used a simple test, and you do indeed select the range using your code above.

Sub Main
 Dim oTable
 Dim oRange
 Dim oFrame
 Dim oDisp

 oTable = ThisComponent.getTextTables().getByIndex(0)
 oRange = oTable.getCellRangeByPosition(2, 0, 2, 4)
 ThisComponent.getCurrentController().select(oRange)
 oFrame = ThisComponent.CurrentController.getFrame()
 oDisp = createUnoService("com.sun.star.frame.DispatchHelper")
oDIsp.executeDispatch(oFrame, ".uno:SetOptimalColumnWidth", "", 0, Array())
End Sub

I hard coded my values, but you can do better than I did... You do not need to set the view cursor, because the select statement does this for you.

--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info:  http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to