Created attachment 200465 [details] The example file saved as docx with patch of the bug 165083 This is a followup to bug 165083 When attachment 199019 [details] - after fixing above bug with https://gerrit.libreoffice.org/c/core/+/183146/2 but also before the regression causing it - is saved as docx and reloaded in Word or Writer, the second pages large left margin appears on the right side of the page. 1. Open attachment 199019 [details] 2. Save as docx 3. Reload -> the second pages large margin is on the right side instead of left The first pages large margin is correctly on the right side, this is fixed with the above patch. Second page was okay-ish before the patch, now it is back to the previously incorrect state. This seems to have started first in 7.1 with: https://cgit.freedesktop.org/libreoffice/core/commit/?id=5a234ba7f02660ab770f2744d0b936e5607ddafe author Justin Luth <justin.luth@collabora.com> 2020-08-28 15:00:48 +0300 committer Justin Luth <justin_luth@sil.org> 2020-09-24 19:18:31 +0200 commit 5a234ba7f02660ab770f2744d0b936e5607ddafe (patch) tdf#132149 ww8export: use left page properties for left style Before in 7.0 the large margins were on the correct side on both pages.
Created attachment 200466 [details] The original file in Writer and the docx in Word after the patch
Can confirm Version: 25.2.2.2 (X86_64) / LibreOffice Community Build ID: 7370d4be9e3cf6031a51beef54ff3bda878e3fac CPU threads: 8; OS: Linux 6.11; UI render: default; VCL: gtk3 Locale: en-US (en_US.UTF-8); UI: en-US Flatpak Calc: threaded
At first glance my example document (132149_pgBreak3.odt - which is attachment 164711 [details] from bug 132149 comment 13) is almost identical to this bug's bigMargins.odt. However the key difference is the default page style (which is not even used in both cases). -bigMargins.odt has a "Mirrored" default page style, and therefore writes <w:mirrorMargins/> in settings.xml. -132149_pgBreak3.odt has a "Right and Left" page layout which doesn't trigger any settings.xml change. And indeed, prior to my comment 0 change, when we import the round-tripped bigMarginsRT.docx, we didn't get a left page with a 7.62cm left margin, we got a 10cm left margin (from the right-page settings). With comment 0's commit, the margin is now correctly 7.62 cm - it just got swapped during import because of that settings flag. Oliver's code that he reverted in bug 165083 looks mostly correct. I think that the problem is just that "CurrentSection" does not seem to be very accurate...
Justin Luth committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/a4e7d0028efb8fa07d0877aff81fb406f9464fb4 tdf#161521 tdf#166305 docx export: fix page margins when mirrorMargins It will be available in 26.2.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.