Bug 102366 - FILESAVE: Saving text file with odt/docx extension wont save formatted text
Summary: FILESAVE: Saving text file with odt/docx extension wont save formatted text
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Save
  Show dependency treegraph
 
Reported: 2016-09-22 18:01 UTC by ron-granger
Modified: 2017-05-18 22:23 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
Video recording of the problem (3.87 MB, video/mp4)
2016-09-22 18:25 UTC, ron-granger
Details
This is a test file. The word in it was bold before I saved it and closed libreoffice. (8 bytes, application/vnd.oasis.opendocument.text)
2016-10-10 14:09 UTC, ron-granger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ron-granger 2016-09-22 18:01:41 UTC
User-Agent:       Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:48.0) Gecko/20100101 Firefox/48.0
Build Identifier: 1:5.0.3~rc2-0ubuntu1~trusty2

Hey, I wanted to save a document containing a table in the docx format (And don't try to tell me, that docx doesn't support tables :D).
After I quit the app, the filesize was only 1.1 kb so I reopened to check what was wrong. ALL the content has been returned to plain text, all the formatting was gone.
I tried to change the pdf I recently exported to a docx file using cloudconvert, after I tried to edit the headline of the document (tried to change font size), I had alot of problems with the application, the menu bar ([File], [Edit], [View], ...) didn't react, if I clicked the closing button the "Do you want to save file?" window appeared without any content but the cursor still reacted.

Sorry but in my trys to recover my document I lost some of the original files. (I would have attached them then)

All in all I lost my document and I were not able to recover it propably. All my trys resulted in formatting mistakes.
(I needed this list for tomorrow and I am very unhappy with libreoffice!)

Reproducible: Didn't try

Steps to Reproduce:
Please see the details. I do not have the time to reproduce it, I have to do this list again using a useful software.






Reset User Profile?No
Comment 1 ron-granger 2016-09-22 18:04:04 UTC
Ok, I can't attach the file at all because it contains private information such as private e-mail-addresses and names.
Comment 2 ron-granger 2016-09-22 18:25:13 UTC
Created attachment 127554 [details]
Video recording of the problem

Video file of the problem. 

I deleted the private information.

Most buttons don't react (you can't see my clicks but I am clicking on the navbar (on Extra) and the toggle arrow next to the font sizes to see the available ones.)

The "Save file?" dialog is empty. 
As I typed in the font size, my cursor moved but the letters didn't appear.


I am sorry for the video quality, I made a mistake in my recording shell script and I already fixed it.
Comment 3 Buovjaga 2016-10-09 14:16:07 UTC
Please attach the uncorrupted document, so we can test.

Set to NEEDINFO.
Change back to UNCONFIRMED after you have provided the document.
Comment 4 ron-granger 2016-10-09 17:14:22 UTC
I can't provide the document because it contains sensitive information.

But I was able to reproduce the problem and I can show the error:

1. Create an empty document on the filesystem, e.g. Right Click > New > Text Document / Empty document > "test.odt"
2. Open it with libreoffice, it will display an empty page
3. Work with formattings, insert tables, headlines, colourful text, ...
4. Save the document
5. Close libreoffice
6. Reopen the document > the format will be gone

So possible fixes:
On save you could check the mime type if it fits the extension (plain != .odt)
> You could change it
> You could ask the user if whether he wants to continue with this mime type or if he wants to use the default one
You could check on page loading
> Ask the user whether he wants to create a plain text file or a standard document
Comment 5 Yousuf Philips (jay) (retired) 2016-10-10 14:00:18 UTC
Hi Ron,

Unfortunately without a sample document, we cant test what the problem is, so you can remove sensitive information from the document before submitting it with these instructions - https://wiki.documentfoundation.org/QA/Bugzilla/Sanitizing_Files_Before_Submission
Comment 6 ron-granger 2016-10-10 14:05:39 UTC
I do not understand what is your problem :D

I gave instructions how to exactly reproduce the bug. I can create thousands of files with this bug.

Create an text document (empty) like "test.odt" and open it with libreoffice. Write something like "hello" and make it bold, italic, red, green, large, smaller, ...... and save the file.

close liberoffice and open the file again. It will be a plain text document :D
Comment 7 ron-granger 2016-10-10 14:09:19 UTC
Created attachment 127922 [details]
This is a test file. The word in it was bold before I saved it and closed libreoffice.

This is an example file. The word was bold before I saved the document.
Comment 8 Yousuf Philips (jay) (retired) 2016-10-10 17:56:38 UTC
(In reply to ron-granger from comment #4)
> 1. Create an empty document on the filesystem, e.g. Right Click > New > Text
> Document / Empty document > "test.odt"
> 2. Open it with libreoffice, it will display an empty page
> 3. Work with formattings, insert tables, headlines, colourful text, ...
> 4. Save the document

At this point, i get a dialog asking whether it should save as odf or text format. If you dont get this dialog then you should upgrade.

> 5. Close libreoffice
> 6. Reopen the document > the format will be gone

Version: 5.3.0.0.alpha0+
Build ID: f309531cfe1d6a1b6ea1306d45ed3e121145bc5f
CPU Threads: 2; OS Version: Linux 3.19; UI Render: default; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2016-10-04_03:52:18
Locale: en-US (en_US.UTF-8); Calc: group
Comment 9 ron-granger 2016-10-10 19:15:03 UTC
Okay, I will test this.
Comment 10 ron-granger 2016-11-04 20:38:34 UTC
I tested it with 5.2 and it does not work. Opening a plain file will not save the format.
Comment 11 ron-granger 2016-11-04 20:40:08 UTC
... and I am actually unable to find a newer precompiled release. I do not have the time to compile anything for me at the momemt.
Comment 12 Yousuf Philips (jay) (retired) 2016-11-05 12:34:14 UTC
Yes it hasnt been fixed in 5.2, so let see if we can identify where this fix happened and whether it can be backported.
Comment 13 Buovjaga 2016-11-05 14:26:25 UTC
Correcting status to WFM.
Comment 14 Aron Budea 2017-02-13 01:11:35 UTC
I suspect this is not a LibreOffice bug, and nothing got fixed. Judging from attachment 127922 [details], which is a raw text file with ODT extension, probably the file was initially created as a raw text file.

Then I assume the setting to warn if the user is saving in a different file format other than ODF was disabled, and thus the save also happened in text format, because the original format was kept.