Bug 117229 - FILESAVE XLSX Page header+footer margins overwritten with values in wrong units
Summary: FILESAVE XLSX Page header+footer margins overwritten with values in wrong units
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Keywords: filter:xlsx
Depends on:
Blocks: XLSX-Header-Footer
  Show dependency treegraph
Reported: 2018-04-25 11:33 UTC by Gabor Kelemen (allotropia)
Modified: 2023-09-07 15:38 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:

Simple xlsx with default margins (16.83 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2018-04-25 11:33 UTC, Gabor Kelemen (allotropia)
The same file saved by LO 5.4 (6.74 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2018-04-25 11:35 UTC, Gabor Kelemen (allotropia)
Page margin settings in Excel 2013 - original file (12.21 KB, image/png)
2018-04-25 11:35 UTC, Gabor Kelemen (allotropia)
Page margin settings in Excel 2013 - LO-exported file (12.08 KB, image/png)
2018-04-25 11:36 UTC, Gabor Kelemen (allotropia)

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2018-04-25 11:33:34 UTC
Created attachment 141625 [details]
Simple xlsx with default margins

Attached simple XLSX contains by default the following margin settings in xl/worksheets/sheet1.xml:

<pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/>

This results in 1,91 cm top/bottom margins, 1,78 cm left/right margins and 0,76 cm header/footer margins in Excel – so the above values are in inches.

Without any changes to header/footer settings, or enabling them in the Page dialog, this is converted into:

<pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.511805555555555" footer="0.511805555555555"/>

These header-footer values roughly match the default 0,5 cm default in the Page window.

Opening this file in Excel causes the header-footer to become 1,3 cm - or ~0,51 inches.

The header and footer values should remain unchanged by a simple resave, and custom values should be converted to inches before saving.
Comment 1 Gabor Kelemen (allotropia) 2018-04-25 11:35:08 UTC
Created attachment 141626 [details]
The same file saved by LO 5.4
Comment 2 Gabor Kelemen (allotropia) 2018-04-25 11:35:44 UTC
Created attachment 141627 [details]
Page margin settings in Excel 2013 - original file
Comment 3 Gabor Kelemen (allotropia) 2018-04-25 11:36:16 UTC
Created attachment 141628 [details]
Page margin settings in Excel 2013 - LO-exported file
Comment 4 Buovjaga 2018-05-17 10:29:54 UTC

Win 8.1 32-bit
MSO 2013
LibO Version:
Build ID: 23c5125148a8110d88385b29570bf0b7d4400458
CPU threads: 4; OS: Windows 6.3; UI render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2018-05-12_00:15:25
Locale: fi-FI (fi_FI); Calc: group
Comment 5 QA Administrators 2019-11-07 03:34:52 UTC Comment hidden (obsolete)
Comment 6 manfred.benesch 2020-09-13 10:11:55 UTC
This bug is still present in 

Build ID: 7cbcfc562f6eb6708b5ff7d7397325de9e764452
CPU threads: 8; OS: Linux 5.8; UI render: default; VCL: kf5
Locale: de-DE (de_DE.UTF-8); UI: en-US
Calc: threaded
Comment 7 Regina Henschel 2020-09-13 13:47:00 UTC
I don't think, that it is a problem with units. The values are correct in case header/footer have content. In that case it is:
LO top margin + LO header height + LO header spacing = Excel top margin
Excel header position = LO top margin

For example, an Excel setting with top margin 20mm and header position 6mm is divided in LO into top margin 6mm + header height 3,88mm + header spacing 10,12mm.
Because in LO the header is not inside the margin, but belongs to the body area, the Excel header position 6mm becomes the top margin in LO. And to get the total of Excel margin a suitable spacing is used.

These rules are not used, if header/footer are empty.
Comment 8 QA Administrators 2022-09-14 03:38:03 UTC
Dear Gabor Kelemen,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)

If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword

Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team