3

This is a productivity-related question. I frequently use LibreOffice Writer. Often times I write in a template.

Currently, the procedure of opening a template has four steps:

  1. Open Writer program

  2. Select: File->Template->Manage Templates

  3. In the new window, find and select the desired template (a new Writer process starts)

  4. Close the original Writer process.

Considering I do this multiple times each day, I can save a lot of time if I know a quicker way. I was wondering if there is a way to open the desired template in one step.

  • Is setting the template as standard template that opens every time you launch Writer or create a new document okay? – Byte Commander Dec 19 '16 at 21:02
  • @ByteCommander It's definitely a great suggestion, but not perfect. Because 20% of the time I want to open another template. – Behnam Dec 19 '16 at 21:04
  • Hmm. Write a macro may be? Assign two shortcuts to two templates? – user68186 Dec 19 '16 at 21:06
  • Well, but then 80% of the time you have the right template and don't need even one single click. You just have to do something in 20% of the cases... – Byte Commander Dec 19 '16 at 21:08
  • 2. <kbd>ctrl</kbd>-<kbd>w</kbd> (not ctrl-Q) get's you to a dialog, with both recent documents and templates, to choose from... but well, yeah, choosing a) writer templates, and then b) the one you want, is still multiple clicks... – Frank Nocke Dec 18 '18 at 10:40
1

There is a better way, but not exactly one step: Put all templates files in a local directory, where you could always access easily, then open the template file of choice from there.

Export from LibreOffice

The following steps are required to do only once. Preferably using LibreOffice 5.3 or newer, as some information may not be applicable to older releases of LibreOffice.

  1. Open LibreOffice (or run libreoffice from Terminal or the application launcher).

  2. In the sidebar, click Templates > Manage Templates. The "Template" window will appear.

  3. Select the first template, then press Ctrl+A to select all templates (Notice that selecting none or all will disable the open button).

    LibreOffice Templates

  4. Click Export button. The "Select Path" dialog will appear.

  5. In the file dialog, select a directory of choice and click OK to confirm. All templates will be exported (copied) to there, then a small dialog will appear when successfully exported.

    LibreOffice Template exported

  6. Close all windows of LibreOffice to finish. Then, open target directory i.e. ~/Documents/exported in File Manager to confirm that all template files were exported.

    Exported Templates in File Manager

As a result, you will have all template files (with file extension *.otp,*.ott) in the directory of choice. For LibreOffice 5.3 that was installed manually, there are 21 template files in total.

With template copies: Two steps

Since all templates have been exported (or copied), user is now able to open template files, without having to open LibreOffice at first anymore. This approach has two steps.

  1. Open target directory i.e. ~/Documents/exported in File Manager.

  2. Double-click the template file of choice.

This approach is good enough for most end users.

With desktop shortcut: One step

To reduce another step, create a shortcut to the desired template file to open it directly from the desktop. This approach has only one step.

  1. Double-click the shortcut without having to open File Manager.

Productivity trap: Creating too many shortcuts on the desktop will clutter the desktop and user will be less productive. I'd suggest one for the local directory where all the templates were exported, and another one for the most used template file. The fewer, the better.

Additional notes

Older releases of LibreOffice are more tedious to export templates via GUI, due to the user interface is less accessible to browse and select the templates. Also, the keyboard shortcut to select all templates doesn't work.

In that case, it is faster to copy recursively from the source directory of template files via Terminal. The location may differ, depending on how LibreOffice was installed.

  • If LibreOffice was installed from the repository, template files are found in /usr/lib/libreoffice/share/template/common/ directory.

  • If LibreOffice was installed manually using DEB files provided by the official website, template files are found in /opt/[libreofficeX.Y]/share/template/common/ directory.

However, copying the template files from source directory has one disadvantage: some template files may be provided elsewhere. For example, MediaWiki publisher extension provides mediawiki.ott that is found in ../share/extensions/.. instead of above locations.

Tested using LibreOffice 5.3 in Xubuntu 14.04; LibreOffice 5.1 in Xubuntu 16.04.

1

You can start LibreOffice (the plain launcher, not e.g. LibreOffice Writer directly).

starting LibreOffice launcher

There, instead of clicking on "Create Writer Document", you can click on Templates and select a template from the list appearing on the right to open a new document based on that one:

creating a new document from a template


Alternatively, you could tell it which template to use from the command-line:

libreoffice -n '/PATH/TO/TEMPLATE'

This should work with any template or normal document file that any LibreOffice application is able to open.

You can then bind this command to a shortcut or add it to the context menu of your LibreOffice Writer's launcher icon.

0

Let's say you want a single button/menu entry to open your checklist template...

cd /usr/share/applications
sudo cp libreoffice-writer.desktop libreoffice-writer-checklist.desktop
sudo pluma libreoffice-writer-checklist.desktop

pluma, nano, vi or any other editor of your liking.

Into that new .desktop file:

[Desktop Entry]
Version=1.0
Terminal=false
Icon=/usr/share/icons/Humanity/emblems/48/emblem-documents.svg
Type=Application
Categories=Office;WordProcessor;
Exec=libreoffice --writer /home/frank/.config/libreoffice/4/user/template/checklist.ott
Name=Checklist Template
GenericName=Word Processor
  • The original .desktop file had tons of translations you don't need, thus removed.
  • of course, you can also pick any other icon (just check our /usr/share/icons/, i.e. ctrl-F and find all .svg, turn on Thumbnail view to identify a nice one)
  • namepath to your .ott file and your home directory of course varies (after all, now that you explicitly give the path, you don't have to play by any libreoffice conventions, can be home/joe/herearetemplates)
  • btw: my original libreoffice file was a little messed up, had the Exec= key twice, just look out.

et voilà

enter image description here

Your new application should appear in the menu right away. And if you open /usr/share/applications in your file manager (i.e. caja) you should be able to create a link onto your desktop, add it to the top bar panel or as I do onto your plank:

enter image description here

Repeat for any other template you need (easier to start with your newly created, shorter .desktop file).

  • 1
    Since the template is in your home folder anyways, you can put the .desktop file in ~/.local/share/applications. – danzel Dec 18 '18 at 12:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.