Bug 152839 - FILEOPEN RTF Border lines appear incorrectly in table
Summary: FILEOPEN RTF Border lines appear incorrectly in table
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Oliver Specht (CIB)
URL:
Whiteboard: target:25.2.0
Keywords:
Depends on:
Blocks: RTF-Tables
  Show dependency treegraph
 
Reported: 2023-01-02 14:11 UTC by Gabor Kelemen (allotropia)
Modified: 2024-10-14 14:37 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file from Word 2016 (deleted)
2023-01-02 14:11 UTC, Gabor Kelemen (allotropia)
Details
The example file in Word 2016 and Writer (99.72 KB, image/png)
2023-01-02 14:12 UTC, Gabor Kelemen (allotropia)
Details
Same file as docx, for reference (18.24 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2023-01-02 14:22 UTC, Gabor Kelemen (allotropia)
Details
Minimized RTF sample (165 bytes, application/msword)
2023-01-13 08:43 UTC, Vasily Melenchuk (CIB)
Details
Updated example file (50.23 KB, application/rtf)
2023-11-28 13:47 UTC, Gabor Kelemen (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2023-01-02 14:11:50 UTC
Created attachment 184443 [details]
Example file from Word 2016

Attached example file contains a table with different number of columns in rows.
In Word the second rows second and third cells have their top border turned off, but in Writer this is visible.

1. Open attached file
2. Notice the cell starting with 2 and the empty one right of it has top border, unlike in Word.

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 44355a90b3450111ad87ad4b6607a564e41d7b54
CPU threads: 14; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: de-DE (hu_HU); UI: en-US
Calc: threaded

and all the way back to 3.6. In 3.5 there was no border imported at all.

If the same example is saved to docx, it had the same import issue fixed in 5.3 times with:

https://git.libreoffice.org/core/+/1d1748d143ab4270a2ca1b5117852b1b1bb4c

author	Miklos Vajna <vmiklos@collabora.co.uk>	Tue Aug 30 09:14:47 2016 +0200
committer	Miklos Vajna <vmiklos@collabora.co.uk>	Tue Aug 30 08:40:30 2016 +0000

Related: tdf#44986 DOCX import: handle w:gridAfter by faking cells
Comment 1 Gabor Kelemen (allotropia) 2023-01-02 14:12:22 UTC
Created attachment 184444 [details]
The example file in Word 2016 and Writer
Comment 2 Gabor Kelemen (allotropia) 2023-01-02 14:22:33 UTC
Created attachment 184449 [details]
Same file as docx, for reference
Comment 3 raal 2023-01-03 16:43:29 UTC
Confirm with Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: d993327eab0a2c9c8820c6528075b01de68b0ec6
CPU threads: 4; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded
Comment 4 Vasily Melenchuk (CIB) 2023-01-13 08:43:26 UTC
Created attachment 184627 [details]
Minimized RTF sample

I've stripped down testcase to minimal for problem to became clear.

As far I see, there is problem with non-rectangular tables:
* first row contains only one cell and border below
* second row contains 2 cells
* in Writer first row is extended to fit entire table width unlike in Word.

I see that for DOCX Writer does creates extra cells in first row to make rectangular table. But it is not done for RTF.
Comment 5 Gabor Kelemen (allotropia) 2023-11-28 13:47:29 UTC
Created attachment 191084 [details]
Updated example file
Comment 6 Xisco Faulí 2023-11-29 13:19:55 UTC
The content of attachment 184443 [details] has been deleted for the following reason:

User's request
Comment 7 Gabor Kelemen (allotropia) 2024-07-29 18:54:15 UTC
This got better with 

https://git.libreoffice.org/core/commit/13cd36248069d32688cfb8adfe0955ca5229e075

tdf#148554 RTF import - reset borders on fill cells

It will be available in 25.2.0.

My attachment 191084 [details] from comment #4 now looks like in Word, but Vasily's attachment 184627 [details] from comment #3 is still bad, the border is above the B2 cell with "C", unlike in Word.

Keeping it open for the latter case.
Comment 8 Commit Notification 2024-10-11 17:08:43 UTC
Oliver Specht committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/038473595ed266d15a788d8f97781cbaf066cfe7

tdf#152839 add fill cells to tables imported wrongly from RTF

It will be available in 25.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Gabor Kelemen (allotropia) 2024-10-14 14:37:01 UTC
Should be fine with the latter patch fixing Vasily's minimal example from comment #4