【问题标题】:Libreoffice Unable to fill ListBox because I could not declare the listbox righteouslyLibreoffice 无法填充列表框,因为我无法正确声明列表框
【发布时间】:2021-06-08 11:40:44
【问题描述】:

我的 Calc 工作表中有一个列表框,我正在尝试解决它以填充数据

    DialogLibraries.LoadLibrary("Standard")
    oDialog = CreateUnoDialog(DialogLibraries.Standard)

    listBoxGruppe = oEvent.Source.Context.getControl("Drop_Down_5") 'oDialog.getControl("Drop_Down_5")

    aItems = sheetb.getCellRangeByName(subStrRan).dataarray
    Dim sItems(ubound(aItems))
    For i = 0 To ubound(aItems)
        sItems(i) = aItems(i)(0)
     Next i
     
     listBoxGruppe.addItems(sItems, 0)

    oDialog.Execute()  

但是,您似乎需要调用某个 Dialog,但不知道在这种情况下我的 Dialog 的名称是什么 - 这就是我背后的代码的样子

【问题讨论】:

    标签: vba basic libreoffice-calc libreoffice-basic openoffice-basic


    【解决方案1】:

    我认为在这种情况下您不需要对话

    dim RangeAddr as new com.sun.star.table.CellRangeAddress
        
        RangeAddr.EndColumn = 1
        RangeAddr.EndRow = Cell.CellAddress.Row
        RangeAddr.Sheet = 2
        RangeAddr.StartColumn = 1
        RangeAddr.StartRow = 0
        
        dim initParam(0) as new com.sun.star.beans.NamedValue
        initParam(0).Name="CellRange"
        initParam(0).Value = RangeAddr
        CellRangeListSource = doc.createInstanceWithArguments("com.sun.star.table.CellRangeListSource", initParam )
        listBoxGruppe.setListEntrySource CellRangeListSource
    

    【讨论】:

      猜你喜欢
      • 2017-10-31
      • 1970-01-01
      • 1970-01-01
      • 2011-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多