Bug 153195

Summary: FILEOPEN RTF Table with negative indent in footer moved to the right
Product: LibreOffice Reporter: Gabor Kelemen (allotropia) <kelemeng>
Component: WriterAssignee: Czeber László Ádám (NISZ) <czeber.laszloadam>
Status: VERIFIED FIXED    
Severity: normal CC: stephane.guillou
Priority: medium    
Version: Inherited From OOo   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=148578
https://bugs.documentfoundation.org/show_bug.cgi?id=155009
Whiteboard: target:7.6.0
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 112765, 113423    
Attachments: Example document from Word 2016
Table settings in Word and Writer
composite layout of the problem

Description Gabor Kelemen (allotropia) 2023-01-25 00:21:25 UTC
Created attachment 184892 [details]
Example document from Word 2016

Attached RTF example file has two tables with negative indent, so they start in the left margin.
When opened in Writer the table in the footer has its indent set to 0, moving it to the right.

1. Open attached file

Notice the horizontal position of the table in the footer.

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

and all the way back to 4.0
Comment 1 Gabor Kelemen (allotropia) 2023-01-25 00:22:34 UTC
Created attachment 184893 [details]
Table settings in Word and Writer
Comment 2 Stéphane Guillou (stragu) 2023-01-25 21:46:40 UTC
Reproduced in:

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: e125e6623fa1c0f39d927bb37547ca6d1e299cb1
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Also in OOo 3.3:

OpenOffice.org 3.3.0
OOO330m20 (Build:9567)

Note that I could change the left spacing to a negative value in Writer, and save and reload would keep it. I assume the issue is when the document was created in MS Word.

Confirmed that tables outside and inside footers have the same alignment in the margin in MS Word:

Microsoft® Word for Microsoft 365 MSO (Version 2212 Build 16.0.15928.20196) 64-bit
Comment 3 László Németh 2023-04-14 10:38:56 UTC
Note: table indent has different meaning in MSO and Writer. In MSO, table indent means the indent of the text content of the cells, i.e. if table indent is 0, the text content of the cells is vertically adjusted to the page text content, not the table border. In Writer, if table indent is 0, the table border is vertically adjusted to the page text content.

So the import filter needs the following conversion:

Word: table_left_indent means in

Writer: table_left_indent - table_default_cell_left_margin
Comment 4 László Németh 2023-04-14 11:12:12 UTC
Created attachment 186663 [details]
composite layout of the problem

black: MSO
green: recent Writer
red: patch set 3 of https://gerrit.libreoffice.org/c/core/+/150022
Comment 5 Commit Notification 2023-04-21 07:52:51 UTC
Czeber László Ádám committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5c98966b8318d526bdfbefc77831c051e946231f

tdf#153195 sw RTF import: fix negative indent of table in footer

It will be available in 7.6.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 6 NISZ LibreOffice Team 2023-04-24 07:29:53 UTC
VERIFIED IN:
Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 006b35d50024b1932d84380b5d2fec1f7066bccd
CPU threads: 8; OS: Windows 10.0 Build 19044; UI render: Skia/Vulkan; VCL: win
Locale: hu-HU (hu_HU); UI: hu-HU
Calc: CL threaded