Bug 129430 - FILESAVE: Saving Impress file to PPTX changes line spacing
Summary: FILESAVE: Saving Impress file to PPTX changes line spacing
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
6.3.4.2 release
Hardware: All All
: medium normal
Assignee: Tibor Nagy
URL:
Whiteboard: target:7.4.0 target:7.3.0.0.beta2
Keywords: bibisected, bisected, regression
Depends on:
Blocks: PPTX-Paragraph
  Show dependency treegraph
 
Reported: 2019-12-16 15:49 UTC by Pieter van Oostrum
Modified: 2021-12-09 16:14 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Test file in ODP format (15.81 KB, application/vnd.oasis.opendocument.presentation)
2019-12-16 15:52 UTC, Pieter van Oostrum
Details
PPTX file (20.78 KB, application/vnd.openxmlformats-officedocument.presentationml.presentation)
2019-12-16 15:53 UTC, Pieter van Oostrum
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pieter van Oostrum 2019-12-16 15:49:02 UTC
Description:
Saving a created Impress file to PPTX format changes the line spacing.
In the original (ODP) file the line spacing was set to 'At Least 1.00 cm'. In the saved PPTX file the line spacing has changed to 'Fixed 1.00 cm'.
The lines are squeezed both when opened in Powerpoint on Windows, and in LibreOffice, so the error is on saving the file.
The slightly unusual line spacing is because the text was copied from a Microsoft Word document, but that shouldn't matter, as it happens also when manually setting the line spacing to that value.

Steps to Reproduce:
1. Create a new Impress document
2. Add some text in a text box
3. Set the line spacing of the text to 'At Least' '1 cm /0.2 inch or similar value
4. Save to PPTX format
5. Close the file
6. reopen the PPTX file and see the lines squeezed (inspect the line spacing)

Actual Results:
Lines are squeezed in the PPTX file

Expected Results:
Lines should have adequate line spacing


Reproducible: Always


User Profile Reset: Yes



Additional Info:
Version: 6.3.4.2
Build ID: 60da17e045e08f1793c57c00ba83cdfce946d0aa
CPU threads: 4; OS: Mac OS X 10.13.6; UI render: default; VCL: osx; 
Locale: nl-NL (en_NL.UTF-8); UI-Language: en-US
Calc: threaded
Comment 1 Pieter van Oostrum 2019-12-16 15:52:42 UTC
Created attachment 156607 [details]
Test file in ODP format

This is the ODP file that has the correct layout.
Comment 2 Pieter van Oostrum 2019-12-16 15:53:36 UTC
Created attachment 156608 [details]
PPTX file

This is the PPTX file that has the wrong spacing
Comment 3 Xisco Faulí 2019-12-16 18:28:44 UTC
Regression introduced by:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=ef2e9b19a52e04ae0ed45900bcf64bf375a910ef

author	Tamás Zolnai <tamas.zolnai@collabora.com>	2017-09-25 21:42:57 +0200
committer	Tamás Zolnai <tamas.zolnai@collabora.com>	2017-09-26 14:06:22 +0200
commit ef2e9b19a52e04ae0ed45900bcf64bf375a910ef (patch)
tree 84ed81f6c7c56618623c4b38512287916065b184
parent 616fc7a79f35f4db65b58d34ff6d6e806ff9a6ef (diff)
tdf#112647: Fixed line spacing is saved incorrectly to PPTX

Bisected with: bibisect-linux64-6.0

Adding Cc: to Tamás Zolnai
Comment 4 Pieter van Oostrum 2019-12-20 11:15:32 UTC
It appears that PPT does not have the option 'At Least' for line spacing. It only has proportional (a:spcPct) and fixed (a:spcPts). So on import a:spcPts is always converted to LineSpacingMode::FIX, although there is a test in textspacing.hxx TextSpacing() for bExactValue, but this is set to true in the import.

On export, the value is always output as fixed in DrawingML::WriteLinespacing, as there is no other choice.

So there will always be a loss of information.

I would propose to convert LineSpacingMode::MINIMUM to a fixed linespace in the PPT file with a value that is the maximum of the supplied value, and the value for single line spacing. That seems to me the best approximation.
It is this code in DrawingML::WriteLinespacing

    else
    {
        mpFS->singleElementNS( XML_a, XML_spcPts,
                               XML_val, OString::number(std::lround(rSpacing.Height / 25.4 * 72)));
    }
Comment 5 Commit Notification 2021-12-03 14:53:32 UTC
Tibor Nagy committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/fc1e5202cbfb36b28b0e597811f39895c19ae6ba

tdf#129430 PPTX export: fix workaround for "At least" line spacing

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:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 NISZ LibreOffice Team 2021-12-07 08:11:14 UTC
Verified in:
Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 3a61cce54277fd12570103a191c50d9b37ef3dd3
CPU threads: 8; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: hu-HU
Calc: CL
Comment 7 Commit Notification 2021-12-09 16:14:06 UTC
Tibor Nagy committed a patch related to this issue.
It has been pushed to "libreoffice-7-3":

https://git.libreoffice.org/core/commit/8cb29f4154730713878ddd3c273600411ddaf5fe

tdf#129430 PPTX export: fix workaround for "At least" line spacing

It will be available in 7.3.0.0.beta2.

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.