Bug 100391 - FILESAVE PPTX Text in shape shifted from center to upper left corner
Summary: FILESAVE PPTX Text in shape shifted from center to upper left corner
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
(earliest affected)
3.3.0 release
Hardware: All All
: medium normal
Assignee: Regina Henschel
Whiteboard: target:7.4.0
Keywords: filter:pptx
Depends on:
Blocks: Shape-ODF-OOXML-export
  Show dependency treegraph
Reported: 2016-06-15 08:10 UTC by mail
Modified: 2022-04-04 18:22 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:

Saving the presentation in pptx format shifts the text outside the shape (14.82 KB, application/vnd.oasis.opendocument.presentation)
2016-06-15 08:10 UTC, mail
Example shape copied to odt (13.94 KB, application/vnd.oasis.opendocument.text)
2020-09-01 11:31 UTC, NISZ LibreOffice Team

Note You need to log in before you can comment on or make changes to this bug.
Description mail 2016-06-15 08:10:01 UTC
Created attachment 125663 [details]
Saving the presentation in pptx format shifts the text outside the shape

When exporting the attached presentation to PPTX format and opening it with Powerpoint 2010, the text inside the puzzle shape is shifted outside the shape.

When opening the pptx-file in LO, the faulty behaviour is the same.

Exporting in ppt format works flawlessly.
Comment 1 Buovjaga 2016-06-18 19:18:20 UTC

Arch Linux 64-bit, KDE Plasma 5
Build ID: c13f60e7cd18df6b0ab70289f5b91ee01e4ae126
CPU Threads: 8; OS Version: Linux 4.6; UI Render: default; 
Locale: fi-FI (fi_FI.UTF-8)
Built on June 18th 2016
Comment 2 QA Administrators 2017-09-01 11:16:26 UTC Comment hidden (obsolete)
Comment 3 mail 2017-09-07 08:30:32 UTC
Bug is still present with same behaviour in LO 5.3.6 (only tested on Win 7 64bit).
Comment 4 QA Administrators 2018-10-22 02:50:29 UTC Comment hidden (obsolete)
Comment 5 Buovjaga 2019-09-28 19:19:39 UTC
Still confirmed. In older versions (at least 3.3.0 - 4.4.7), the shape got turned into a rectangle and the text appeared in the upper left corner (as it does now as well).

Version: (x64)
Build ID: e1b51d4588b4b39592bb94dd5bb90de5e04d061e
CPU threads: 4; OS: Windows 10.0; UI render: default; VCL: win; 
TinderBox: Win-x86_64@62-TDF, Branch:master, Time: 2019-09-23_09:16:11
Locale: fi-FI (fi_FI); UI-Language: en-US
Calc: threaded
Comment 6 Regina Henschel 2019-10-09 12:26:15 UTC
OOo has no OOXML export filter, so not "Inherited From OOo". But I do not know the first version of LO, which has this export filter. Nevertheless, the needed feature has not been implemented.

The document contains a shape "puzzle". This special shape has the problem, that it is not contained in MS binary preset shapes and not contained in OOXML preset shapes. So this shape has to be exported as 'custGeom'. But currently LibreOffice is not able to convert formulas from ODF syntax to OOXML syntax. Therefore it is only possible to write the path of the outline with numbers and does not write formulas at all.

These written numbers are relative to a rectangle given by the 'viewBox' attribute. The 'viewBox' maps the internal coordinate system to the actual width and height of the shape, so that the internal values of the shape are independent from the actual width and height.

The rectangular area, into which the text is written, is given in values, which are relative to the 'viewBox' too in ODF. But in OOXML the corresponding rectangle expects values in global units. Therefore formulas would be needed to get the global value depending on internal values, viewBox and actual width and height. Because LibreOffice does not write formulas at all in the OOXML export filter, this issue cannot be fixed now.

The default area for text is the entire rectangle of the shape (the handles, which you see, when you click on the shape). And that is, what you see, where the text is placed.
Comment 7 Buovjaga 2019-10-09 13:02:19 UTC
Fair enough. LibO 3.3.0 merged Go-oo as well, which had OOXML export.
Comment 8 NISZ LibreOffice Team 2020-09-01 11:31:37 UTC
Created attachment 164958 [details]
Example shape copied to odt

The same happens in ODT format as well, so not PPTX specific.
Comment 9 Regina Henschel 2021-08-12 23:50:54 UTC
The problem is likely in DrawingML::WritePolyPolygon() in line
mpFS->singleElementNS(XML_a, XML_rect, XML_l, "0", XML_t, "0", XML_r, "r", XML_b, "b");

Idea for custom shapes: Get the SdrObject from XShape. Create EnhancedCustomShape2d for the SdrObject. Use method EnhancedCustomShape2d::GetTextRect(). I guess, that the rectangle has the same scale as the polypolygon. It might need the same shift.

I see the same wrong position for texts in block arrows.
Comment 10 Regina Henschel 2022-04-03 00:01:36 UTC
In the meantime the export is in DrawingML::WriteCustomGeometry(). But there the problem is the same. It uses
mpFS->singleElementNS(XML_a, XML_rect, XML_l, "l", XML_t, "t", XML_r, "r", XML_b, "b");
That works for most shapes but not for "Puzzle", because the text area in shape "Puzzle" is smaller than the shape snap rectangle.
There is a // ToDO: use draw:TextAreas for <a:rect> in the code.
Comment 11 Regina Henschel 2022-04-03 23:40:24 UTC
I'm going to fix it.
Comment 12 Commit Notification 2022-04-04 18:21:46 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":


tdf#100391 calculate true textarea rect for custGeom

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

Affected users are encouraged to test the fix and report feedback.