4

I'm trying to make a sidebar in a Libreoffice writer document, exactly like in the following template.

The sidebar should have a different background color and a separate text section, but vertically aligned with the content on the right (the sidebar will be used for headings, while the right section will be used for actual content).

A two column table seems appropriate for this, the left column holds the headings and the right one holds the content, but the sidebar's background color should fill the whole left part of the document (a vertical strip) without any margins, so I should set the margins to zero. The problem is, I need the margins for the text, and I somehow need the table's background color to ignore them.

I understand this may not be a good fit for Writer (and I can make the same document without any issues in HTML/CSS or a graphics editor like Photoshop), but I really need it in writer (the document is for someone else who won't accept an HTML or Photoshop version).

3
  • This question is voluntarily tagged both Libreoffice, Openoffice and Word as I'm looking for a general technique (that will most likely work for all of them) rather than specific instructions "click here, select that, insert that, etc".
    – user256743
    Mar 21, 2015 at 6:08
  • By the way, I promise a bounty of 100 rep for the correct answer as soon as this question becomes eligible for it.
    – user256743
    Mar 21, 2015 at 8:18
  • By the way, I don't think it will be easy to emulate the click on link scrolling behaviour of the right hand column in a word processor ...
    – DavidPostill
    Mar 21, 2015 at 8:26

2 Answers 2

4
+100

Here's a solution for LibreOffice:

I recommend to put a text frame (LibreOffice 4.4) or a LibreOffice Draw OLE object (rectangle) into the header of the very first page. You can resize the rectangle or the text frame so it covers the complete left page margin area, and you can assign a custom color to it. Since the rectangle / text frame is located in the header, it will appear automatically on every new page.

To put content into that margin area, i recommend to insert text frames into the main content area, anchored to a certain paragraph (so they stay aligned with the content), and move the text frames to the left into the margin area. You can even create a frame style based on the first, manually created text frame, so you add styles to all the frames in one single step.

I've just noticed that LO 4.4 seems to behave buggy when trying to set a background color for a Draw OLE object; as workaround, you may use a text frame instead.

  1. In a new document, insert a default header;
  2. Insert the "margin object":

    • For LibreOffice 4.4:

      • click into the header, select Insert -> Frame...;
      • apply the following settings (most important is anchoring the frame to the paragraph, so it appears on every page; also, take care that AutoSize is disabled; you may set the width / height according to your needs or resize the margin afterwards using the mouse):

        enter image description here

    • for LibreOffice with version < 4.4:

      • click into the header, select Insert -> Object -> OLE Object -> LibreOffice 4.4 Drawing, click OK;

      • A drawing window appears; don't edit it, just leave it using the ESC key.

        Now, the screen looks like this:

        enter image description here

      • Move the drawing area using the little green rectangles so it covers the complete left margin (first, set the width; afterwards, move it to the margin of the page):

        enter image description here

    Notice that in the main area, the content will automatically recognize the header's drawing area, so you don't even have to adjust the page margins (you may do so to have some padding between the margin area and the content).

  3. Fill the margin area with any color

    • for a text frame:
      • select the frame
      • enable the Drawing Object properties toolbar (using Menu View -> Toolbars) or right-click -> Frame... -> Area;
      • select the background color;
    • for a Draw OLE object:
      • select the OLE object so the little green rectangles are visible;
      • right-click anywhere inside the OLE object
      • select Object... from the context menu, select Background;
  4. Click into the main content area, add some text, and insert a text frame (i've set the left page margin to 8 cm to separate the content from the margin - you'll have to adjust the margins' position since it moves when changing the page margin):

    enter image description here

  5. Now, if you enter additional content before the text frame, it will stay next to the paragraph it's anchored to:

    enter image description here

2

You can set the background colour of an individual cell.

LibreOffice

  1. Insert a table with 1 row and 2 columns
  2. Select the first column
  3. Table -> Table Properties -> Background -> As "Colour" -> For "Cell"
  4. Choose Colour
  5. Press "OK"

enter image description here

After setting the page margins to 0:

enter image description here

I don't have a copy of OpenOffice or Word to test with but the same technique should work there.

5
  • I was planning to do that already, but the cell would still conform to the margins which means it won't make a perfect vertical strip unless I disable the margins, which brings its own problems (I need the margins to correctly align text).
    – user256743
    Mar 21, 2015 at 8:10
  • I don't understand what you mean by "perfect vertical stripe", can you please explain? Are you referring to paragraph margins or page margins?
    – DavidPostill
    Mar 21, 2015 at 8:12
  • Take a loot at the template I linked to. I want to make the same sidebar with absolutely no margins, so its background color should cover the entire left part of the document. Disabling the margins would make your solution work, but brings its own issues, like text alignment headaches (I need the margins for text alignment).
    – user256743
    Mar 21, 2015 at 8:17
  • I still don't understand. What's wrong with setting the page margins to 0? (other than issues when printing since most printers won't print to the edge of the paper)
    – DavidPostill
    Mar 21, 2015 at 8:20
  • What do you mean by "I need the margins for text alignment"?
    – DavidPostill
    Mar 21, 2015 at 8:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy