Table OUTSIDE spacing ("paragraph") as template?

Using them, Making them, Finding them
Post Reply
User avatar
Belushi
Posts: 4
Joined: Wed Nov 12, 2014 3:27 pm
Location: Berlin, Germany

Table OUTSIDE spacing ("paragraph") as template?

Post by Belushi »

Hi folks! ;)

I often have to add small tables to my Writer documents.
Due to my standard paragraph formatting (which does NOT add any space above and below the paragraph), letters like "g,y,q" right above the table do "touch" the upper, visible border of it - which is ugly, of course.
The same way, text right below the table that includes "high" characters do touch the lower border.

To prevent that, I always right-click the table I just added, select "Table" from the popup-menu and add a small spacing like 0.1 cm to it (above and below), which makes look the things way smoother.

Well, I have to do that EACH TIME I add a new table, which is annoying.
Unfortunately, there seems no way to create a "paragraph template" for it that I could use as default or add to the templates list.
There IS a default template "Table" - but that deals with the content, not the outside spacing.

Template -> AutoFormat does not work either - the outside spacing seems not to be saved when creating a new template:
When I apply an AutoFormat-Template I just created from an existing table to a new one, all formatting is done correctly - but the outer spacing is 0 again.

Is there any way to teach Writer to add the desired spacing by default???

TIA!! :super:
Belushi
OpenOffice 3.4 on Windows XP and Windows 7
User avatar
Hagar Delest
Moderator
Posts: 32653
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Table OUTSIDE spacing ("paragraph") as template?

Post by Hagar Delest »

Hi and welcome to the forum!

Sadly, there is no style supported yet for tables. See: [Issue] Table styles.
Can't you use a paragraph style that includes a spacing after?
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
User avatar
Belushi
Posts: 4
Joined: Wed Nov 12, 2014 3:27 pm
Location: Berlin, Germany

Re: Table OUTSIDE spacing ("paragraph") as template?

Post by Belushi »

Hello Hagar,

No - I tried that, but it did not work really as expected.
However, your link helped me to find Issue: Table Template which is more or less exactly the problem I have - and the described "workarounds" are even more tedious than simply using the table's options-menu. :knock:

So, it seems I have to live with that. :(

Thank you anyhow! :super:

Belushi
OpenOffice 3.4 on Windows XP and Windows 7
User avatar
Hagar Delest
Moderator
Posts: 32653
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Table OUTSIDE spacing ("paragraph") as template?

Post by Hagar Delest »

The AutoText is the most easy way I think. I use it several times a day to insert pre-formatted tables.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
User avatar
Belushi
Posts: 4
Joined: Wed Nov 12, 2014 3:27 pm
Location: Berlin, Germany

Re: Table OUTSIDE spacing ("paragraph") as template?

Post by Belushi »

Yup, I thought about that.

Unfortunately, that's only a good solution if the tables you need have the same rows/columns layout again and again, but that's not true in my case.
Using the "create-table dropdown" (no idea what's the english name, I'm from Germany :) ) and a right-click to open the options-menu still seems to be the quickest way. ;)
OpenOffice 3.4 on Windows XP and Windows 7
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Table OUTSIDE spacing ("paragraph") as template?

Post by acknak »

If you're sufficiently motivated you can take a text editor to the document xml.

ODF actually has (at least some) support for table styles, and Writer uses them for table formatting, but there is no UI support.

Here's a table style with 2mm above and 3mm below:
<style:style style:name="Table1" style:family="table">
  <style:table-properties style:width="175.9mm"
        fo:margin-top="1.99mm" fo:margin-bottom="3mm" ... />
</style:style>
... and the table itself:
<table:table table:name="Table1" table:style-name="Table1"> ... </table:table>
You would just need to edit the xml so that all tables use the same style (by name) or edit all the table styles to use the same above/below spacing.
AOO4/LO5 • Linux • Fedora 23
User avatar
Belushi
Posts: 4
Joined: Wed Nov 12, 2014 3:27 pm
Location: Berlin, Germany

Re: Table OUTSIDE spacing ("paragraph") as template?

Post by Belushi »

Hello!

Ok, after a little research I think I understood how these xml-files work.
If I'm right, I would have to edit both the styles.xml (adding your style) and the content.xml (adding the style-name to each table).
Is that correct??

Well, that's lot of work - and it would have to be done for each new document.

I guess that your style - if I add it to the style.xml of my template(s) - will be saved along with any new document I create based on that template, so this step should not be neccessary for each new doc. However, editing the content.xml and searching for each table is still a tedious task. May be that could be done using some kind of search/replace script. But honestly, that's not really a convenient solution.

Hm.... a totaly different approach:
Could that be done using scripting??
Something like "search all tables -> insert spacing to properties"??
I then could simply create my doc with un-spaced tables and start the script when I'm done. ;)
Of course, I would have to check the doc for any new page breaks caused by the spaces, but that could be fixed quickly.

I have absolutely no idea at all about how Oo scripts work, so probably it is not possible at all to add scripted styles or properties.
Just an idea that came into my mind! ;)
OpenOffice 3.4 on Windows XP and Windows 7
Post Reply