Ask Your Question

Writer: breaking of background color in section parent

asked 2020-05-01 21:45:39 +0200

torreone gravatar image

updated 2020-05-02 16:11:55 +0200

When two nested sections have set a background color, if the innermost section starts with a paragraph with a non-null top margin or ends with a paragraph with a non-null bottom margin the background of the parent section is interrupted (see attachment)

It's normal ? Is there any way to avoid it without adding new paragraphs or by changing the margins of the paragraphs before and after the section?

The problem with these additions and changes is solved. For example, you can eliminate the top margin and the bottom margin respectively in the first and last paragraph of the slave section and, simultaneously, include the slave section between two empty paragraphs, both therefore in the parent section, the upper one with non-zero bottom margin and the lower one with non-zero top margin.

Using many sections, however, the process for every section is cumbersome.

So I was wondering if this background interruption is normal and / or if it can avoid acting on some setting. Thanks in advance for any contribution C:\fakepath\sectionBackground.odt

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2020-05-02 16:09:49 +0200

torreone gravatar image

updated 2020-05-02 16:14:14 +0200

Meanwhile, thank you for the answer, complete and exhaustive.

I apologize for my incorrect terminology which then complicated your answer.

I also state that as an Italian user I have to rely on the google translator, with all the related misundestanding.

My problem was focused only on the "vertical" effects of paragraph spacing at the beginning and / or end of the nested section.

These spacing can be set by styles or inserted with direct formatting.

Your analysis allows me to evaluate in future applications also the "horizontal" effects, linked to margin and indent, which in my problem did not exist

Your analysis confirms that the problem cannot be solved by acting on particular settings.

I then modified the attachment by inserting a possible solution with further possible uses.

Is this a design decision? Yes. I'm trying to build a dynamic structure with sections that include the heading of the outline document.


A macro can automate this process, for example starting from an existing outline by correctly creating and inserting nested sections. The background colors of the sections can identify the level of the associated header.

In addition, a hierarchy of sections would be created (not necessarily inclusive of all levels, the first could be enough), which would greatly facilitate searches in every subtree of the outline document. Working on this hypothesis I realized by chance that the spacing above paragraph of the headings created this problem in the background colors of the sections

edit flag offensive delete link more


My question about "design decision" is aimed at LO developers, not towards your document structure. Maybe I should make it clear in my answer.

IMHO, your use of sections is flawed. Sections object in LO are not logical sections of a book. They allow to change "locally" the current page layout. It is different from page styles because page styles are active from a page break to some other page break (configured with special attributes). Section can be as small as a fraction of a page and may span several pages but within one page style.

The main use of a Writer section is to change the number of columns, e.g. have some text in 2-column in a 1-column page. Note that section can never decrease the number of columns set in the page style.

As pointed out in the other questions, your "sections" are related to the document ...(more)

ajlittoz gravatar imageajlittoz ( 2020-05-02 16:34:06 +0200 )edit

(…) or argumentation of the topic for several paragraphs until another "heading".

Therefore, you should style the "transitional" paragraph with one of the Heading n paragraph styles. Thus, your outline is now visible and controllable in the "Headings" section of the Navigator.

However this does not fully solve your problem if higher level headings and their subordinate paragraph should behave as if nested inside lower level part. With the Heading n family there is no way to leave level 3 to get back to level 2 and continue at this level (you can only change for another new level-n heading).

If your outline does not end up in a table of contents, you can manage that with lists. Lists in Writer are multi-level and you can leave level-3 to return to level-2 and continue the level-2 topic. However, you can use only one paragraph style in a list.

I think your ...(more)

ajlittoz gravatar imageajlittoz ( 2020-05-02 16:46:54 +0200 )edit

Thanks for your comments, all correct and relevant. I join your question to the developers

Ever since, a year ago, I chose to invest heavily on libreoffice both as functionality and even more on macros, to achieve my goals I had to use certain structures improperly when I did not find another system.

