macros - Libreoffice 计算 : loop throught cells macro

标签 macros libreoffice libreoffice-basic libreoffice-calc

我一直在搜索,但几乎找不到关于 LibreOffice Basic 的信息

我有点习惯在 excel 中编写宏,但这次需要做一个循环,直到我到达第一个空列并且它需要在 libreoffice 中。

在 excel 我会做这样的事情:

Dim i As integer

i = 0
Range("A1").Select
While cell.Offset(0, i).Value <> Null
    i = i + 1
Wend
MsgBox ("First empty column is " & Chr(i + 64))

但在 libreoffice 我不知道。

谁能帮我。

谢谢,
布鲁诺

最佳答案

我设法通过这种方式找到了答案:

dim cell as object
dim i as integer

i = 0
cell = Sheet.getCellByPosition(i,0)

while Cell.Type <> com.sun.star.table.CellContentType.EMPTY
    i = i+1
    cell = Sheet.getCellByPosition(i,0)
wend

当循环结束时,我得到变量 i对应于列号。然后我可以像在 excel 中一样将其转换为字母(chr 函数)

关于macros - Libreoffice 计算 : loop throught cells macro,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19580895/

相关文章:

excel - 具有多个条件的 COUNTIF

macros - 在 LibreOffice 中更改单元格背景颜色

visual-studio-2010 - __attribute__() 宏及其对基于 Visual Studio 2010 的项目的影响

macros - 在宏中写入 `loop ... collect` 时出现问题

linux - Elementary OS - LibreOffice/OpenOffice 冲突,Dpkg 错误(未满足的依赖项) - 陷入循环

LibreOffice 宏获取索引当前工作表

c++ - C++ 中的可扩展自动类注册

javascript - 使用 JavaScript 填写表单

python - 使用 python-xlsxwriter 或 bash 打开受密码保护的 ods 文件