简体   繁体   English

Libreoffice 多重备份?

[英]Libreoffice Multiple Backups?

Is there a way, setting, macro, or otherwise, that can automatically create backups of the current document in a series?有没有一种方法、设置、宏或其他方式可以自动创建系列中当前文档的备份? Such as, working on a Writer document, pressing a macro button, and creating a backup at that time, so that there is another backup added to the previous backups in a folder?比如,在Writer文档上工作,按下宏按钮,当时创建一个备份,这样在一个文件夹中的先前备份的基础上又增加了一个备份?

Well, try this好吧,试试这个

Sub createBackUp()
Dim sURL As String
Dim aURL As Variant
Dim saveTime As String
  sURL = ThisComponent.getURL()
  If Trim(sURL) = "" Then Exit Sub  ' No name - cannot store
  saveTime = "_" & FORMAT(Now,"YYYYMMDD\_HHmmSS")
  aURL = Split(sURL, ".")
  If UBound(aURL) < 1 Then  ' No extention?
    sURL = sURL & saveTime
  Else
    aURL(UBound(aURL)-1) = aURL(UBound(aURL)-1) & saveTime
    sURL = Join(aURL,".")
  EndIf
  On Error Resume Next
  ThisComponent.storeToURL(sURL,Array())
  On Error GOTO 0
End Sub

Also you can try Timestamp Backup您也可以尝试时间戳备份

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM