Forum Discussion
Pre Selected Slicer formatting with Json
hi,
I'm using a Json file for defining used font in my PBI report.
Works fine, however, I had to import a 'Pre Selected Slicer' visual and my font is not applied on that visual.
Someone can help ?
Find below content of my uploaded Json file. Tried to include the pre selected slicer but does not work:
Hi BIuser09
After a bit of testing, it appears that you need to:
- Change "Pre Selected Slicer" to "PreselectedSlicer9302176388541" (the visual's guid)
- Change "Header" and "Items Style" to "header" and "items"
I concluded this after downloading the pbiviz file from the AppSource page here.
I then extracted the files from the pbiviz file (it is effectively a zip file) and examined the file PreselectedSlicer9302176388541.pbiviz.json.
It was a bit of trial and error, but it appeared to work as expected when I tested in Power BI Desktop.
So the theme should end up as:
{ "name": "Custom", "textClasses": { "title": { "fontFace": "Montserrat,Century Gothic" }, "label": { "fontFace": "Montserrat,Century Gothic" }, "callout": { "fontFace": "Montserrat,Century Gothic" }, "header": { "fontFace": "Montserrat,Century Gothic" }, "largeTitle": { "fontFace": "Montserrat,Century Gothic" }, "dataTitle": { "fontFace": "Montserrat,Century Gothic" }, "boldLabel": { "fontFace": "Montserrat,Century Gothic" }, "smallLabel": { "fontFace": "Montserrat,Century Gothic" }, "largeLabel": { "fontFace": "Montserrat,Century Gothic" }, "largeLightLabel": { "fontFace": "Montserrat,Century Gothic" }, "lightLabel": { "fontFace": "Montserrat,Century Gothic" }, "semiboldLabel": { "fontFace": "Montserrat,Century Gothic" }, "smallLightLabel": { "fontFace": "Montserrat,Century Gothic" }, "smallDataLabel": { "fontFace": "Montserrat,Century Gothic" } }, "visualStyles": { "PreselectedSlicer9302176388541": { "*": { "header": [ { "fontFamily": "Montserrat,Century Gothic" } ], "items": [ { "fontFamily": "Montserrat,Century Gothic" } ] } } } }I did find some sources stating that multi-word font names should be enclosed in single quotes, but this didn't seem to matter.
Does this work for you?
3 Replies
- OwenAuger
Super User
Hi BIuser09
After a bit of testing, it appears that you need to:
- Change "Pre Selected Slicer" to "PreselectedSlicer9302176388541" (the visual's guid)
- Change "Header" and "Items Style" to "header" and "items"
I concluded this after downloading the pbiviz file from the AppSource page here.
I then extracted the files from the pbiviz file (it is effectively a zip file) and examined the file PreselectedSlicer9302176388541.pbiviz.json.
It was a bit of trial and error, but it appeared to work as expected when I tested in Power BI Desktop.
So the theme should end up as:
{ "name": "Custom", "textClasses": { "title": { "fontFace": "Montserrat,Century Gothic" }, "label": { "fontFace": "Montserrat,Century Gothic" }, "callout": { "fontFace": "Montserrat,Century Gothic" }, "header": { "fontFace": "Montserrat,Century Gothic" }, "largeTitle": { "fontFace": "Montserrat,Century Gothic" }, "dataTitle": { "fontFace": "Montserrat,Century Gothic" }, "boldLabel": { "fontFace": "Montserrat,Century Gothic" }, "smallLabel": { "fontFace": "Montserrat,Century Gothic" }, "largeLabel": { "fontFace": "Montserrat,Century Gothic" }, "largeLightLabel": { "fontFace": "Montserrat,Century Gothic" }, "lightLabel": { "fontFace": "Montserrat,Century Gothic" }, "semiboldLabel": { "fontFace": "Montserrat,Century Gothic" }, "smallLightLabel": { "fontFace": "Montserrat,Century Gothic" }, "smallDataLabel": { "fontFace": "Montserrat,Century Gothic" } }, "visualStyles": { "PreselectedSlicer9302176388541": { "*": { "header": [ { "fontFamily": "Montserrat,Century Gothic" } ], "items": [ { "fontFamily": "Montserrat,Century Gothic" } ] } } } }I did find some sources stating that multi-word font names should be enclosed in single quotes, but this didn't seem to matter.
Does this work for you?
- BIuser09
Helper I
Thanks Auger !
It was indeed a kind of trial and error.
Did not work in my report at first try. (read tries)
However I was able to do it in a sample file.
Finally deleted my 2 slicers and added back as new, uploaded Json file and it worked!
Tip: to get the official visual name to use in Json:
right click on visual in build screen and select 'About'
- OwenAuger
Super User
You're welcome.
Nice work, and thanks for posting that additional detail! I hadn't thought of checking the visual's context menu so that's very useful to know 🙂