Moving the table to the center of the page

Having trouble installing Oxygen? Got a bug to report? Post it all here.
[Stupid]_[User]
Posts: 21
Joined: Mon Dec 05, 2022 9:35 am

Moving the table to the center of the page

Post by [Stupid]_[User] »

Hello everyone!

There are a lot of tables in my document. Most them have different sizes. It's a big problem for me that small tables "sticky" to the left part of the page (for example you can see Table 3. Fixed in the picture below). Is there any way to move such tables to the center of the page?
oxyforum.PNG
oxyforum.PNG (34.95 KiB) Viewed 596 times
It wold be awesome for me to get a result, similar to figure below (I do it by using Microsoft Office).
oxyforum_word.PNG
oxyforum_word.PNG (6.05 KiB) Viewed 596 times
andrei_pomacu
Posts: 39
Joined: Mon Jul 25, 2022 11:18 am

Re: Moving the table to the center of the page

Post by andrei_pomacu »

Hello,
If you are using PDF&CSS Transformation you could easily add new CSS rule which will align your table in the middle of the page.
  • Add on your table an outputclass to be easily identified in the CSS file .

    Code: Select all

     outputclass="fixed-table-center"
  • Create a CSS file with this code inside:

    Code: Select all

    *[class ~="topic/table"][outputclass = "fixed-table-center"]{
        margin-left: auto;
        margin-right: auto;
    }
  • For linking the CSS file, you have two options:
    1. Create a publishing template, create the customization CSS file inside the template folder, and link it to the publishing template descriptor. For assistance, see Publishing Templates.
    2. Choose an existing publishing template, then edit the scenario and set the full path to the custom CSS file as the value of the args.css parameter. The rules from custom CSS will override the rules from the template CSS files.
Regards,
Andrei
[Stupid]_[User]
Posts: 21
Joined: Mon Dec 05, 2022 9:35 am

Re: Moving the table to the center of the page

Post by [Stupid]_[User] »

andrei_pomacu wrote: Mon Dec 05, 2022 1:48 pm Hello,
If you are using PDF&CSS Transformation you could easily add new CSS rule which will align your table in the middle of the page.
  • Add on your table an outputclass to be easily identified in the CSS file .

    Code: Select all

     outputclass="fixed-table-center"
  • Create a CSS file with this code inside:

    Code: Select all

    *[class ~="topic/table"][outputclass = "fixed-table-center"]{
        margin-left: auto;
        margin-right: auto;
    }
  • For linking the CSS file, you have two options:
    1. Create a publishing template, create the customization CSS file inside the template folder, and link it to the publishing template descriptor. For assistance, see Publishing Templates.
    2. Choose an existing publishing template, then edit the scenario and set the full path to the custom CSS file as the value of the args.css parameter. The rules from custom CSS will override the rules from the template CSS files.
Regards,
Andrei
Hi, Andrei!

It works great! Thanks a lot!
Post Reply