Ask Your Question

export of recently used files list ?

asked 2018-02-05 16:27:07 +0200

Boca gravatar image

I recently had to do a complete OS reinstall and have lost my extensive list of recently used files from Libre Office? Is it possible to backup these up so they are available in a similar situation in future?

edit retag flag offensive close merge delete


Yes, and it is as old as computer technology ... called back-up. Maybe starting to use a portable version of LibreOffice from a USB memory stick would help you big time with little effort. Keep your LO-portable installation and your files on a USB stick. This way any copy of this stick to an other stick, data carrier included your new reinstalled OS, ill contain all your files and all your presets of LO where ever you go.

Down side: this introduces the problem of managing multiple copies ;-)

Henk C. Meerhof gravatar imageHenk C. Meerhof ( 2018-02-05 20:03:22 +0200 )edit

Hi Henk, thanks for the input. I already backup all data files in multiple locations and wondered if I could get access to this "recently used" list so that it could be back-ed up also. Is there a specific file which contains this list? I like the idea of LO on a USB stick but would also need KMyMoney, etc etc to avoid similar issues with those progs. The problem might then be that if there is a problem with the USB stick... I could lose my LO recently-added files list this way also? Thanks,

Boca gravatar imageBoca ( 2018-02-05 20:18:22 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2018-02-05 22:28:11 +0200

librebel gravatar image

Hello @Boca,

To export your Recently Used Documents list to a separate text file, you could call the following Basic macro:

Sub exportRecentDocumentsList( Optional strFile )
REM Exports the list of LibreOffice Recent Documents as URLs to a text file, in order of recency.
REM <strFile> : [OPTIONAL] Path to the text file to which the list of Recent Documents shall be exported.
REM If no argument is specified, the text file will be saved as "recent_documents.txt" inside your Home Folder.

    Const strDefaultFile As String = "$(home)/recent_documents.txt"
    If IsMissing( strFile ) Then strFile = strDefaultFile

    Dim strHeader As String : strHeader = "LibreOffice Recent Documents ( Listed on " & Now() & "):"

    Dim oPath as Object : oPath = CreateUnoService( "" )
    strFile = oPath.substituteVariables( strFile, true )
    strFile = ConvertToURL( strFile )

    Dim aProps(1) As New
    aProps(0).Name  = "nodepath"
    aProps(0).Value = "/org.openoffice.Office.Histories/Histories/"
    aProps(1).Name  = "enableasync"
    aProps(1).Value = False

    Dim oConfig As Object, oHistory As Object
    oConfig  = createUnoService( "" )
    oHistory = oConfig.createInstanceWithArguments( "", aProps() )

    Dim oOrderList    As Object  :  oOrderList  = oHistory.PickList.OrderList
    Dim sOrderNames() As String  :  sOrderNames = oOrderList.getElementNames()
    Dim iMaxIndex     As Integer :  iMaxIndex   = uBound( sOrderNames )

REM Append the Recent Document URLs to the end of the file strFile.
    Dim i As Integer
    Dim iFNum As Integer : iFNum = Freefile()
    Open strFile for Append as iFNum
    Print #iFNum, strHeader
    For i = 0 To iMaxIndex
        Print #iFNum, oOrderList.getByName( sOrderNames(i) ).HistoryItemRef
    Next i
    Close #iFNum
End Sub

The list of recent documents can also be reached via the menu Tools : Options : LibreOffice : Advanced : Open Expert Configuration, and then in the dialog that appears browse to the node org.openoffice.Office.Histories/Histories/PickList.

Hope it helps, lib

edit flag offensive delete link more


Excellent.. thank you. For now, I can just screen-shot the << histories="" picklis="">> until I can sort out the macro... thanks again, Tony

Boca gravatar imageBoca ( 2018-02-06 11:55:52 +0200 )edit

You're welcome @Boca,

After your question was answered, always remember to mark the accepted answer as Correct, and karma-permitting upvote it, so that other users on this forum can also see that it is a usable answer. With Regards, lib

librebel gravatar imagelibrebel ( 2018-02-06 12:45:38 +0200 )edit

Thanks for the reminder.. I'm new to this board and wasn't aware of the etiquette. I think i have now marked as correct and up-ticked it... Thanks again for your help.

Boca gravatar imageBoca ( 2018-02-06 22:24:29 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-02-05 16:27:07 +0200

Seen: 201 times

Last updated: Feb 05 '18