Advertisement
Guest User

Untitled

a guest
Sep 14th, 2017
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. REM  *****  BASIC  *****
  2.  
  3. sub Main
  4. rem ----------------------------------------------------------------------
  5. rem define variables
  6. dim document   as object
  7. dim dispatcher as object
  8. dim oSheet as object
  9. rem ----------------------------------------------------------------------
  10. rem get access to the document
  11. document   = ThisComponent.CurrentController.Frame
  12. dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
  13. oSheet = thiscomponent.getcurrentcontroller.activesheet
  14.  
  15.  
  16. PrintAreas = oSheet.getPrintAreas()
  17. oBasket = ThisComponent.createInstance("com.sun.star.sheet.SheetCellRanges")
  18.  
  19. if NOT UBound(PrintAreas) then
  20. for each pArea in PrintAreas()
  21. CellRange = oSheet.getCellRangeByPosition(pArea.StartColumn, pArea.StartRow, pArea.EndColumn, pArea.EndRow)
  22. addr = CellRange.getRangeAddress()
  23. oBasket.addRangeAddress(addr, False)
  24. next
  25. ThisComponent.CurrentController.Select(oBasket)
  26. endif
  27.  
  28. rem ----------------------------------------------------------------------
  29. dim args1(0) as new com.sun.star.beans.PropertyValue
  30. args1(0).Name = "ToPoint"
  31. args1(0).Value = oBasket
  32.  
  33. rem dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
  34.  
  35. rem ----------------------------------------------------------------------
  36. dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
  37.  
  38. rem ----------------------------------------------------------------------
  39. dim args3(5) as new com.sun.star.beans.PropertyValue
  40. args3(0).Name = "Flags"
  41. args3(0).Value = "SVDT"
  42. args3(1).Name = "FormulaCommand"
  43. args3(1).Value = 0
  44. args3(2).Name = "SkipEmptyCells"
  45. args3(2).Value = false
  46. args3(3).Name = "Transpose"
  47. args3(3).Value = false
  48. args3(4).Name = "AsLink"
  49. args3(4).Value = false
  50. args3(5).Name = "MoveMode"
  51. args3(5).Value = 4
  52.  
  53. NewDocument = StarDesktop.loadComponentFromURL("private:factory/scalc", "_blank", 0, Array())
  54.  
  55. dispatcher.executeDispatch(NewDocument.CurrentController.Frame, ".uno:InsertContents", "", 0, args3())
  56.  
  57.  
  58. end sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement