Bug 125986 - [FILEOPEN] After pasting Excel table as EMF into right aligned paragraph, some parts of text become invisible
Summary: [FILEOPEN] After pasting Excel table as EMF into right aligned paragraph, som...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Keywords: bibisected, bisected, regression
Depends on:
Blocks: RTL-CTL Regressions-EMFPlus-Rework
  Show dependency treegraph
Reported: 2019-06-18 12:41 UTC by Erez W
Modified: 2024-07-12 11:14 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:

A document on which this problem can be reproduced (14.32 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2019-06-18 12:44 UTC, Erez W
Screenshot of the bug - LibreOffice Writer vs generated PDF (186.10 KB, image/png)
2019-06-18 12:46 UTC, Erez W
Improved testcase screenshot (34.37 KB, image/png)
2020-04-16 08:28 UTC, Erez Wanderman
Improved testcase_l.docx (14.21 KB, application/zip)
2020-04-16 08:29 UTC, Erez Wanderman
Improved testcase_r.docx (14.21 KB, application/zip)
2020-04-16 08:29 UTC, Erez Wanderman
EMF image extracted from testcase_r.docx (2.53 KB, image/x-emf)
2022-04-27 10:12 UTC, Bartosz

Note You need to log in before you can comment on or make changes to this bug.
Description Erez W 2019-06-18 12:41:53 UTC
I use Excel 2010 and Word 2010 to create the document.
After copying from Excel and "pasting as EMF" into Word in RTL paragraph, and exporting to PDF, the PDF does not look correct.

Steps to Reproduce:
1) Fill some cells in Excel spreadsheet
2) Create a new Word document and change direction to RTL (ctrl+right shift)
3) Select the cells in Excel and copy
4) In Word, select Paste Special...
5) Choose "Picture (Enhanced Metafile)"
6) Save the file in Word
7) Open the file in LibreOffice Writer
8) Observe that it renders correctly
9) Choose File -> Export As -> Export Directly as PDF, then Export
10) Open the file in a PDF viewer

Actual Results:
The text is moved/invisible

Expected Results:
PDF should look like original document

Reproducible: Always

User Profile Reset: No

Additional Info:
Comment 1 Erez W 2019-06-18 12:44:22 UTC
Created attachment 152271 [details]
A document on which this problem can be reproduced
Comment 2 Erez W 2019-06-18 12:46:26 UTC
Created attachment 152272 [details]
Screenshot of the bug - LibreOffice Writer vs generated PDF
Comment 3 Dieter 2019-06-20 12:13:57 UTC
I confirm it with document from comment 2 and

Version: (x64)
Build ID: b170256fb6ebaf774b02b89835b19d9f3a1afb89
CPU threads: 4; OS: Windows 10.0; UI render: default; VCL: win; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2019-06-07_03:30:35
Locale: de-DE (de_DE); UI-Language: en-US
Calc: threaded
Comment 4 Xisco Faulí 2019-06-28 14:27:38 UTC
No reproduced in

Build ID: c15927f20d4727c3b8de68497b6949e72f9e6e9e
Comment 5 Xisco Faulí 2019-06-28 14:31:06 UTC
Also fine in

Build ID: 5b168b3fa568e48e795234dc5fa454bf24c9805e
CPU Threads: 4; OS Version: Linux 4.15; UI Render: default; 
Locale: ca-ES (ca_ES.UTF-8
Comment 6 Erez W 2019-06-30 07:00:01 UTC
Tested on some old versions, all on Win7 x64	no bug	no bug	no bug	no bug	broken	broken	broken	broken	broken
Comment 7 Xisco Faulí 2019-08-05 14:28:11 UTC
Regression introduced by:


author	Thorsten Behrens <Thorsten.Behrens@CIB.de>	2017-08-21 22:44:30 +0200
committer	Thorsten Behrens <Thorsten.Behrens@CIB.de>	2017-08-22 12:28:57 +0200
commit ebc11ae0b132eefd3b1b1a837a8d0ad3ba73b460 (patch)
tree 599ae51a0a42b111f245697e7ad86b7f85681798
parent a3782f1152e4cf02f30003b5f96c7ba603a87db9 (diff)
emfplus: cut over to new EMF+ renderer

Bisected with: bibisect-linux64-6.0

Adding Cc: to Thorsten Behrens
Comment 8 Erez Wanderman 2020-04-16 08:28:19 UTC
Created attachment 159614 [details]
Improved testcase screenshot
Comment 9 Erez Wanderman 2020-04-16 08:29:00 UTC
Created attachment 159615 [details]
Improved testcase_l.docx
Comment 10 Erez Wanderman 2020-04-16 08:29:29 UTC
Created attachment 159616 [details]
Improved testcase_r.docx
Comment 11 Erez Wanderman 2020-04-16 08:33:45 UTC
1. A new testcase is attached, you can see that all the letters in testcase_r.docx are rendered in the wrong direction and the wrong location.
2. This appears not only when exporting to PDF, but also in the thumbnails in the home screen (screenshot attached)
Comment 12 Erez Wanderman 2020-04-21 19:34:50 UTC
Found the following: this code is in sw\source\core\text\inftxt.cxx:
    // Set default layout mode ( LTR or RTL ).
    if ( m_pFrame->IsRightToLeft() )
        m_pOut->SetLayoutMode( ComplexTextLayoutFlags::BiDiStrong | ComplexTextLayoutFlags::BiDiRtl );
        m_pRef->SetLayoutMode( ComplexTextLayoutFlags::BiDiStrong | ComplexTextLayoutFlags::BiDiRtl );
        m_nDirection = DIR_RIGHT2LEFT;
        m_pOut->SetLayoutMode( ComplexTextLayoutFlags::BiDiStrong );
        m_pRef->SetLayoutMode( ComplexTextLayoutFlags::BiDiStrong );
        m_nDirection = DIR_LEFT2RIGHT;

If I comment the "if" part and keep only the else, then in the exported PDF, the metafile is OK. However, this breaks other scenarios in the main display and in exported PDF. (is the export to PDF using different rendering logic?)

I hope someone can find a proper fix for this.
Comment 13 QA Administrators 2022-04-22 04:01:43 UTC Comment hidden (obsolete)
Comment 14 Bartosz 2022-04-22 11:59:34 UTC Comment hidden (obsolete)
Comment 15 Dieter 2022-04-26 09:37:47 UTC
Still present in

Version: (x64) / LibreOffice Community
Build ID: 1688991ca59a3ca1c74bc2176b274fba1b034928
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL

Step: Open attachment 152271 [details] from comment 1 (or attachment 159616 [details] from comment 10) in Word an Writer and compare result.

I've changed bug summary, because PDF-Export obviously doesn't cause the problem.
Comment 16 Bartosz 2022-04-27 10:12:55 UTC
Created attachment 179805 [details]
EMF image extracted from testcase_r.docx
Comment 17 Bartosz 2022-04-27 10:22:32 UTC
The issue is only reproducible when `Anchor` is set to `As Character`.

 1. Click Right mouse button on image, 
 2. Select "Anchor" 
 3. Change "As Character" to "To Paragraoh" or "To Character"
Comment 18 Bartosz 2022-04-27 10:24:46 UTC
More information about anchoring modes are available at:
Comment 19 QA Administrators 2024-06-02 03:14:22 UTC Comment hidden (obsolete)
Comment 20 Mike Kaganski 2024-07-12 11:14:56 UTC
No repro in master (still repro in