Forum Discussion
Center aligning column data by default in Table and Matrix visuals - JSON theme or other methods
Hello,
We develop several dashboards for our group. Every time we develop a visual involving table or matrix visuals, we are requested to make sure data are centered so that it looks nice. We don't want numeric data right aligned and text data left aligned by default, we want it all center aligned by default and change it manually if we want to.
We have to do so one column at a time right now using PowerBI's point-and-click interface, so we have been looking into creating a custom JSON theme that sets centering as default. We cannot find a setting in the JSON structure that will work to align the columns by default. Is there a way to do this?
Example of what I have right now in the JSON theme file. The file loads, but the alignment isn't working:
Hi JeffSwanson ,
Thanks for reaching out to the Microsoft fabric community forum.
I have reviewed the original requirement and would like to clarify the current product behavior to avoid any confusion. Your goal is to have all values in Table and Matrix visuals center aligned by default, ideally managed through a JSON theme so manual adjustments are unnecessary.Currently, Power BI and Fabric do not support this functionality within the theme schema. Although there is a horizontalTextAlignment property in some visual style settings, it does not set a global default for all data cells in Table or Matrix visuals, nor does it override the default behavior of left-aligning text and right-aligning numeric values.
As a result, there is no theme-based solution to automatically center align all columns in these visuals. The most reliable approach remains adjusting alignment per column in the Format pane or using a pre-formatted report template for future reports. This is a product limitation at present, rather than a configuration issue.
Thank you.
5 Replies
- sevenhillsSuper User
Looks like they have changed. You may need to add "horizontalTextAlignment"
Offical ref:
https://github.com/microsoft/powerbi-desktop-samples/blob/main/Report%20Theme%20JSON%20Schema/reportThemeSchema-2.150.json - v-tejramaCommunity Support
Hi JeffSwanson ,
Thanks for reaching out to the Microsoft fabric community forum.
I have reviewed the original requirement and would like to clarify the current product behavior to avoid any confusion. Your goal is to have all values in Table and Matrix visuals center aligned by default, ideally managed through a JSON theme so manual adjustments are unnecessary.Currently, Power BI and Fabric do not support this functionality within the theme schema. Although there is a horizontalTextAlignment property in some visual style settings, it does not set a global default for all data cells in Table or Matrix visuals, nor does it override the default behavior of left-aligning text and right-aligning numeric values.
As a result, there is no theme-based solution to automatically center align all columns in these visuals. The most reliable approach remains adjusting alignment per column in the Format pane or using a pre-formatted report template for future reports. This is a product limitation at present, rather than a configuration issue.
Thank you. - JeffSwansonNew Member
Thank you! I'll work to add the horizontalTextAlignment property where applicable and we can certainly just continue manually modifying the visuals after we place them.
- hsSMONew Member
Hi sevenhills, just to clarify are you saying that the values in tableEx visuals can be edited via a theme using the "horizontalTextAlignment" tag? I have tried this with the below and had no luck.
"tableEx": {"*": {"title": [{"show": false}],"stylePreset": [{"name": "None"}],"grid": [{"gridHorizontal": false,"gridHorizontalColor": { "solid": { "color": "#808080" } },"gridHorizontalWeight": 1,"gridVertical": true,"gridVerticalColor": { "solid": { "color": "#808080" } },"gridVerticalWeight": 1,"outlineColor": { "solid": { "color": "#808080" } },"outlineWeight": 2,"rowPadding": 2,"textSize": 8,"imageHeight": 100}],"values": [{"fontFamily": "Arial","fontSize": 8,"bold": false,"italic": false,"underline": false,"fontColorPrimary": { "solid": { "color": "#000000" } },"backColorPrimary": { "solid": { "color": "#E6E6E6" } },"fontColorSecondary": { "solid": { "color": "#000000" } },"backColorSecondary": { "solid": { "color": "#FFFFFF" } },"wordWrap": true,"outline": "None","urlIcon": false,"horizontalTextAlignment": "Center"}],"columnHeaders": [{"fontFamily": "Arial","fontSize": 9,"bold": true,"italic": false,"underline": false,"fontColor": { "solid": { "color": "#000000" } },"backColor": { "solid": { "color": "#FFFFFF" } },"alignment": "Center","titleAlignment": "Center","wordWrap": true,"autoSizeColumnWidth": false,"outline": "BottomOnly"}],"total": [{"totals": false,"fontFamily": "Arial","fontSize": 8,"bold": true,"italic": false,"underline": false,"fontColor": { "solid": { "color": "#000000" } },"backColor": { "solid": { "color": "#FFFFFF" } },"outline": "TopOnly"}]}}- sevenhillsSuper User
Per this link, it exists!
https://github.com/microsoft/powerbi-desktop-samples/tree/main/Report%20Theme%20JSON%20Schema
Pls check