Apache OpenOffice (AOO) Bugzilla – Issue 14253
Text section of master document loses page style
Last modified: 2013-08-07 14:38:26 UTC
Steps: 1) Create a template with a custom page style. Make something in the page style obvious, such as specifying a background color other than white. (That's to make the problem more obvious, not to make it happen.) In the template, set the initial page style to the custom style. 2) Create a new document based on the template. Add a line or text. 3) File | Send | Create Master Document. You now have a master document with one page based on the custom page style. 4) Create another document based on the template. Add some text. 5) Save this document as an ordinary document and close it. 6) Use the Navigator to insert the document saved in step 5 into the master document. Move the new document below the Text section. Observed: The page no longer uses the custom page style. Expected: Inserting a subdocument wouldn't change the page style of the master document.
It looks as though this problem also explains why I've been having problems getting headers and footers to stick in a master document. Even when they're added at the document level (rather than the template), it appears they become part of the page style, not just a feature of the page itself.
Still a problem in 1.1Beta2
This behavior also happens in RC1. In fact, in my case, the first page of an inserted document reverts to "First Page" style despite the fact that neither the Master Document nor the inserted sub-document uses such a style. Nothing can correct this error. This behavior did not exist in 1.0.3.1 or any previous version of OOo.
reassigned to es
Please attach a sample document.
Created attachment 9662 [details] Master document created with red background for page style
Created attachment 9663 [details] Subdocument inserted into master document
Created attachment 9664 [details] Template used to create the master and the sub-document
Unable to reproduce via reporter's instructions RH9/OOo 1.1.0
I just retested this with OOo 1.1 on Windows 2000 SP4. I'm still seeing exactly the behavior I reported. In this case, I set up a page style with a yellow background. As soon as I added the sub-document to the master document, the background changed to white. Checking in the Stylist showed that the page now used the Default style instead of the one I set up.
Confirmed -- 1.1.1b Mandrake 9.2
Confirmed on OOo 1.1.0 on SuSE 9.0 (x86): Master document uses only one page style and ignores custom page styles from linked documents. Even if the same page style exists in the master and the referenced document it is ignored by the master.
Here is a workaround: IN THE MD: Insert some of the front matter (title page, etc) before any inserted sub-documents. IN THE TEMPLATE: Load and save it with a document title (to distinguish it from the general template). Then double-click on each page style (so it is the active page style) and set the headers and footers the way you want them (including Fields). NOW: When you load the MD and it updates the sub-docs, everything should work as expected. Just remember: NEVER MAKE CHANGES TO THE MD (other than the front matter) BUT TO THE TEMPLATE INSTEAD (so that all changes are part of the sub-docs). Remember: A style name in the MD overrides an identical name in a sub-doc. If you want to see the sub-docs (when editing) in the same form as it will appear in the MD, you MUST set changes in the template, otherwise what you get will not propagate correctly from sub-doc to MD. This is a clumsy workaround that defeats the purpose of templates (having a style set you can use for multiple documents) because you now have to have a separate template for each Master Document. Expected behavior: Header, footer and Outline Numbering information should ALL be saved with the MD. (Bet you haven't found out about the Outline Numbering bug, yet.)
ES->OS: sum up: - a master doc and a sub doc based on the same template have (for instance) 'First Page' as current page style set. - insert the sub doc in the master doc -> page style resets to 'Standard'.
For some strange reason (the reason that leads to the "workaround" I posted, page styles are ignored, regardless of the template, unless the MD has some text in it as well. If the MD is just used as a sub-doc holder and nothing further, it simply does NOT work. I guess that's the simplest description of the problem. I have played around with it a bit more and find that the following steps need to be taken. In order to make it work, the sub-doc needs to be second -- it will not work with "Text" at the top, so the inserted sub-doc needs to be moved below. BEFORE doing that, you MUST insert a Manual-Break defining the style for the inserted doc's first page and the page number (normally "1"). Now you have two blank pages so printing must be from page 3-, it simply doesn't work if you try to print the entire document. Now, unless you have a unique first page style defined with "Break Before" and the page style set, you MUST have a Manual Break before each new sub-doc (but not changing the page number after the first). Again, if you don't do that, you cannot end up with something. BTW, deleting the "Text" and having only inserted sub-docs complete disables the styles of the sub-docs -- there is no way to reach them without a Manual Break and the resulting blank pages.
os->dvo: Inserting a linked section doesn't reset the break-with-pagestyle. It only happens when SwEditShell::InsertGlobalDocContent() is used. Any idea?
Some investigation reveals: The break-with-style attribute is deliberately removed when copying text nodes, which in turn is called whenever linked sections (or subdocuments) are loaded. The decision was made in pre-OpenOffice.org days and can be found in the (old) bugtracker, issue #61467#. The code necessary to maintain break-with-style is still in the sources, but commented out. (sw/source/core/attr/swatrset.cxx#308) (If one just allows copying it still doesn't work, because then the attribute refers to the page style from the source document. The attribute always needs special treatment so that a corresponing page style in the host document is used or created.) The main reason was apparently: A new page style affects all subsequent pages, which would allow a linked section to modify the styling of content outside the section. Also, I see the break-with-style attribute is treated specially in a number of places. Apparently we're trying to hide that it is actually a styling attribute, and try to maintain a behaviour as if a page-break is actually some kind of content element just before the respective paragraph. The only work-around I can see is to create corresponding paragraph styles with page breaks, and use them in both the master and sub-documents. That's ugly, and I suspect no average user will ever find out... dvo->rblackeagle: Unfortunately I entirely fail to see how your work-around would work around the bug. No problem, though; I think now I understand the problem well enough to fix it. :-) dvo->TamarGranor: Nice bugdoc. That helped quite a bit. dvo->os: Also, this appears to affect ALL linked sections. A regular linked section uses the same code, and shows the same behaviour as global document sections. I can't see how SwEditShell::InsertGlobalDocContent() comes into play with any of this. dvo->os: We need to discuss... I think this bug report is perfectly reasonable. That a page-break-with-style affects all subsequent pages is the nature of the attribute, and shouldn't really be a reason to disable them in linked sections. Currently, we disallow ALL manual page breaks in linked sections, which doesn't may much sense to me. [*] Still, I can see the original point for making the decision. [*] We could also change it such that the page break is allowed, but not with changing the page style.
Set to target OOoLater due to lack of resources.
Reset assignee on issues not touched by assignee in more than 2000 days.