Bug 136706 - FILEOPEN: Five page style generated on import from DOCX (only 1 with DOC)
Summary: FILEOPEN: Five page style generated on import from DOCX (only 1 with DOC)
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.5.0 release
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:7.1.0
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-13 07:30 UTC by Telesto
Modified: 2020-09-22 11:53 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Example file (21.14 KB, application/vnd.oasis.opendocument.text)
2020-09-13 07:31 UTC, Telesto
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2020-09-13 07:30:33 UTC
Description:
Five page style generated on export to DOCX (only 1 with DOC)

Steps to Reproduce:
1. Open the attached file
2. Save As DOCX
3. File reload
4. Sidebar -> Styles deck -> Page styles

Actual Results:
5 styles

Expected Results:
1 additional


Reproducible: Always


User Profile Reset: No



Additional Info:
Found in
7.1

4.4.7.2

LibreOffice 3.5.0rc3 
Build ID: 7e68ba2-a744ebf-1f241b7-c506db1-7d53735

not not in
3.3.0 (result not really comparable, pretty broken)
Comment 1 Telesto 2020-09-13 07:31:07 UTC
Created attachment 165441 [details]
Example file
Comment 2 Telesto 2020-09-13 08:07:06 UTC
@Justin
Curious what you're analyses is about this example file here. DOC seems to be better exported 

DOC does a better job page style wise. The page break is also seen in DOC. Not sure if it's required for some reason (or if it should be reported in a different bug)
Comment 3 Justin L 2020-09-14 12:03:09 UTC
It looks like two extra page styles are created for every "footnote section". That ought to be unnecessary.
Comment 4 Justin L 2020-09-14 12:09:10 UTC
(In reply to Telesto from comment #2)
> The page break is also seen in DOC.
> Not sure if it's required for some reason (or if it should be reported in a
> different bug)
The page break is necessary because Word has no concept of page styles, so it has no idea that FirstPage is followed by DefaultPage. Thus it needs to be emulated with a section-page-break.

Normally, first page and the following page styles are virtually identical. In that case, export creates a single section with a special "first" header and that takes care of the problem without a page break. In this particular document, the left and right margins are different, so they can't be treated as a single section (not IsPlausableSingleWordSection).
Comment 5 Justin L 2020-09-14 17:23:33 UTC
(In reply to Justin L from comment #3)
> It looks like two extra page styles are created for every "footnote
> section". That ought to be unnecessary.

Thanks to Michael Stahl's 7.0 change it ought to be possible to ignore footnote sections for closeSectionGroup:
 if (m_aPropertyStacks[eId].size() == 1) // bug 112202 only top level !!!
            m_pLastSectionContext = m_aPropertyStacks[eId].top();


Perhaps it would be possible to skip this function altogether for comments and footnotes.  (Michael already in that commit excluded comments from most of the code in closeSectionGroup).
Comment 6 Justin L 2020-09-15 09:59:33 UTC
Proposed fix at https://gerrit.libreoffice.org/c/core/+/102723
Comment 7 Commit Notification 2020-09-16 12:34:50 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#136706 writerfilter: don't create page style for footnote

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 8 Commit Notification 2020-09-22 11:53:45 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#136706 writerfilter: revert my info-gathering assert

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.