【问题标题】:How do I change the background and font color of a Sharepoint Online list column header in a view?如何更改视图中 Sharepoint Online 列表列标题的背景和字体颜色?
【发布时间】:2021-07-29 00:03:21
【问题描述】:

我正在尝试更改 Sharepoint Online 列表上视图中列标题的颜色,最好使用 Microsoft 为格式化视图提供的 JSON 架构。

我找到了微软的文档,其中概述了一些有趣的例子,例如我可以用 "hideColumnHeader": true 完全隐藏列标题或者我可以更改组标题的颜色,但似乎没有任何文档如何更改列标题本身的背景颜色。

https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/view-formatting

我想要实现的目标非常简单。我想更改列标题背景颜色和字体颜色,并为不同的列设置不同的颜色,就像在 Excel 中可以轻松做到的那样:

Example of what I want the Sharepoint List view to look like

这可以使用 JSON 模式吗?

提前感谢您的宝贵时间。

【问题讨论】:

    标签: sharepoint sharepoint-online sharepoint-list


    【解决方案1】:

    我最近发现并为行值实现了这一点,它也可能对列标题有所帮助:

    ````  {
    

    "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "txtContent": "@currentField", “风格”: { "color": "=if(@currentField == 'Purple 1', '#ffffff','')", "背景色": "=if(@currentField == 'Gold 1', '#D7AC11', if(@currentField == 'Gold 2', '#DBBA2F', if(@currentField == 'Gold 3' , '#F1D531', if(@currentField == 'Aqua 1', '#008198', if(@currentField == 'Aqua 2', '#00bed8', if(@currentField == 'Aqua 3', ' #75C7B9', if(@currentField == 'Green', '#84b638', if(@currentField == '灰色 1', '#808285', if(@currentField == '灰色 2', '#9d9fa2' , if(@currentField == '灰色 3', '#bcbec0', if(@currentField == '灰色 4', '#e6e7e8', if(@currentField == '红色', '#ca4e28', if( @currentField == 'Purple 1', '#492f92', if(@currentField == 'Purple 2', '#9c8dc3', '' ) ) ) )) ) ) ) )))))"

    } }

    
    
    
    

    【讨论】:

    • 感谢您的回复。我无法使用此方法找到列标题颜色的属性。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-19
    相关资源
    最近更新 更多