Writer drops table formatting

I create a document in Writer, create a table and populate it with text, then save the document. When I reopen the document, the table formatting is gone and the contents of the document is the text that was in the table. Also, sometimes the document will have strikethrough starting about half way through the text and continuing on to the end of the document. I’ve tried saving as odt, doc, and docx with the same results.

As a side note, it appears I can open documents that contain tables that were created on other non-LibreOffice computers and the table formatting is fine.

Win 10 home, HP laptop, LibreOffice 6.1.5.2

=========================================
Edit on Mar 21, 2019

When I say the table formatting is gone, I am referring to the table itself (not the table contents). It’s as if I converted the table to text. I have attached (2) files, saved in different formats that display the same effect. The table should have (4) columns and (5) rows.Test table.odt(/upfiles/15531743087121561.odt)

Can you attach a sample file exhibiting this behaviour? Edit your question, don’t answer.

I can only download the first file (the other one is not a link but simple text). The name displays as Test table.odt but it is a 197-bytes .docx file. Very short for a docx!.

When it opens, there is only some text in *Preformatted Text" style, which is queer. I reformatted it as a table and tried to save it. I got a warning about foreign format and asking if I wanted to convert to ODF. I agreed and when reopened, the table was still there.

I then had a “technical” look at your file. A right-click offered me the choice of opening it in Okteta (binary editor on Linux) or in KWrite but not in LO. I used Okteta to discover your file is plain ASCII. This explains the warning about foreign format.

Although your original files bear a .odt or .docx extension, they are in fact plain ASCII without formatting information.

Remember that extensions and contents are independent from each other. You can play with extensions any way you fancy. This will sometimes disturb the launching capabilities of your OS but it is a rather inocuous game (or annoyance?).

In your case, format your data, style the paragraphs, etc. Then File>Save as and take care of choosing a document-friendly format such as .odt. Things should be clear afterwards.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

Thank you for the research and input. I have looked at my laptop and tried a number of tests, attempting to recreate the issue. Here are a few observations: 1) I use file manager to view the files in a folder, then right click and select “new” to add a file. I see an option to add a “Microsoft Word Document” but not a “Writer” document. I do not have Microsoft Word installed on the computer in question. 2) Once I open the new .docx file, I insert the table and populate it, then save the file, retaining the .docx extension 3) When I reopen the file, the table formatting is gone and all text is “Preformatted Text”. HOWEVER, If I go directly to Writer via the start button and open a blank file with an .odt file type, populate and save as, then when I reopen the file, the table has been retained. – I am considering this question closed – Thanks again – Ben Price

The right-click-then create-a-file is a known bug on Windows. The file manager creates an empty file without delegating the task to an application. When you double-click afterwards on the file icon, LO (or other app) is launched according to an OS-DB associating extension with app.

When Writer gets the file, the extension is ignored (it is a design feature in LO) and LO scans the file to determine which component to launch (Writer, Calc, Impress or Draw) regardless of the one active. On an empty file, a default component receives the file (Writer in your case). Since the file has no “service data” (it is empty), Writer considers it is plain ASCII and considers it is the format of choice. If you File>Save, plain ASCII is retained (because it thinks you did it on purpose), wiping all format information.

The lesson is: never trust the OS to create an empty file. It is much better to File>New>… .

See also tdf#123476 which is the suggestion to add special treatment to 0-length files.