如果我想获取表中所有行的值,我想将其设置为数组。我该怎么做?
请建议我,非常感谢。
Sub Cut 'This method is cut value from user selectio and set to Copy variable.
Selection = ThisComponent.getCurrentSelection()
End Sub
答案 0 :(得分:0)
你问的是什么并不是很清楚。但如果目标是从选定的单元格中获取DataArray,那么以下内容应该这样做:
Sub getArrayFromSelection
oSelection = ThisComponent.getCurrentSelection()
if oSelection.supportsService("com.sun.star.sheet.SheetCellRange") then
aDataArray = oSelection.getDataArray()
lRows = ubound(aDataArray)
lCols = ubound(aDataArray(0))
for lRow = 0 to lRows
for lCol = 0 to lCols
msgbox aDataArray(lRow)(lCol)
next
next
end if
End Sub