【问题标题】:How to insert spreadsheet (ODS or XLSX) to text document (ODT or DOCX) via api如何通过 api 将电子表格(ODS 或 XLSX)插入文本文档(ODT 或 DOCX)
【发布时间】:2019-08-22 09:45:45
【问题描述】:

我有一个文本文档(ODT 或 DOCX)和一个电子表格(ODS 或 XLSX)。我使用 LibreOffice API(Java 中)打开此文档。

我想将电子表格作为嵌入对象插入到文本文档中。我可以手动完成(通过 GUI LibreOffice Writer - 菜单 Insert\Object\OLE Object),但我需要通过 API 来完成。 附言LibreOffice (OpenOffice) API 的官方文档很差。在这篇非常有趣的文章http://fivedots.coe.psu.ac.th/~ad/jlop/ 中找不到此信息。

【问题讨论】:

  • 写好你的前两个问题。它们既清晰又显示出研究成果。

标签: api libreoffice openoffice.org


【解决方案1】:

https://ask.libreoffice.org/en/question/76781/create-macro-to-insert-and-link-a-ole-spreadsheet/ 给出以下基本代码:

Sub oleexample
    oDoc = ThisComponent
    txt=oDoc.getText
    obj = oDoc.createInstance("com.sun.star.text.TextEmbeddedObject")
    obj.CLSID = "47BBB4CB-CE4C-4E80-a591-42d9ae74950f"
    obj.attach(ThisComponent.currentController().Selection.getByIndex(0))
    oXEO = obj.ExtendedControlOverEmbeddedObject
    oXEO.doVerb(0)
End Sub

https://forum.openoffice.org/en/forum/viewtopic.php?f=45&t=14342 也有一个嵌入 Math 对象的示例。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-04-12
    • 1970-01-01
    • 2023-03-22
    • 1970-01-01
    • 2013-05-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多