Bug 153681 - Conversion from docx and odt format to rtf produces incorrect document
Summary: Conversion from docx and odt format to rtf produces incorrect document
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.3 all versions
Hardware: All All
: medium normal
Assignee: Czeber László Ádám (NISZ)
URL:
Whiteboard: target:7.6.0 target:7.5.2
Keywords: bibisectRequest, filter:rtf, regression
: 148937 (view as bug list)
Depends on:
Blocks: RTF-Tables
  Show dependency treegraph
 
Reported: 2023-02-17 05:33 UTC by Sunil
Modified: 2023-04-25 11:53 UTC (History)
9 users (show)

See Also:
Crash report or crash signature:


Attachments
ODT example file where the issue is present (10.04 KB, application/vnd.oasis.opendocument.text)
2023-02-17 05:36 UTC, Sunil
Details
ODT vs RTF (13.28 KB, image/png)
2023-02-17 11:19 UTC, Xisco Faulí
Details
change of bug in the 4.3 (21.21 KB, application/vnd.oasis.opendocument.text)
2023-02-18 10:10 UTC, raal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sunil 2023-02-17 05:33:27 UTC
Description:
When a docx document or odt document with table inside table is saved as rtf, the resulting file is incorrect and the layout is messed up.

When the same document is converted to PDF, the resulting document is as expected.

Steps to Reproduce:
1. Create a new document using Writer
2. Insert a 3x3 table 
3. Insert 2x2 table in the middle column of the original table
4. Save it as rtf file
5. Close the document and reopen the rtf file

Actual Results:
The whole table layout is messed up. 
If the content is inside the table, the content is also missing. 

Expected Results:
The table layout should be the same as on the original document. 


Reproducible: Always


User Profile Reset: Yes

Additional Info:
If exported as PDF, the layout is correct. Saving as docx file also results in correct docx file.
Comment 1 Sunil 2023-02-17 05:36:36 UTC
Created attachment 185421 [details]
ODT example file where the issue is present
Comment 2 Sunil 2023-02-17 11:17:35 UTC
Bug is still present on 7.5.0.3

Tested with 3.3 and although the table has width issues, the table is columns are correct.
Comment 3 Xisco Faulí 2023-02-17 11:19:51 UTC
Created attachment 185433 [details]
ODT vs RTF
Comment 4 Xisco Faulí 2023-02-17 11:20:07 UTC
Reproduced in

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 75a863ee7fea133ae6bcd010d1aac46815fa49e2
CPU threads: 8; OS: Linux 5.10; UI render: default; VCL: gtk3
Locale: en-US (es_ES.UTF-8); UI: en-US
Calc: threaded
Comment 5 Xisco Faulí 2023-02-17 11:21:38 UTC
Also reproduced in

Version: 6.0.0.0.alpha1+
Build ID: 6eeac3539ea4cac32d126c5e24141f262eb5a4d9
CPU threads: 8; OS: Linux 5.10; UI render: default; VCL: gtk3; 
Locale: es-ES (es_ES.UTF-8); Calc: group threaded
Comment 6 zcrhonek 2023-02-17 17:21:50 UTC
repro /bibisect-win32-4.3
Comment 7 raal 2023-02-18 10:10:54 UTC
Created attachment 185459 [details]
change of bug in the 4.3

bug reproducible in 4.1, but not exactly. See printscreen from 4.1 and 7.6
Comment 8 raal 2023-02-18 10:13:00 UTC
(In reply to raal from comment #7)
> Created attachment 185459 [details]
> change of bug in the 4.3
> 
> bug reproducible in 4.1, but not exactly. See printscreen from 4.1 and 7.6

this changed in commit
    commit 07ef4cf096015f0e427ffd17cd26bb6837e75481
    Author:     Michael Stahl <mstahl@redhat.com>
    AuthorDate: Tue Feb 18 11:22:52 2014 +0100
    Commit:     Michael Stahl <mstahl@redhat.com>
    CommitDate: Tue Feb 18 11:35:51 2014 +0100
    
        rhbz#1065629: RTF import: don't drop nested cells if not enough \cellx
    
        In this document written by "XMLmind XSL-FO Converter" there are less
        \cellx than \cell and thus when reading \nestrow/\row a whole buffered
        nested table \cell is lost and then subsequently the rest of the nested
        table too.  Try to fix that by counting both \cell and \cellx and
        replaying until the maximum of those.
    
        Cannot count \intbl since we synthesize that in various places.
    
        (regression in LO 3.5)
Comment 9 Commit Notification 2023-02-28 17:44:35 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/6ddffa9841a20b7fddd3f742c88dba7d51cf9114

tdf#153681 RTF export: fix extra cell regression at nested tables

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 10 László Németh 2023-02-28 17:48:18 UTC
@Sunil et al.: many thanks for the report and feedback!

@László: many thanks for the quick fix!

Commit description:

df#153681 RTF export: fix extra cell regression at nested tables

Table rows exported with an extra empty cell, if there was a
nested table in them (and not in the last cell).

Partial revert of commit 1f77a5e8d5bf8a7f1b7bd7206996d2b2efc59462
"n#203704 fix RTF export table output for subtables".

Note: the partially reverted code was for the old table format
(used before OOo 2.3). This old format is partially converted to the
new table format since commit e366c928819c44b5c253c45dca6dae40b71c9808
"sw: ODF import: convert the simplest sub-tables to rowspan tables".
Comment 11 Commit Notification 2023-03-08 19:17:35 UTC
Czeber László Ádám committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/2860a771f93e43b95250beee78351a58bffba1ff

tdf#153681 RTF export: fix extra cell regression at nested tables

It will be available in 7.5.2.

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 12 NISZ LibreOffice Team 2023-03-17 09:58:59 UTC
Verified in:
Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 668c44e841a10cec8932a446a941e6d7c386bf3b
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Vulkan; VCL: win
Locale: hu-HU (hu_HU); UI: en-US
Calc: CL threaded
Comment 13 Gabor Kelemen (allotropia) 2023-04-25 11:53:32 UTC
*** Bug 148937 has been marked as a duplicate of this bug. ***