【问题标题】:Set the text of a control via macro in Libre Office Draw在 Libre Office Draw 中通过宏设置控件的文本
【发布时间】:2019-02-03 22:52:38
【问题描述】:

我在 Libre Office Draw 中设计了一个文档,现在需要通过使用从文本文件中读取的名称填充某些控件(主要是标签)来对其进行个性化。

从文本文件中读取是微不足道的,但在获取对放置在 Libre Office Draw 文档中的控件的引用时遇到了困难;提到的所有功能都与放置在对话框上的控件有关,在这种情况下似乎不适用。

这可能是实现我的目标的第一条线索:

document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

但是,如何找到放置在名为“MyLabel1”的“文档”上的控件?填写完标签后,需要将文档导出为 PDF。

非常感谢!

【问题讨论】:

    标签: libreoffice libreoffice-basic libreoffice-draw


    【解决方案1】:

    要将 LO Draw 文档从 Basic 导出为 PDF,您可以使用以下代码。

    Sub ExportToPDF
      sURL = convertToURL("d:\temp\lo_draw.pdf")
      dim mFileType(0)
      mFileType(0) = createUnoStruct("com.sun.star.beans.PropertyValue")
      mFileType(0).Name = "FilterName"
      mFileType(0).Value = "draw_pdf_Export"
      thisComponent.storeToURL(sURL, mFileType())
    End Sub
    

    要了解如何访问“标签”,请提供样本 LO Draw 文档。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-29
      相关资源
      最近更新 更多