Bug 78989 - LO in --headless mode cannot create odt documents from template
Summary: LO in --headless mode cannot create odt documents from template
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
4.0.4.2 release
Hardware: All Linux (All)
: medium normal
Assignee: David Tardon
URL:
Whiteboard: target:4.4.0
Keywords:
: 89952 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-05-20 22:03 UTC by Rai
Modified: 2015-06-10 20:58 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
The simplest template (8.09 KB, application/vnd.oasis.opendocument.text-template)
2014-07-01 18:53 UTC, Rai
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rai 2014-05-20 22:03:42 UTC
Impossible to create a document.odt starting from a given template.ott using the shell script libreoffice with the --headless option 
Steps to reproduce:
1.   With LO, make a simple template.ott, even a blank one
2.   Open a terminal and execute one of the following three commands
2.1.     $ libreoffice --headless /path/to/template.ott
2.2.     $ libreoffice --headless -n /path/to/template.ott
2.3.     $ libreoffice --headless --convert-to odt /path/to/template.ott

3.    Execute
         $ file ~/template.odt

Current behavior:
2.1.  the command hangs
2.2.  the command hangs

2.3.  you get the message
convert /home/user/template.ott -> /home/user/template.odt using OpenDocument Text Flat XML

3.   you get
template.odt: XML document text
that is, you have got a .fodt document (a plain xml) despite the .odt suffix

Expected behavior:
one would get an OpenDocument Text, that is a zipped archive

This expected behaviour would conform to the LO headless conversion to ods from a template.ots: it creates an OpenDocument Spreadsheet, not an XML document text

Regards
Raimondo Giammanco
Comment 1 Maxim Monastirsky 2014-06-25 06:31:27 UTC
Hi,

It works for me with 4.2.5.2/4.3.0.1 under Fedora 20:

$ libreoffice --headless --convert-to odt temtest.ott
convert /home/maxim/Downloads/temtest.ott -> /home/maxim/Downloads/temtest.odt using writer8
$ file temtest.odt
temtest.odt: OpenDocument Text

Could you please try again with one of the latest versions?
Comment 2 Rai 2014-06-28 06:48:13 UTC
Maxim, thank you fo the reply
my first post came after tests on version 4.0  under Ubuntu and openSuse
Now, under Ubuntu 12.04, this is the output with LO Stable and LO Fresh, taken from ppa 

$ libreoffice --version
LibreOffice 4.1.6.2 410m0(Build:2)
$ libreoffice --headless --convert-to odt /home/raimondo/TEMPLATE.ott 
convert /home/raimondo/TEMPLATE.ott -> /home/raimondo/TEMPLATE.odt using OpenDocument Text Flat XML
$ file TEMPLATE.odt
TEMPLATE.odt: XML document text

$ libreoffice --version
LibreOffice 4.2.4.2 420m0(Build:2)
$ libreoffice --headless --convert-to odt /home/raimondo/TEMPLATE.ott 
convert /home/raimondo/TEMPLATE.ott -> /home/raimondo/TEMPLATE.odt using OpenDocument Text Flat XML
Overwriting: /home/raimondo/TEMPLATE.odt
$ file TEMPLATE.odt 
TEMPLATE.odt: XML document text

Same output with LO from deb ( http://www.libreoffice.org/download/libreoffice-fresh/ )
$ libreoffice4.2 --version
LibreOffice 4.2.5.2 61cb170a04bb1f12e77c884eab9192be736ec5f5
$ libreoffice4.2 --headless --convert-to odt /home/raimondo/TEMPLATE.ott 
convert /home/raimondo/TEMPLATE.ott -> /home/raimondo/TEMPLATE.odt using OpenDocument Text Flat XML
Overwriting: /home/raimondo/TEMPLATE.odt
$ file TEMPLATE.odt 
TEMPLATE.odt: XML document text

Is there something else I'm missing?
Comment 3 Maxim Monastirsky 2014-06-30 12:24:18 UTC
Can't reproduce also with 4.2.5.2 under Ubuntu 14.04. I set this back to UNCONFIRMED, so others could try to reproduce.

As a workaround, you could explicitly set the filter name, like '--convert-to odt:writer8'.
Comment 4 ign_christian 2014-07-01 04:23:45 UTC
Hi Raimondo.. I think it's better you attach your "template.ott" here, if possible, so everyone can test using same source.
Comment 5 Rai 2014-07-01 18:53:00 UTC
Created attachment 102094 [details]
The simplest template
Comment 6 Rai 2014-07-01 18:58:35 UTC
BTW, with the attached template the workaround of explicitly set the filter to use works for me (even with version 4.0 )
Comment 7 ign_christian 2014-07-02 06:30:35 UTC
Looks like I got same result with you Rai (tested with your file):

$ libreoffice --version
LibreOffice 4.2.5.2 420m0(Build:2)

$ libreoffice --headless --convert-to odt BlankTemplate.ott 
convert /home/christian/Downloads/BlankTemplate.ott -> /home/christian/Downloads/BlankTemplate.odt using OpenDocument Text Flat XML

$ file BlankTemplate.odt
BlankTemplate.odt: XML document text

Tested on Ubuntu 12.04 x86

Same result with my own created file using 4.2.5.2.

Perhaps related to "Default file format and ODF settings" in profile settings ?
Comment 8 Commit Notification 2014-07-07 15:05:32 UTC
David Tardon committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=a3338f8969053f67a9034cb95b24aa228c2baee1

fdo#78989 set preferred filters for ODF types



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 9 Maxim Monastirsky 2015-06-10 20:58:54 UTC
*** Bug 89952 has been marked as a duplicate of this bug. ***