Bug 149538 - OOXML DOCX bad import, export and rendering for property "upright"
Summary: OOXML DOCX bad import, export and rendering for property "upright"
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.5.0
Keywords: filter:docx
Depends on:
Blocks: DOCX
  Show dependency treegraph
 
Reported: 2022-06-12 20:41 UTC by Regina Henschel
Modified: 2023-06-08 00:17 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
shape with property "upright" set (25.20 KB, application/zip)
2022-06-12 20:41 UTC, Regina Henschel
Details
Source file for shape with upright text (18.68 KB, application/zip)
2022-06-12 21:01 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2022-06-12 20:41:40 UTC
Created attachment 180698 [details]
shape with property "upright" set

Open attached file in PowerPoint. Rotate the shape and make sure, that the text remains upright. The OOXML property "upright" works in PowerPoint too, but PowerPoint has no UI for it (at least I found none). I have got the shape with copy&paste from a text document to the presentation.

Open the attached file in LibreOffice. Notice, that the text in sheared. This shearing happens, because the shape rotation is stored to property "TextPreRotateAngle". But that property is designed for the writing directions "vert" and "vert270" and because in rendering it is applied before scaling, it may only be used with 90deg and 270deg (and 0deg and 180deg). Any other angle produces shearing. And because "TextPreRotateAngle" is for writing direction, it is the wrong property anyway. The property for text area rotation is "TextRotateAngle".

Resave the file without any changes with file format pptx. Open the resaved file in PowerPoint. At a first glance it looks correct. But rotate the shape. The text will rotate together with the shape. The property "upright" is lost. That is an export error. If you look into the InteroperGrabBag you see that "upright" has been read on import.
Comment 1 Regina Henschel 2022-06-12 21:01:04 UTC
Created attachment 180699 [details]
Source file for shape with upright text

This is the source file for the shape.

Open the file in Word and rotate the shape. Notice that the text is always upright.

When opening the file in Writer you cannot see any text area rotation, because unconditionally all shapes are imported with text box and a text box cannot rotate. The wrong position of the text box is a different error and not related to "upright". In the InteropGrabBag you will find that "upright" is here read too.

If you disable creating a textbox (WpsContext.cxx#296), you will see that Writer does not render it as "upright".

Save the unchanged file in format docx. Open the saved file in Word. Rotate the shape. Notice that the text rotates with the file. So here too the property "upright" is lost.
Comment 2 Timur 2022-06-13 14:26:37 UTC
(In reply to Regina Henschel from comment #0)
> Open attached file in PowerPoint. Rotate the shape and make sure, that the
> text remains upright. 

DOCX, open in Word, "do not rotate text" in GUI shape options. 
Text also changes position, adapting to shape changes. 

> The OOXML property "upright" works in PowerPoint too,
> but PowerPoint has no UI for it (at least I found none). I have got the
> shape with copy&paste from a text document to the presentation.

In PP, text direction is Horizontal, as in Word. 

> Open the attached file in LibreOffice. Notice, that the text in sheared.

I don't see rotation in LO.

> Resave the file without any changes with file format pptx. Open the resaved
> file in PowerPoint. At a first glance it looks correct. But rotate the
> shape. The text will rotate together with the shape. 

It doesn't look correct to me. 

> The property "upright"
> is lost. That is an export error. If you look into the InteroperGrabBag you
> see that "upright" has been read on import.

I set New.
Comment 3 Regina Henschel 2022-06-26 20:37:04 UTC
There was a try to fix "upright" in bug 137000, but it only produces that text area rotation is the opposite of shape rotation. Because the condition in
https://opengrok.libreoffice.org/xref/core/oox/source/export/drawingml.cxx?r=a761a51d#3524
does not work, always 'isUpright.reset();' is done, which means, that not the attribute 'upright' is written to file, but the attribute 'rot'.

I'll fix this together with bug 149551.
Comment 4 Regina Henschel 2022-07-21 21:02:46 UTC
Sorry, not fixed together with bug 149551.
Comment 5 Commit Notification 2022-07-23 12:34:06 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3ade0a5fb1d39360b76c7d62eebee5a18d3f4196

tdf#149538 no text area rotation if upright exported

It will be available in 7.5.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 Regina Henschel 2022-07-23 12:40:06 UTC
Load and save keeps the 'upright' property for pptx and xlsx now.

But docx is a bigger problem. I unassign myself, because I have currently not enough time to work on it.