Center Alignment

(4 posts) (2 voices)

Tags:

No tags yet.

  1. Dev, Member

    Hi,

    I am looking to center-align all the contents in a column. I am using SELECT 'dbr.colstyle', 1, '[text-align: center]';, but it doesn't seem to work. Could you please guide me on how to center-align all the contents in a report, and also how to apply it to only selective columns?

    Thank you

  2. myDBR Team, Key Master

    If you want to center-align a single column, you can use:

    select 'dbr.colstyle', 'columnRef', '[text-align:center]';

    To center-align all columns, add a class to the result set and define a CSS style for it:

    select 'dbr.css', '.center_aligned td {text-align:center}';
    select 'dbr.resultclass', 'center_aligned';

    If you do not see the desired result, use the browser's debugger to identify what is overriding the styles.

    --
    myDBR Team

  3. Dev, Member

    Hi,

    Thank you. It worked, but it seems that this style doesn't apply to the column totals. I am using mydbr.sum for some columns. Is there any way to apply the alignment to the column totals as well?

  4. myDBR Team, Key Master

    Columns, column headers and summary fields can have separate formatting. You can style them with dbr.resultclass, dbr.colstyle or with dbr.colclass.

    If you want to center columns, headers and footers for all columns, the easiest is to use dbr.resultclass:

    select 'dbr.css', '. center_aligned td, . center_aligned th, . center_aligned div {text-align:center}';
    select 'dbr.resultclass', 'center_aligned';

    To center-align a single column you can use:

    select 'dbr.colstyle', 'columnRef', '[text-align:center]';
    select 'dbr.footer.colstyle', 'columnRef', '[text-align:center]';
    select 'dbr.header.colstyle', 'columnRef', 'text-align:center';

    or

    select 'dbr.css', '. center_aligned, . center_aligned div { text-align:center}';
    select 'dbr.footer.colclass', 'columnRef', 'center_aligned';
    select 'dbr.colclass', 'columnRef', 'center_aligned';
    select 'dbr.header.colclass', 'columnRef', 'center_aligned';

    --
    myDBR Team


Reply

You must log in to post.