Bug 125769 - Save as" offers .ott as default file type if you use a template to create odt-file from desktop
Summary: Save as" offers .ott as default file type if you use a template to create odt...
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
Depends on:
Blocks: Desktop-Integration Templates Save
  Show dependency treegraph
Reported: 2019-06-07 08:47 UTC by Orwel
Modified: 2021-01-27 13:54 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:

affected template (11.97 KB, application/vnd.oasis.opendocument.text-template)
2019-09-02 17:07 UTC, Orwel
Wrong behaviour (17.76 KB, image/jpeg)
2021-01-27 12:48 UTC, Orwel
PIC1 wrong behaviour (17.76 KB, image/jpeg)
2021-01-27 12:49 UTC, Orwel
PIC2 correct behaviour (14.92 KB, image/jpeg)
2021-01-27 12:50 UTC, Orwel
test_template (10.98 KB, application/vnd.oasis.opendocument.text-template)
2021-01-27 12:50 UTC, Orwel

Note You need to log in before you can comment on or make changes to this bug.
Description Orwel 2019-06-07 08:47:06 UTC
If you create in WIN10 a new .odt file from your template (I have not tested if default template is also affected) and you use the Save as command/button, you get a default offer from LO (in the Save as window that pops up) to save the file as template (.ott). This is strange, as if you do not notice it, you resave the file as a template. This behaviour is not present if you open a new file directly in LO (File/New file/Text document), which uses the same default template of yours and you use the command Save as. In this case LO offers you saving it as .odt file, which is correct.

Steps to Reproduce:
1. Create your own template (mine is located on the disk E: in my own directory,  LO is located on C: in the default directory).
2. In Win-Explorer create through right click/New a New text document (Open document), which is .odt.
3. Use Save as command 

Actual Results:
In the Save as window Lo offers to save the file as template (.ott) by default. See File type.

Expected Results:
In the Save as window LO should offer to save the file as text file (.odt) by default.

Reproducible: Always

User Profile Reset: Yes

OpenGL enabled: Yes

Additional Info:
Actual Version: (x64)
Build ID: 5896ab1714085361c45cf540f76f60673dd96a72
CPU threads: 8; OS: Windows 10.0; UI render: default; 
Locale: sk-SK (sk_SK); Calc: group threaded

May be there is something with the location of default path of templates, which is C:\Users\XXXX\AppData\Roaming\LibreOffice\4\user\templates
- I tested on this default installation of the user account (reseting it) - I used the original profile created by the installation of LO . There is no sub-directory named "template". The bug is present. Adding a empty directory "template" did not solve the problem.

I do not know, which version is affected as first.
Comment 1 Dieter 2019-06-07 09:07:09 UTC
I can't confirm this with

Version: (x64)
Build-ID: 2412653d852ce75f65fbfa83fb7e7b669a126d64
CPU-Threads: 4; BS: Windows 10.0; UI-Render: Standard; VCL: win; 
Gebietsschema: de-DE (de_DE); UI-Sprache: de-DE
Calc: threaded

Could you please try to reproduce it with the latest version of LibreOffice from https://www.libreoffice.org/download/libreoffice-fresh/ ? I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' if the bug is still present in the latest version. Change to RESOLVED WORKSFORME, if the problem went away.
Comment 2 Orwel 2019-09-02 17:07:24 UTC
Created attachment 153819 [details]
affected template

my template using which causes the bug on my PC
Comment 3 Orwel 2019-09-02 17:08:36 UTC
Yes, I have still the same problem. I have installed 6.2.6 and:
1. My default registry key was changed (bug 94857) and the default template in the registry key was overwritten by LO. I tested the behaviour with the default LO template. The bug was not present.
2. I changed the registry key back to my template path on E:. Now the bug is present.

I have attached my default template.
Comment 4 Dieter 2020-03-02 18:21:58 UTC
Orwel, it seems, that nobody can confirm your bug. So let me ask, is it still present in the latest version. Could you please try to reproduce it with the latest version of LibreOffice from https://www.libreoffice.org/download/libreoffice-fresh/ ?I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' if the bug is still present in the latest version.
Comment 5 Orwel 2020-03-09 15:36:32 UTC
Thank you Dieter for commitment.