I'm still in the research phase, not surprisingly many of my questions here are on "strange" and niche topics. I try to understand what really it's possible to get from LO

Each of my writer docs is built on heading, navigator and toc, this excludes lists in this context (not in other) . It's true, from level n I can't go back to level n-1. The navigator itself could not do this. I have worked hard to solve this problem But delimiting a heading level n-1 with an expandable section recognizable by the background ...(more)

torreone gravatar imagetorreone ( 2020-05-02 19:36:45 +0200 )edit

(...) Using macros, selecting it, you can limit the search for each content within it. A section with colored background is also easily recognizable and movable with the cut and paste. A batch macro can periodically scan the document to modify the section backcolor if, after moving in other level and after adjust level of all subtree with navigator, not has correct backcolor (every level has different color). All my LO project and structure are designed according to my macros, of course. If you want to exclude some child sections from the search (it is rare but it can happen) in the simplest cases these can be temporarily moved, saving the insertion points with the cursors and restoring after the search. The applications are many. There will certainly be limits, but there will also be advantages.

torreone gravatar imagetorreone ( 2020-05-02 19:45:47 +0200 )edit

A sample document would certainly be necessary for me to understand to what purpose you set the section with regard both to document structure and document content.

I personally never felt the necessity to use macros. Up to now I always solved my requirements with carefully crafted styles and rigorous organisation of my templates. My main use is technical documents. The most complex have indexes, numeric and alphabetic numbering of chapters and annexes, TOC of course, cross-references and several page styles to have different layouts in the various parts. Some even have conditional text. But without any macro ;-)

ajlittoz gravatar imageajlittoz ( 2020-05-02 20:07:20 +0200 )edit

My medium term goal is to use LO documents as a database of already formatted portions of text including images, media, etc. At the center is therefore the advanced search, with regex and multiple keys, by tag, by cataloging (and therefore by heading), the search for related topics using sections or other text-content formatted in a similar way. Central is also the extraction of portions of text and the copy in temporary containers to consult them together For all this, macros are fundamental and after 40 years of programming, it is the minimum for me :-)

With calc, on the contrary, I have to acquire financial data in real time (often to be completely reorganized) to process it, provide me with audible or visual alerts, automate decision algorithms, etc. Even here, without programming, you don't go far. Rigorous organisation of styles and templates it's also my goal, but are ...(more)

torreone gravatar imagetorreone ( 2020-05-02 21:31:48 +0200 )edit

answered 2020-05-02 08:58:48 +0200

ajlittoz gravatar image

updated 2020-05-02 16:48:42 +0200

Please, use a standardised vocabulary if you expect relevant answers.

Margin: space removed from page to define printable area

Indent: additional "margin" added to left and right sides of a paragraph

Spacing: vertical clearance above and below paragraph

I spent quite a long time understanding where you could set margins for sections. There aren't! Also your styles had no indent nor spacing. I then discovered you added spacing with direct formatting! This was not explicited.

Here are my findings:

  • Sections extend from margin to margin (expected)
  • Sections are contiguous (expected)
  • Management of section background is inconsistent with regard to paragraph properties:

    • Paragraph indent is correctly handled, showing section background underneath.
    • Paragraph spacing is inconsistent: above spacing for first or below spacing for last paragraph in section seem to be allocated outside the section in the page area, even when the section is nested inside another one. It is not clear from the displayed section boundary to which "object" this spacing belongs.

      Apparently, first before and last below paragraph spacing is transferred to section (which has no provision for this in its definition).

  • Section background extend from section indent to section indent. Left over space comes from page not from nesting section.

Everything behaves as if a section punches its boundary area down to the page, eliminating the nesting sections. This means you have exactly the same result if you use non-nested sections but for the hassle of repeating manually the properties.

Is this a design decision in Writer implementation of nested sections?

Could a specialist of OTF specification tell if this is a part of the standard? Would this deserve a bug report?

(my edit made clear that both questions are for developers)

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-05-01 21:45:39 +0200

Seen: 80 times

Last updated: May 02 '20