0

If i want to get value all of row in table and I want to set it in array . How I shound do ?

Please advice me , Thanks a lot .

Sub Cut 'This method is cut value from user selectio and set to Copy variable.
Selection = ThisComponent.getCurrentSelection()

 End Sub
Zulu
  • 8,765
  • 9
  • 49
  • 56

1 Answers1

0

It is not really clear what you are asking about. But if the goal is to get the DataArray from selected cells, then the following should do that:

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
Axel Richter
  • 56,077
  • 6
  • 60
  • 87