0

我想在 LibreOffice 电子表格上编写一个宏,将 HTTP 请求发送到 Web URL 并接收类似 JSON 的响应。我可以使用 LibreOffice 基本宏编程来做到这一点吗?我在哪里可以获得有关 API 的信息。

我真的很感激任何提示。

谢谢

4

1 回答 1

5

我已经来不及帮助安东尼奥了,但是为了后代......

您可以从 Basic 调用电子表格函数,如open office docs中所述。这是一个调用该WEBSERVICE()函数的简单示例:

Function GetWebContent(url As string) As String
    On Error GoTo ErrorHandler

    Dim funtionAccess As Object
    functionAccess = createUnoService("com.sun.star.sheet.FunctionAccess")

    GetWebContent = functionAccess.callFunction("WEBSERVICE",Array(url))

    Exit Function
ErrorHandler:
    GetWebContent = "Error " & Err
End Function


Function Test

    Dim url As String
    url = "http://www.google.com"

    Dim response As String
    response = GetWebContent(url)

End Function
于 2019-09-08T16:45:46.657 回答