【问题标题】:How Can I Get Value of This Cell without Formulas in LibreOffice Macros如何在没有 LibreOffice 宏中的公式的情况下获取此单元格的值
【发布时间】:2018-11-28 05:07:53
【问题描述】:

我在 LibreOffice 宏上工作,我在复制粘贴宏上工作。我可以写我的宏,但我有一个问题。

当我写它时,它会粘贴它的公式,但我不想复制公式。

由于我的 for 循环,我必须用他们的坐标来写它。

这是我的代码:

REM  *****  BASIC  *****

Sub CopyPaste

rA = CreateUnoStruct("com.sun.star.table.CellRangeAddress")
cA = CreateUnoStruct("com.sun.star.table.CellAddress")  

For iCount6 = 1 to 5


With rA
  .Sheet       = 0
  .StartColumn = 1
  .StartRow    = iCount6
  .EndColumn   = 1
  .EndRow      = iCount6

End With
With cA
  .Sheet       = 0
  .Column      = 3
  .Row         = iCount6
End With
ThisComponent.Sheets(0).CopyRange(cA, rA)

next iCount6

End Sub

我该怎么做?你能帮助我吗?

【问题讨论】:

    标签: libreoffice-calc libreoffice-basic


    【解决方案1】:

    复制一个范围试试这个代码

    sub copyRange
        Dim arr()
        Doc = ThisComponent
        sh = Doc.currentcontroller.activesheet
        RangeToCopy = sh.getCellRangeByName("A3:D7")
        arr = RangeToCopy.getDataArray
        RangeTarget = sh.getCellRangeByName("A10:D14")
        RangeTarget.setDataArray(arr)
    End Sub
    

    【讨论】:

      猜你喜欢
      • 2020-09-24
      • 2013-08-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多