【问题标题】:Libre office writer macro insert date, and date + n daysLibre Office writer 宏插入日期和日期 + n 天
【发布时间】:2016-08-28 12:38:37
【问题描述】:

这里有一个类似的问题,但使用 calc 但是答案似乎是特定于 calc 的。我想在 libre writer 中编写一个宏,插入当前日期,逗号和空格,然后是当前日期 + 2 天,逗号和空格,然后是当前日期 + 14 天。

记录日期插入的marco会给出以下内容,但是老实说,我不知道如何解释此代码,并且在网上几乎找不到帮助。

sub recall_period
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:InsertDateField", "", 0, Array())


end sub

将不胜感激任何帮助或想法。干杯 达米安

【问题讨论】:

    标签: libreoffice libreoffice-basic


    【解决方案1】:

    Andrew Pitonyak's macro document 有许多使用日期的示例。

    • 第 7.7.1 节显示了将日期字段插入 Writer 文档的示例。
    • 第 7.7.2 节还介绍了如何将 10 天添加到日期。
    • 清单 5.100 提供了将任意金额添加到日期的函数。
    • 第 6.7 节展示了使用 Now() 获取当前日期的示例。

    注意:录制宏通常不是学习基本编程的好方法,因为它录制的是丑陋的调度程序调用,而不是更优雅的 API 代码。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-06
      • 2023-03-10
      • 2016-10-12
      • 2022-08-10
      • 2021-03-22
      • 2015-02-20
      相关资源
      最近更新 更多