Left/Right/Center alignment of cells ?

13 views
Skip to first unread message

Gregory Youngblood

unread,
Oct 5, 2021, 5:50:26 PMOct 5
to seektable-users
This is probably a case of not seeing the forest for the trees, but hopefully someone can point out what I suspect will be painfully obvious.

When creating a pivot table that has expand/collapsed disabled or everything is expanded, or a flat table, all the contents are centered in the cell. When a pivot table is used and expand/collapse is enabled and some rows are collapsed, the rows/columns are left aligned and the measures/values are right aligned.

Is there a way to control cell alignment explicitly and not rely on those settings being enabled or disabled?

Thanks,
Greg

Gregory Youngblood

unread,
Oct 5, 2021, 5:52:57 PMOct 5
to seektable-users
I should probably expand to mention that the alignment should survive exporting to Excel and PDF exports as well.

VF [SeekTable founder]

unread,
Oct 6, 2021, 2:48:36 AMOct 6
to seektable-users
Hi Greg,

yes, there is some inconsistency in the alignment for row-headers: normally they're centered (like column-headers), but when collapsed they are left-aligned (as sub-totals). Centered labels looks good for columns, but for rows left-alignment seems to be more appropriate -- this will be changed in the next release. Note that "Totals" are always right-aligned.

Your SeekTable installation has a "white-label mode" so you can easily customize default cells alignment for a web view (and PDF export) by adding CSS rules at "Admin" -> "System Setup" -> "White-label settings".
To have row-headers always left-aligned (or you can force always-centered if you like):

1) app (web) view  -- add to "Custom App CSS":
table.pvtTable th.pvtRow, table.pvtTable th.pvtRowLabel {  text-align:left; }
table.pvtTable th.subtotals.pvtRow { text-align: left; }
white-label-mode-custom-app-css.png
The same CSS rule should be added to "Custom Public Report CSS" ("Public Report Page") if you use published/embedded reports.

2) PDF export -- add to " Custom PDF export CSS":
white-label-mode-custom-pdf-css.png
table.pvtTable th.pvtRow,  table.pvtTable th.pvtRowLabel {  text-align:left; }
table.pvtTable th.totals {  text-align:right; font-style: italic; }
table.pvtTable th.subtotals.pvtRow { text-align: left; }
table.pvtTable th.subtotals.pvtColumn { text-align: center; }

In similar way you can customize font style or cell colors.

In the Excel export row-headers are already left-aligned. Alignments here cannot be customized as for now.


Gregory Youngblood

unread,
Oct 6, 2021, 10:17:09 AMOct 6
to seektable-users
Hi VF,

Thanks for the quick response.

Alignment is a pretty basic reporting function used frequently in crafting reports. Having the ability to control that is almost as basic as needing to format the output.

Please be careful with hard coded alignments. Really it is the data and needs/purpose of the report that determines what look best. In many cases, text is left aligned, dates might be centered, and numbers are right aligned. Really though, it depends on the report itself.

What would be ideal is in the areas where format can be manipulated (editing cube, and report overrides) to have an "align" option next to "format" so each data element can be aligned for what is best for it. When not set, it could use the defaults you described.

Also, I really appreciate the CSS. I was going to attempt this today. Hopefully it'll be possible to get some things left aligned and some things right aligned as we need to. I'm also hoping to try and get the conditional formatting of cells using the expression option to be able to highlight cells outside of expected or desired values better. My attempts yesterday didn't work out, so I'm still working on that one. :) 

Thanks again,
Greg

VF [SeekTable founder]

unread,
Oct 7, 2021, 1:52:09 AMOct 7
to seektable-users
Regarding

What would be ideal is in the areas where format can be manipulated (editing cube, and report overrides) to have an "align" option next to "format" so each data element can be aligned for what is best for it. When not set, it could use the defaults you described.

with HTML-formatting you can customize alignment even for concrete dimensions/measures simply by wrapping the value with <div style='text-align:left;'>, for example with an expression:

Html.Raw("<div style='text-align:right;'>"+ Html.HtmlEncode(Dimension["some_dim_name"])+"</div>", Dimension["some_dim_name"])

this will affect a web view and a PDF export; for now only functions that affect Excel export are Html.SetTextColor and Html.SetBackgroundColor. If you need an ability to control cells alignment in Excel export similar function can be added (smth like Html.SetTextAlign). Application of HTML formatting may take into account table's structure (dimension is applied on rows or columns, expanded or collapsed etc) in case of <div class="cellClass"> + CSS rules for this class defined in "Custom App CSS" / "Custom PDF export CSS".

Just to say, formatting in Excel exports is rarely preserved in most BI tools -- for example, as for Oct-21 Power BI still unable to export matrix (pivot table) layout to Excel -- only aggregated rowset can be exported without any formatting. Colors are not exported almost everywhere (SeekTable supports that). 

Gregory Youngblood

unread,
Oct 19, 2021, 11:44:17 AMOct 19
to seektable-users
Thanks for the tips. I'll definitely try to make use of them when I have time to experiment to that level.

What I was thinking of was something for our less technical users, so they enabled to do more self-help tweaking and customizing of data exposed to them in the cubes, so they are more comfortable creating or modifying reports to suit their needs.

Layering expressions to set custom div tags and tweaking HTML and CSS is beyond the ability of most non-technical users. Many will see something that looks like Excel, and think aligning the data should be easy, like it is in Excel.

Having the format dialog, or format override dialog, allow for setting column alignment internally would be a boon for those users. Not to mention it enables those users to tweak the report themselves, as opposed to the frustration and delay caused by having to open tickets and/or engage developers to implement what, to them, should be very easy.

Just some food for thought. :)
Reply all
Reply to author
Forward
0 new messages