如何将 return 列中的值从 StarBasic 到 Calc

How to return values in column from StarBasic to Calc

我正在尝试将一些自定义函数从 GoogleSheets 移至 LibreOffice Calc。

在 GoogleSheets 中,我可以 return 值序列 [1,2,3] 将它们放在同一行,[[1,2,3]] 将它们放在同一列。

到目前为止,在 Libreoffice 中,我已经能够 return 同一行中的几个值,使用下面的代码存根并按 Shift+Ctrl+Alt+Enter 而不是 Enter。但是,我找不到将 return 值放在同一列中的方法。

Function mya() as Variant 
    mya = Array(3,2,1)
End Function

有什么建议吗?

对于单个列中的所有值,使用以下函数和 Ctrl+Shift+Enter.

Function mya() as Variant 
    Dim myarray(2, 0) As Integer
    myarray(0, 0) = 1
    myarray(1, 0) = 2
    myarray(2, 0) = 3
    mya = myarray
End Function

文档在 "Multi-Dimensional Data Fields" 下 https://wiki.openoffice.org/wiki/Documentation/BASIC_Guide/Arrays