Bug 133418 - IMPORT DOCX: Re-use page styles that have identical settings instead of spamming duplicates (Comment 4)
Summary: IMPORT DOCX: Re-use page styles that have identical settings instead of spamm...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
Keywords: filter:docx
Depends on:
Blocks: DOCX-Page
  Show dependency treegraph
Reported: 2020-05-26 17:04 UTC by Telesto
Modified: 2022-09-06 18:42 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2020-05-26 17:04:26 UTC
EXPORT DOCX: Page style names not preserved & new styles added

Steps to Reproduce:
1. Open attachment 161273 [details]
2. Inspect Styles panel -> Page styles 
2. Export to DOCX
3. File Reload
4. Check again

Actual Results:
* New styles are added
* Style names are lost (everything is called converted + number)

Expected Results:
* Should retain style names
* Should not add new styles

Reproducible: Always

User Profile Reset: No

Additional Info:
Version: (x64)
Build ID: 21875558f6c478f07d68ff39e025d7ffd451674f
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL
Comment 1 Mike 2020-05-31 10:28:40 UTC

Version: (x64)
Build-ID: 3d775be2011f3886db32dfd395a6a6d1ca2630ff
CPU-Threads: 4; BS: Windows 10.0 Build 18363; UI-Render: GL; VCL: win; 
Gebietsschema: de-DE (de_DE); UI-Sprache: de-DE
Calc: CL
Comment 2 Telesto 2020-05-31 20:59:02 UTC
Feel free to ignore, but seen the all to docx fixes recently and the styles being quite heavy promoted by Libreoffice.....
Comment 3 Justin L 2020-06-01 05:40:04 UTC
Microsoft formats don't have names for page styles.  And there is nothing like a one-to-one mapping of features, so I don't expect that we could add in our own meta-data to round-trip anything either.  Not possible AFAIK.
Comment 4 Luke Kendall 2020-06-01 08:49:09 UTC
So the only way this could be implemented would be to:
1) add your own metadata to describe significant parts of the Writer page styles (perhaps including those settings changed from defaults), 
2) make a "nearest page style" (or none) to one of the Writer page styles

Those things sound tricky, I agree, and perhaps not worth the effort given you could at best achieve a partial success.

Would it be possible instead for Writer to reuse existing page styles (including the name) it creates during the conversion process, when all the properties match?

You could use a hash of the properties to make the equality comparison ("Is the current page style the same as an already generated one?") efficient.

At present a book of e.g. 500 pages can convert across into 180 page styles (Convert1 to Convert180), all mostly the same as each other.  I.e. they could be expressed in perhaps 4 or 6 distinct page styles.

Tidying up such messy converted .docx-sourced books into a neat .odt file is tedious at present.
Comment 5 Justin L 2021-07-01 12:36:59 UTC
repro 7.3+. This 18 page document (with massive graphics) has 15 converted page styles. I don't foresee any improvements since this is ridiculously complicated especially since page styles contain headers and footers.