Description: FILEOPEN: DOC/DOCX/RTF. Wrong last page style (also present at copy/paste of the document) Steps to Reproduce: 1. Open the attached file 2. CTRL+A 3. CTRL+C 4. CTRL+N 5. CTRL+V (notice first and last page) 6. Back to initial file: Save as DOCX (or DOC) 7. File reload 8. Compare with Word.. does work Actual Results: Last page being A4 format Expected Results: User defined size Reproducible: Always User Profile Reset: No Additional Info: Found in Version: 7.2.0.0.alpha0+ (x64) Build ID: 315c7570c4a72f4c834086082825533b1e50d1bf 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 LibreOffice 3.5.7.2 Build ID: 3215f89-f603614-ab984f2-7348103-1225a5b
@Justin Adding you because you did some work on page styles in the past.. (it related to endnote style in this specific doc)
Created attachment 168525 [details] Example file
Thank you for reporting the bug. I can confirm that the bug is present in Version: 7.0.3.1 (x64) Build ID: d7547858d014d4cf69878db179d326fc3483e082 CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win Locale: en-US (en_US); UI: en-US Calc: CL Version: 7.2.0.0.alpha0+ (x64) Build ID: 761a672d62df1891b9f4f367a499b220ab2b33fa CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win Locale: en-US (en_US); UI: en-US Calc: CL
I found this bug report very hard to follow. There are so many different things happening here. 1.) If you round-trip the file to DOCX format, then the endnote page doesn't match the smaller size of the other pages on import. (However, Word 2003 imports it with the smaller page dimensions - so file import issue.) Also true for RTF. 2.) DOC format puts the endnotes at the end of the chapter, except that there is still a bit of text from the chapter on the following page - likely just a layout error. (Word opens this file (with errors) and also shows the endnotes at the chapter end.) See Bug 102835 for a request for per-chapter endnotes for Writer. [I'm not sure how DOC format does this. Reviewing the settings of Tools - Footnotes and Endnotes and hitting OK causes the endnotes to jump to the end of the document (with the same caveat as before). 3.) Copy and pasting - doesn't copy the attributes of the default page style (no header, larger A4 page size) or the endnote page style into the new document. (That's not surprising since there is no paragraph containing properties that specify the default page style or the endnote page style.)
> 1.) If you round-trip the file to DOCX format... So, the end-note page is not a real page anyway. It is some automatic thing, and so there is no specification in the DOCX attributes about this "page style", since page styles don't exist in Word. I wasn't able to recreate this problem in a brand new document, so generally it seems to take the size (but not orientation) from the default page style as expected. I spot checked in 7.1, 6.1, 5.2, 5.0, and 3.5 and all acted the same way in regards to the endnote page being A4 sized.
FWIW: source file https://bugs.documentfoundation.org/attachment.cgi?id=163710
Believe it or not, in word/document.xml, replacing all instances of <w:numFmt w:val="decimal"/> with <w:numFmt w:val="lowerRoman"/> "fixes" the problem of the large endnote page size.
The big difference is in sw/source/core/doc/docftn.cxx's SetEndNoteInfo when if( GetEndNoteInfo() == rInfo ) return; when nNumType = SVX_NUM_ROMAN_LOWER, so there is nothing to do since it already matches the default. Otherwise it lcl_PutStdPageSizeIntoItemSet into the Endnote page style - based off of the default page style. The problem is that this is happening too early - before the default page style has been updated with the DOCX parameters. So obviously the fix is to delay ::LN_CT_NumFmt_val, but how... And where is def page style getting updated? (Well, the updating would happen in the first CloseSectionGroup.)
Well, this is very low priority I would say, and I have given LOTS of code pointers, so lets make this an easyHack. It all starts from writerfilter/source/dmapper/DomainMapper.cxx's case NS_ooxml::LN_CT_NumFmt_val: and case NS_ooxml::LN_EG_FtnEdnNumProps_numStart: case NS_ooxml::LN_EG_FtnEdnNumProps_numRestart:
P.S. The way to trigger this bug (or workaround to "fix" it) is Tools -> Footnotes and Endnotes - > Endnotes - Numbering = something that DOCX supports like 123 or ABC, or even I,II,III - anything other than i, ii, iii.
Created attachment 168567 [details] endnoteA4size.docx: minimal with <w:numFmt w:val="decimal"/>
Created attachment 168568 [details] endnoteMatchingSize.docx: identical minimal except <w:numFmt w:val="lowerRoman"/>
@Justin Before I forget. Thank you for looking into it and the depth investigation! And figuring out the flaw. I really unaware/missed of all the other things I (incidentally) included with my report (comment 4). The page dimensions was the most prominent/obvious
Created attachment 187338 [details] endnotePage.docx: LO needs lots of work to handle endnotes like MS Word The endnote page ought to copy the last page, not the first page.
Although this patch https://gerrit.libreoffice.org/c/core/+/153151 is probably not correct I'll post it here anyway to document my attempt. This is not an easyhack.
repro 24.8+