It is weird. Could it be something with my Windows installation? But i do not understand why, if it occurs in LO environment. 
The behaviour is still present, i tried (using Separate install GUI) The same behaviour.

Let me tell you some more specifications:
1. I thought maybe something wrong with my profile, but a default clear profile brings the same result.
2. I have a registry change for .odt file - \HKEY_CLASSES_ROOT\.odt\LibreOffice.WriterDocument.1\ShellNew - Default (DWORD) has the entry "E:\LibreOffice\templates\AKIB_normal.ott" and FileName has the same entry.
Disk E is a ext4 format (using by paralel Linux installation).

I tried to change the registry entry to point to a blank template from the fresh install of (copied to mentioned location, but also tried to copy it to disk D:) and point the registry value on the new path with the same result - behaviour is present.

If I change the registry value from AKIB_normal.OTT to AKIB_normal.ODT (created and saved from the .ott file), the behaviour is NOT present. So if i set the registry to create a new document in Win Explorer from a .odt file, everything works fine. Can this be the issue? But as I can remember, the value in WIN registry should point to a template (see my bug 94857) not to a .odt file, or am I wrong?

3. IMPORTANT: The described behaviour occurs only if I create a new odt document in Win10 (Enterprise) explorer (right click), and I open it directly from Explorer (double left click) and use Save as button in LO - I get an offer by LO-dialog to save as .ott. But, if I open the new created document directly from LO (Open file), the behaviour is not present - i get a .odt offer in LO Save as Dialog. It seems, the behaviour of my LO installation is not the same if you open a file directly from Windows Explorer and from LO Open a file dialog.

