Conditional Formatting
Facade API | Paid Version | Univer Server | Univer on Node.js | Preset |
---|---|---|---|---|
- | - | - | ✅ | UniverSheetsConditionalFormattingPreset |
Conditional formatting is a feature that sets rules in cells to automatically set cell formats based on the value of the data.
This feature includes the following plugin packages:
@univerjs/sheets-conditional-formatting
- fundamental conditional formatting plugin@univerjs/sheets-conditional-formatting-ui
- UI plugin for conditional formatting
Installation with Presets
import { createUniver, defaultTheme, LocaleType, Tools } from '@univerjs/presets';
import { UniverSheetsCorePreset } from '@univerjs/presets/preset-sheets-core';
import UniverPresetSheetsCoreEnUS from '@univerjs/presets/preset-sheets-core/locales/en-US';
import { UniverSheetsConditionalFormattingPreset } from '@univerjs/presets/preset-sheets-conditional-formatting';
import UniverPresetSheetsConditionalFormattingEnUS from '@univerjs/presets/preset-sheets-conditional-formatting/locales/en-US';
const { univerAPI } = createUniver({
locale: LocaleType.EN_US,
locales: {
enUS: Tools.deepMerge(
{},
UniverPresetSheetsCoreEnUS,
UniverPresetSheetsConditionalFormattingEnUS
),
},
theme: defaultTheme,
presets: [
UniverSheetsCorePreset(),
UniverSheetsConditionalFormattingPreset(),
],
});
Advanced Installation
npm install @univerjs/sheets-conditional-formatting @univerjs/sheets-conditional-formatting-ui
import { LocaleType, Tools } from '@univerjs/core';
import { UniverSheetsConditionalFormattingPlugin } from '@univerjs/sheets-conditional-formatting';
import { UniverSheetsConditionalFormattingUIPlugin } from '@univerjs/sheets-conditional-formatting-ui';
import SheetsConditionalFormattingUIEnUS from '@univerjs/sheets-conditional-formatting-ui/locale/en-US';
import '@univerjs/sheets-conditional-formatting-ui/lib/index.css';
const univer = new Univer({
theme: defaultTheme,
locale: LocaleType.EN_US,
locales: {
[LocaleType.EN_US]: Tools.deepMerge(
SheetsConditionalFormattingUIEnUS
),
},
});
univer.registerPlugin(UniverSheetsConditionalFormattingPlugin);
univer.registerPlugin(UniverSheetsConditionalFormattingUIPlugin);
Import
import '@univerjs/sheets-conditional-formatting-ui/lib/index.css';
import { UniverSheetsConditionalFormattingPlugin } from '@univerjs/sheets-conditional-formatting';
import { UniverSheetsConditionalFormattingUIPlugin } from '@univerjs/sheets-conditional-formatting-ui';
Installation for Univer on Node.js
npm install @univerjs/sheets-conditional-formatting
import { LocaleType, Tools } from '@univerjs/core';
import { UniverSheetsConditionalFormattingPlugin } from '@univerjs/sheets-conditional-formatting';
import '@univerjs/sheets-conditional-formatting/facade';
const univer = new Univer({
theme: defaultTheme,
locale: LocaleType.EN_US,
});
univer.registerPlugin(UniverSheetsConditionalFormattingPlugin);