Bug 92026 - FILESAVE: Borders not proper in table from DOCX
Summary: FILESAVE: Borders not proper in table from DOCX
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:6.2.0
Keywords: filter:docx
Depends on:
Blocks: DOCX-Tables 93234
  Show dependency treegraph
 
Reported: 2015-06-12 08:49 UTC by Timur
Modified: 2018-10-03 06:47 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Test case (odt file) of tables with borders (23.00 KB, application/vnd.oasis.opendocument.text)
2018-06-01 07:51 UTC, Lars Jødal
Details
onlyInsideVH.docx: exaggerated example, seen when round-tripping since this is an export bug. (11.04 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2018-09-08 15:39 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Timur 2015-06-12 08:49:51 UTC
Borders are not properly shown in table from attachment 104554 [details] from Bug 82553. Table looked differently in all LO versions, but it was fixed from 5.0 beta 3.

What's left is that table borders are not applied correctly on Fileopen and some are missing. 
They were never fully OK, even in OO, 3.3.4/3.4.4/3.5.7 had borders but also a problem with merged cells, and then some were missing in 3.6 which is (after table itself was wrong) similar to current 5.0. So, 3.5.7 is closest but still not quite fine, because first 3 rows are always wrong.
Table preview with MSO 2010 in attachment 112351 [details] shows how it should look like.
Comment 1 Buovjaga 2015-06-13 14:19:06 UTC
Confirmed.

Win 7 Pro 64-bit Version: 5.1.0.0.alpha1+
Build ID: d56b125f6c6c18ac40712cefc3cec06530750e15
TinderBox: Win-x86@39, Branch:master, Time: 2015-06-13_07:08:43
Locale: fi-FI (fi_FI)
Comment 2 Xisco Faulí 2017-03-10 19:54:17 UTC
Still reproducible in

Version: 5.4.0.0.alpha0+
Build ID: d3b5bd4a07a619db6bee1c39c32280ac3c620532
CPU threads: 4; OS: Linux 4.8; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group
Comment 3 Eyal Rozenberg 2017-12-28 17:20:50 UTC Comment hidden (obsolete)
Comment 4 Buovjaga 2017-12-28 18:58:20 UTC
(In reply to Eyal Rozenberg from comment #3)
> A screenshot of Expected vs Actual wouldn't hurt.

There's a pdf of Expected in attachment 112351 [details] :)
Comment 5 Lars Jødal 2018-01-08 07:46:48 UTC
A more simple case of border problems, which is likely to be part of this bug:

If top and bottom borders are added to the first row of a table, then a DOCX version of the table will have borders for all rows.

To reproduce:
1. Create a new table in Writer.
2. Select whole table -> Table properties -> Borders, and remove all borders.
3. Select first row of table -> Table properties -> Borders, and add top and bottom border.
4. Table now (correctly) has lines above and below first row, while the other rows are without border.
5. Save as DOCX.

Found behaviour: When DOCX file is opened (in LO Writer or in MSO Word), all rows of the table have border, not just the first row.

Expected behaviour: As 4. in list to reproduce: Only border for the first row.

This only applies to DOCX format. If DOC format is used, the bug does not appear.
A similar bug can be produced by selecting the first column and adding left and right border.

This has been tested with LO 5.4.3 and the upcoming LO 6.0.0.1 with identical results. (Operating system was Windows 10, but the bug is not suspected to be related to operating system.)
Comment 6 Lars Jødal 2018-06-01 07:51:42 UTC
Created attachment 142467 [details]
Test case (odt file) of tables with borders

Attachment contains Writer file (odt) with three standard tables, two of which have borders defined on the first cell in the table. By LO version 6.0.4.2, the table borders are still not correct when saved as DOCX: The borders of the first cell are copied to all cells of the table.
Comment 7 Lars Jødal 2018-06-01 08:14:52 UTC
Additional information to comment 6:

The problem of table borders sometimes becoming wrong when saved from LO Writer as DOCX is still present by version 6.0.4.2. 

But unlike my earlier comment 5, the problem does not seem to relate to the first ROW of the table, but instead specifically the first CELL of the table.

My new finding (see attachment 142467 [details]) is that the borders of the first cell are copied to the rest of the table when saved as DOCX (but not as DOC). This goes for both horizonatal and vertical borders. The behaviour has been tested with DOCX as "Microsoft Word 2007-2013 XML (docx)" and as "Office Open XML text document (docx)" with identical results. Loading is identical in MS Word and LO Writer.
Comment 8 Eyal Rozenberg 2018-06-01 10:17:03 UTC
(In reply to Lars Jødal from comment #7)
Also seeing the same thing (with 6.0.4.2): If I set a first cell's borders and save to DOCX, I get them all over the table. 

Way to go Lars! You narrowed down the location of the bug without having to look at the code - that's great! I wonder if it's going to end up being some real easy one-liner fix...
Comment 9 Eyal Rozenberg 2018-06-01 10:24:42 UTC
I'm increasing the importance to at least medium. And I suggest it be raised to Major. Why? Because of users who:

1. Use tables with non-uniform borders
2. Interact with people who need DOCX files rather that ODT - so they open DOCX'es and save DOCX'es to send back

Because those people send files to their collaborators with messed-up tables - which means that the final version has to be produced in MS-Word and have its borders fixed.

The intersection of these two groups is quite large; but what's more, it severely hampers advocacy efforts for LO writer in MS-Office environments, since the person who starts using it either needs to do twice the work (fix things him/herself in MS-Office), or they start sending out messed-up documents. It should be the case that you can tell your colleagues: "Hey, just try LO for a while, you can still send DOCX'es like before, it's easy" - and this is a glaring part of the reason it's not.

So this should be more important and get developer attention sooner IMHO.


On an unrelated note: The possibly-dupe bug 93234 has 5.0.0.5 as its first manifestation version. Is this the case here as well?
Comment 10 Buovjaga 2018-06-01 10:41:08 UTC
(In reply to Eyal Rozenberg from comment #9)
> I'm increasing the importance to at least medium. And I suggest it be raised
> to Major. Why? Because of users who:

Eyal: you raised the severity, which means the relative badness of the effect on working. The priority was already medium. Priority is a clue for devs regarding how pressing something is. The reporter himself set severity to minor. Please see https://wiki.documentfoundation.org/images/0/06/Prioritizing_Bugs_Flowchart.jpg
Comment 11 Lars Jødal 2018-06-01 11:39:50 UTC
(In reply to Buovjaga from comment #10)
> (In reply to Eyal Rozenberg from comment #9)
> > I'm increasing the importance to at least medium. And I suggest it be raised
> > to Major. Why? Because of users who:
> 
> Eyal: you raised the severity, which means the relative badness of the
> effect on working. The priority was already medium. Priority is a clue for
> devs regarding how pressing something is. The reporter himself set severity
> to minor. Please see
> https://wiki.documentfoundation.org/images/0/06/Prioritizing_Bugs_Flowchart.
> jpg

From the flowchart, the bug fits this description:

"Does the bug prevents user from making professional quality work, including exchanging files with other office suites?"

This gives it a setting "MEDIUM -> NORMAL". If I understand correctly, this means medium priority and a normal severity? In any case, higher than "minor".


A typical example from my own use of LO:

Among other things, I use LO for writing scientific papers. The papers very often contain tables with data, and a common convention is to format tables with borders at top and bottom of the first row (headline), and the bottom of the last row (end of table). I.e., not borders in the interior of the table. 

However, most of my co-authors use MS Word, so I share in docx format (or both docx and odt). But before sending the docx file I have to open it in MS Word and go through all tables to correct the borders, as the docx file from LO Writer has horizontal borders (copied from the first cell) all over all tables. Very annoying, and definitely making a switch entirely to LO very difficult.
Comment 12 Justin L 2018-09-08 15:39:02 UTC
Created attachment 144753 [details]
onlyInsideVH.docx: exaggerated example, seen when round-tripping since this is an export bug.
Comment 13 Justin L 2018-09-08 17:02:33 UTC
There is only one way to fix this that I can see, and that is to get rid of the table properties (when it isn't grab-bag copied from a style). Doing that depends on bug 119760.
Comment 14 Justin L 2018-09-26 11:52:17 UTC
proposed fix at https://gerrit.libreoffice.org/60989
Comment 15 Commit Notification 2018-09-29 05:16:59 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#92026 docxexport: eliminate fake tblBorders

It will be available in 6.2.0.

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 16 Justin L 2018-09-29 15:35:32 UTC
I can't even see what the problem is from comment 0, but I confirmed fix when documents in comment 6 and comment 12 are round-tripped.
Comment 17 Lars Jødal 2018-10-01 07:56:52 UTC
Using LibreOfficeDev 6.2.0.0.alpha0+ master from 2018-10-01, I can confirm that the problem is fixed. Tested with the examples from this thread, as well as one of my own real-life examples.
Well done!
Comment 18 Lars Jødal 2018-10-01 15:32:27 UTC
Just a thought: Is there any reason not to push this fix to the 6.1.x line, rather than wait for 6.2.0? It is a bug fix, not a new feature, and the 6.1.x line is still in the "fresh" phase.
Comment 19 Justin L 2018-10-01 17:28:33 UTC
At least in my workflow, there were about 4 or 5 patches that led up to this fix, and at least one of them is essential, with all of them contributing in some way to various fake table border info. I'm not at all interesting in causing regressions, so I'm very happy to *not* backport this batch of fixes, but to give them the full time for QA testing in case some other magical properties were assigned to the table-level borders.
Comment 20 Zineta 2018-10-03 06:47:58 UTC
Attached odt file Test case saved as docx works good in:

Version: 6.2.0.0.alpha0+ (x64)
Build ID: 89a60912bba7ffd6f65ea99f4664f343c5025c95
CPU threads: 2; OS: Windows 6.1; UI render: default; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2018-10-01_03:18:33
Locale: bs-BA (bs_BA); Calc: threaded
OS:Win 7

unlike  docx file saved in LO 6.1.0.3 where has all borders instead just one cell