But I can understand, if nobody can reproduce it, it is strange and hard to work on it :(.
Comment 6 Dieter 2020-03-09 16:13:48 UTC
I just tried to reproduce it again. But when I open a new file from desktop, the new file doesn't use a template (although a standard template is defined).
Comment 7 Orwel 2020-03-09 17:58:07 UTC
I do not understand... in which way is the file created in your environment if not from a template? What is your registry value of HKEY_CLASSES_ROOT\.odt\LibreOffice.WriterDocument.1\ShellNew? 

I know, in Win this entry is crucial, as mentioned in the other bug.

I have just read the bug 94857 one more time...And now I probably know the problem (also i still think it is a bug). LO uses as default for creating new file probably the file "C:\Program Files\LibreOffice\share\template\shellnew\soffice.odt" - odt file not OTT file. Could you check your registry value?

But I think, if you open a template in any way, the Save as dialog should offer you to save the file as .odt or am I wrong?
Comment 8 Buovjaga 2020-06-18 14:28:30 UTC
Orwel: please help me: I don't have an entry for .odt in my context menu - New. I do have the registry entry

I tried researching the topic and found some utilities, but they were of no help.
Comment 9 Martin Srdoลก 2020-12-26 19:23:13 UTC
Hello Orwel,

is this issue still actual? Could you please try to reproduce it with a master build from https://dev-builds.libreoffice.org/daily/master/ ?
You can install it alongsidethe standard version.
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' if the bug is still present in the master build
Comment 10 Orwel 2021-01-27 12:48:50 UTC
Created attachment 169183 [details]
Wrong behaviour
Comment 11 Orwel 2021-01-27 12:49:50 UTC
Created attachment 169184 [details]
PIC1 wrong behaviour
Comment 12 Orwel 2021-01-27 12:50:20 UTC
Created attachment 169185 [details]
PIC2 correct behaviour
Comment 13 Orwel 2021-01-27 12:50:51 UTC
Created attachment 169186 [details]
Comment 14 Orwel 2021-01-27 12:52:10 UTC
Hi Martin,
I did a one hour testing and i found the problem which i had:

As LO rewrites every time the changed path for creating a new document(see reported bug 94857) I have to change the WIN registry key Computer\HKEY_CLASSES_ROOT\.odt\LibreOffice.WriterDocument.1\ShellNew - FileName after every update of LO.

The key issue is: I point this Registry key every time to my own personal template which i use (this means an .ott file of mine).
I have to mention that the default registry key does not point to a template file, but to an .odt file: C:\Program Files\LibreOffice\share\template\shellnew\soffice.odt, which i notice only yet by updating to LO 7.0.4.

The problem I was confronted with is that if in this registry key is set a template (.ott file), after creating a new LO writer document through Win Explorer - mouse right click - New - Text document OpenDocument, LO opens it as new document (Untitled) correctly based on my own template, but somehow (I do not know why) it remembers, it was created from a template (in opposite creating it by double clicking on the template from Win-Explorer directly) and this information (that it is a template) is remembered somewhere. In this case, if you try to save this document (SAVE AS...), you get opened the SAVE AS window with .ott proposal (SEE attached PIC1).

Otherwise (as mentioned), if you have set your own template (the same as used for the registry key - see above) and create a new document directly from LO in any way of these 2:
1. Open LO-writer-File-New text document or
2. Double click on the template file (see above) directly in Windows Explorer 
in both cases you get in the SAVE AS window (correctly) proposed .odt file (SEE attached PIC2).

So the behavior of LO by creating a new empty document for users who want to use their own template is not the same.
My fault was I did not noticed (years ago), that the default WIN registry KEY for a new .odt file point to the file soffice.odt and not to the normal.ott template.

But I think, there should be the some way for LO to handle the changed registry key value (pointing to .ott) in the same way, as you open a new file by a double click on the template itself in Windows explorer. For me as a user there should be no difference.

STEPS to reproduce:
1. create your own template (with some Numbering etc., or use my test_template, attached)
2. put it in some folder, make it default by LO-Writer.
3. try opening a new file (in both ways as described above with correct result) and SAVE AS... it
4. Change the default win registry key (above) to this template, create a new document by WIN-explorer mouse right key - NEW and try SAVE AS...

1. Opening a new empty document by a/ double click on this template or b/ LO-Writer-File-New-Document makes LO open a new empty document created from the template. If you SAVE AS this document, you get correct proposal of saving the file as .odt.

2. Opening a new empty document by Win Explorer - mouse right click - New -OpenDocument makes LO open a new empty document which:

2.1 is not based on default own-created template (if you do not change the registry key Computer\HKEY_CLASSES_ROOT\.odt\LibreOffice.WriterDocument.1\ShellNew - FileName (and SAVE AS works correctly) OR
2.2 is based on the new own-created template (if you have changed the registry key in a/) BUT SAVE AS propose to save the new file as a template (.ott).

EXPECTED BEHAVIOR: All 3 described possibilities to open a new empty document based on your own template should bring the same result.
a/ Registry change should not be rewritten (see bug 94857) and creating a new empty document from Win explorer should make the same as double click on the template itself if you change the registry key to an .ott file or opening it directly from LO as a new document - the result should be a new document based on your own template,
b/ make the default soffice.odt point to the changed (default) template,
c/ any other solution of the problem...

THE actual possible SOLUTION IS to create an empty file from your own template and point the registry key to this file. PROBLEM is you must not forget to re-save your own template to this file every time you made some change to the default template, which is not a user friendly solution.

I do not know, if this BUG should be closed or not. I will place a copy of this comment also to bug 94857. But should I open a new Bug instead maybe? Please let me know.
Comment 15 Mike Kaganski 2021-01-27 13:54:06 UTC
Pointing ShellNew to an OTT is wrong. Windows simply copies the pointed file to the place where you use the ShellNew functionality, renaming it to "New <Something>.<ext>"; it is expected that the copy is edited and used afterwards. This conflicts with the behavior of templates, which by default are not opened, but used to create another document. Templates are not just renamed ODTs, they have some metadata inside that they are templates. When a new document is created from such a template, this metadata is removed from the new document, but when you decide to edit the template itself, the metadata (and knowledge that this is a template) is kept.

This means that pointing the registry to an OTT, and right-clicking somewhere in Explorer (desktop) to create a new OpenDocument text file, you get a 
copy of the OTT, which is renamed to ODT by Windows. So now ODT's registry actions are performed when you double-click it in Explorer - namely, "Open" (remember, that if it were correctly named OTT, the double-click would run "New"). So LibreOffice *opens* what is internally template; LibreOffice knows that; and when you Save As (or Save), it correctly uses the template filter.

This is not a bug, but a user error. Closing NOTABUG.