Bug 103956 - RTF table import wrong: cellx issue (minimal testcases)
Summary: RTF table import wrong: cellx issue (minimal testcases)
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.1.6.2 release
Hardware: x86 (IA32) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.6.0 target:7.5.0.2
Keywords: filter:rtf
Depends on:
Blocks: RTF-Tables
  Show dependency treegraph
 
Reported: 2016-11-16 15:54 UTC by rupert.levene
Modified: 2023-01-11 07:58 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
First test case (136 bytes, application/rtf)
2016-11-16 15:55 UTC, rupert.levene
Details
Second test case (138 bytes, application/rtf)
2016-11-16 15:55 UTC, rupert.levene
Details
Third test case (144 bytes, application/rtf)
2016-11-16 15:55 UTC, rupert.levene
Details
Expected behaviour (Word Viewer) (32.69 KB, image/png)
2016-11-16 15:59 UTC, rupert.levene
Details
Actual behaviour (LibreOfficeDev) (87.95 KB, image/png)
2016-11-16 16:00 UTC, rupert.levene
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rupert.levene 2016-11-16 15:54:33 UTC
Compare the following three rtf documents:

{\rtf\ansi\deff0{\pard before \par\trowd\trautofit1\trgaph108 \cellx \cellx \pard \intbl 1 \cell \pard \intbl 2 \cell \row \pard after}}

{\rtf\ansi\deff0{\pard before \par\trowd\trautofit1\trgaph108 \cellx0 \cellx0 \pard \intbl 1 \cell \pard \intbl 2 \cell \row \pard after}}

{\rtf\ansi\deff0{\pard before \par\trowd\trautofit1\trgaph108 \cellx500 \cellx1000 \pard \intbl 1 \cell \pard \intbl 2 \cell \row \pard after}}

Only in the final one is the text in the table visible in Libreoffice (the dev version 5.2.4.0.0+ and also version 5.0.6.2). In Word Viewer, the text is visible in all three tables.
Comment 1 rupert.levene 2016-11-16 15:55:12 UTC
Created attachment 128788 [details]
First test case
Comment 2 rupert.levene 2016-11-16 15:55:32 UTC
Created attachment 128789 [details]
Second test case
Comment 3 rupert.levene 2016-11-16 15:55:47 UTC
Created attachment 128790 [details]
Third test case
Comment 4 rupert.levene 2016-11-16 15:59:54 UTC
Created attachment 128791 [details]
Expected behaviour (Word Viewer)
Comment 5 rupert.levene 2016-11-16 16:00:27 UTC
Created attachment 128792 [details]
Actual behaviour (LibreOfficeDev)
Comment 6 Buovjaga 2016-11-24 10:35:22 UTC
Confirmed.

3.5 froze when trying to open case1.

4.1.6.2 showed a table in case2, but it was so wide it went outside the page and only the cell with "1" was shown. Case1 was shown with "1" and "2" simply as paragraphs.

Win 7 Pro 64-bit Version: 5.3.0.0.alpha1+
Build ID: 172325bedf69bbc162f3c1948264451c90c105a3
CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; Layout Engine: new; 
TinderBox: Win-x86@39, Branch:master, Time: 2016-11-21_05:26:40
Locale: fi-FI (fi_FI); Calc: group
Comment 7 QA Administrators 2018-10-06 02:51:08 UTC Comment hidden (obsolete)
Comment 8 Roman Kuznetsov 2018-10-06 08:12:50 UTC
till repro in

Version: 6.2.0.0.alpha0+
Build ID: 1aa37aa6bee19099b57555a6d839992b054aa405
CPU threads: 4; OS: Windows 10.0; UI render: GL; 
TinderBox: Win-x86@42, Branch:master, Time: 2018-09-23_10:17:54
Locale: ru-RU (ru_RU); Calc: threaded
Comment 9 QA Administrators 2019-10-07 03:02:19 UTC Comment hidden (obsolete)
Comment 10 rupert.levene 2020-04-18 17:32:27 UTC
(In reply to QA Administrators from comment #9)

Yes, the bug is still present:

Version: 6.4.3.2
Build ID: 747b5d0ebf89f41c860ec2a39efd7cb15b54f2d8
CPU threads: 4; OS: Mac OS X 10.11.6; UI render: default; VCL: osx; 
Locale: en-IE (en.UTF-8); UI-Language: en-US
Calc: threaded
Comment 11 rupert.levene 2021-07-05 09:03:21 UTC
Still reproducible in 7.0.6.2, with slightly altered behaviour: both case1.rtf and case2.rtf appear as in the middle window in the "Actual behaviour" screenshot of the original bug report. 

That is, case1.rtf does now correctly import with a table, but as in case2.rtf, the cell widths are chosen absurdly small and their content cannot be seen.

I exported the files from Writer as odt files and unzipped them. 

content.xml is identical for case1 and case2

content.xml is different for case2 and case3. After pretty-printing and diffing, I get this:

====

$ diff -uw case{2,3}.xml
--- case2.xml	2021-07-05 09:57:31.000000000 +0100
+++ case3.xml	2021-07-05 09:57:43.000000000 +0100
@@ -11,13 +11,13 @@
   </office:font-face-decls>
   <office:automatic-styles>
     <style:style style:name="Table1" style:family="table">
-      <style:table-properties style:width="0.145cm" fo:margin-left="-0.191cm" fo:margin-top="0cm" fo:margin-bottom="0cm" table:align="left"/>
+      <style:table-properties style:width="3.528cm" fo:margin-left="-0.191cm" fo:margin-top="0cm" fo:margin-bottom="0cm" table:align="left"/>
     </style:style>
     <style:style style:name="Table1.A" style:family="table-column">
-      <style:table-column-properties style:column-width="0.072cm"/>
+      <style:table-column-properties style:column-width="1.764cm"/>
     </style:style>
     <style:style style:name="Table1.B" style:family="table-column">
-      <style:table-column-properties style:column-width="0.071cm"/>
+      <style:table-column-properties style:column-width="1.762cm"/>
     </style:style>
     <style:style style:name="Table1.1" style:family="table-row">
       <style:table-row-properties fo:keep-together="auto"/>

====

Version: 7.0.6.2
Build ID: 144abb84a525d8e30c9dbbefa69cbbf2d8d4ae3b
CPU threads: 4; OS: Mac OS X 10.13.6; UI render: default; VCL: osx
Locale: en-IE (en_IE.UTF-8); UI: en-US
Calc: threaded
Comment 12 Commit Notification 2023-01-10 08:06:16 UTC
Vasily Melenchuk committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/26d74a57d54327b9fd562065d04d867852ce8e8a

tdf#103956: RTF import: fix for \cellx0 or no params.

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 13 Vasily Melenchuk (CIB) 2023-01-10 08:08:35 UTC
Provided patch does not resolve given testcases completely: support for \trautofit1 and autofitting for RTF is still missing. However table columns with width 0 or not given width should be displayed better: not minimal width of 41, but some visible value. So tables are finally visible but too wide comparing to MS Word.
Comment 14 Commit Notification 2023-01-11 07:58:45 UTC
Vasily Melenchuk committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/84aea0a29962cf11a63bdb550f522b3d5574cf64

tdf#103956: RTF import: fix for \cellx0 or no params.

It will be available in 7.5.0.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.