Bug 133045 - DOCX with multiple objects inserted in header section does not open properly and worse from 4.4 and 6.0
Summary: DOCX with multiple objects inserted in header section does not open properly ...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
6.0.0.3 release
Hardware: All All
: medium normal
Assignee: Szabolcs Toth
URL:
Whiteboard: target:7.1.0
Keywords: bibisected, bisected, filter:docx
Depends on:
Blocks: DOCX-Header-Footer DOCX-Objects WPSShapeTextImport-Change
  Show dependency treegraph
 
Reported: 2020-05-14 21:15 UTC by Syeda.Azim
Modified: 2020-11-17 11:05 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
DOCX with header section (19.07 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-05-14 21:17 UTC, Syeda.Azim
Details
Snapshot of the pdf (145.97 KB, image/png)
2020-05-14 21:19 UTC, Syeda.Azim
Details
DOCX compared MSO LO (102.37 KB, image/png)
2020-05-20 11:20 UTC, Timur
Details
DOCX compared MSO LO 4.4 6.0 7.0+ (164.90 KB, image/png)
2020-05-20 11:59 UTC, Timur
Details
Simple example file with top/centered/bottom alignment of shapes relative to top margin (19.19 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-08-10 13:49 UTC, NISZ LibreOffice Team
Details
Screenshot of attachment #164117 (59.74 KB, image/png)
2020-08-10 13:51 UTC, NISZ LibreOffice Team
Details
DOC saved in MSO from DOCX (30.50 KB, application/msword)
2020-11-17 11:05 UTC, Timur
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Syeda.Azim 2020-05-14 21:15:40 UTC
Description:
When a word document with multiple objects inserted in header section is converted to pdf, pdf file is not converted properly. The document's header section is displaying at the middle of the page.

Steps to Reproduce:
1. Convert file to PDF using 'soffice --headless --nolockcheck --nodefault --nofirststartwizard --nologo --norestore --convert-to pdf --outdir /tmp /tmp/test.docx'
2. Open PDF using a viewer
3. Observe the document's header section is displaying at the middle of the page.

Actual Results:
 Document's header section is displaying at the middle of the page.

Expected Results:
Should have header at its original place.


Reproducible: Always


User Profile Reset: No



Additional Info:
None
Comment 1 Syeda.Azim 2020-05-14 21:17:26 UTC
Created attachment 160833 [details]
DOCX with header section
Comment 2 Syeda.Azim 2020-05-14 21:19:42 UTC
Created attachment 160834 [details]
Snapshot of the pdf
Comment 3 Timur 2020-05-20 11:20:41 UTC
Created attachment 161035 [details]
DOCX compared MSO LO

Wrong report for many reasons:
- version cannot be 4.1 but probably 6.1
- it's not convert but fileopen problem
- headless is not important, same with GUI, so shouldn't be mentioned
- it's DOCX, important
- fileopen was not fine but is worse since 6.1.

I confirm the issue per screenshot.
Comment 4 Timur 2020-05-20 11:29:04 UTC
Per bibisect 6.1, worse since: 
 1808bcf38cda75eb2e4315ec399b91e1cbb003f6 is the first bad commit
commit 1808bcf38cda75eb2e4315ec399b91e1cbb003f6
Author: Jenkins Build User <tdf@pollux.tdf>
Date:   Sun Jan 21 23:12:18 2018 +0100

    source ff8826d438a9fd080e8e61f8e66b3d3b2c8d752b
    Previous source e455baf19c3096f46cdcf6279590d7a59775f1fa

https://gerrit.libreoffice.org/plugins/gitiles/core/+/ff8826d438a9fd080e8e61f8e66b3d3b2c8d752b%5E!/

commit ff8826d438a9fd080e8e61f8e66b3d3b2c8d752b	[log]
author	Patrick Jaap <patrick.jaap@tu-dresden.de>	Mon Jan 15 16:43:07 2018 +0100
committer	Thorsten Behrens <Thorsten.Behrens@CIB.de>	Sun Jan 21 22:57:54 2018 +0100
tree f695d493193406537629bc3c6558501e6debafc9
parent e455baf19c3096f46cdcf6279590d7a59775f1fa [diff]

tdf#113946 add 'topMargin' to GraphicHelpers import

The case '...topMargin' was not caught for setting a relative
vertical position in GraphicHelpers. The test file demands a '7' here,
which stands for 'PAGE_FRAME'. The '7' was overwritten in GraphicImport in case
'LN_CT_Anchor_positionV' by a call of 'resolve'.

For a better overview a switch is inserted here.

Change-Id: Ie98209fe445ecbba15c3dafe5980ca52421126f8
Reviewed-on: https://gerrit.libreoffice.org/47905
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Comment 5 Timur 2020-05-20 11:59:53 UTC
Created attachment 161036 [details]
DOCX compared MSO LO 4.4 6.0 7.0+

There were changes in 4.4. Disregarding color improvement, there was size change, which seems worse (unless something else is better):
 64c8b13f248fe7ea3808c7f8e62d0d656f170378 is the first change commit
commit 64c8b13f248fe7ea3808c7f8e62d0d656f170378
Author: Matthew Francis <mjay.francis@gmail.com>
Date:   Sat Mar 14 21:42:08 2015 +0800

    source-hash-d379d18666aa42031359ca8eb34b0021960347ae
    
    commit d379d18666aa42031359ca8eb34b0021960347ae
    Author:     Miklos Vajna <vmiklos@collabora.co.uk>
    AuthorDate: Wed Jun 18 11:57:31 2014 +0200
    Commit:     Miklos Vajna <vmiklos@collabora.co.uk>
    CommitDate: Wed Jun 18 12:09:15 2014 +0200
    
        oox: import WPS shape with text as shape with textbox
    
        This allows having real shapes (like having rounded corners) and complex
        content (like containing a table) at the same time.
    
        WPS shapes are wrappers around drawingML markup in DOCX files, so this
        only affects the DOCX import.
    
        Change-Id: Iad1c1c61233be1c17efa1821e680927aa9587215
        
       Previous source-hash-8e67a7796f598de2f11b694542bccb48343f0d9a
Comment 6 NISZ LibreOffice Team 2020-06-17 09:54:03 UTC
The green textbox is wider because it has its width set as relative 100% to left margin - see bug #132976 about that.
It is vertically centered because originally it's set to be centered relative to top margin (this seems to center it vertically inside the header), which is imported incorrectly as centered relative to "Entire page".
Comment 7 NISZ LibreOffice Team 2020-08-10 13:49:21 UTC
Created attachment 164117 [details]
Simple example file with top/centered/bottom alignment of shapes relative to top margin

Based on the example document in bug #103611 (but converted to DML) this file illustrates the top/centered/bottom alignment relative to the top page margin.
Comment 8 NISZ LibreOffice Team 2020-08-10 13:51:00 UTC
Created attachment 164118 [details]
Screenshot of attachment #164117 [details]

Version: 7.1.0.0.alpha0+ (x64)
Build ID: <buildversion>
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: default; VCL: win
Locale: hu-HU (hu_HU); UI: en-US
Calc: CL

Current nightly from 2020-08-10 04:49:35
Comment 9 Commit Notification 2020-10-20 07:18:21 UTC
Szabolcs Toth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/1c593e1916c9164c7db71da2017cfc26972f8e9f

tdf#133045 sw: add shape alignment to the top page border

It will be available in 7.1.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 10 NISZ LibreOffice Team 2020-11-17 09:44:47 UTC
Verified in:

Version: 7.1.0.0.alpha1+ (x64)
Build ID: 72056f39e01e36afac36c62988331b6813c8214f
CPU threads: 4; OS: Windows 10.0 Build 17134; UI render: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: hu-HU
Calc: threaded

Thanks for fixing!
Comment 11 Timur 2020-11-17 11:05:03 UTC
Created attachment 167354 [details]
DOC saved in MSO from DOCX

DOC also seems fine.