条件格式
📊 Univer Sheet
条件格式是一种在单元格中设置规则,以根据数据的值自动设置单元格格式的功能。
安装
pnpm add @univerjs/sheets-conditional-formatting @univerjs/sheets-conditional-formatting-ui
引入
import '@univerjs/sheets-conditional-formatting-ui/lib/index.css';
import { UniverSheetsConditionalFormattingPlugin } from '@univerjs/sheets-conditional-formatting';
import { UniverSheetsConditionalFormattingUIPlugin } from '@univerjs/sheets-conditional-formatting-ui';
国际化
import { LocaleType, Tools } from '@univerjs/core';
import SheetsConditionalFormattingUIZhCN from '@univerjs/sheets-conditional-formatting-ui/locale/zh-CN';
const univer = new Univer({
theme: defaultTheme,
locale: LocaleType.ZH_CN,
locales: {
[LocaleType.ZH_CN]: Tools.deepMerge(
SheetsConditionalFormattingUIZhCN
),
},
});
注册
univer.registerPlugin(UniverSheetsConditionalFormattingPlugin);
univer.registerPlugin(UniverSheetsConditionalFormattingUIPlugin);