@univerjs/sheets-conditional-formatting 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1566 @@
1
+ import { IRange } from '@univerjs/core';
2
+ import { CFTimePeriodOperator, IAverageHighlightCell, IColorScale, IConditionalFormattingRuleConfig, IConditionFormattingRule, IIconSet, IValueConfig, CFRuleType } from '@univerjs/sheets-conditional-formatting';
3
+ /**
4
+ * @ignore
5
+ * @hideconstructor
6
+ */
7
+ declare class ConditionalFormatRuleBaseBuilder {
8
+ protected _rule: Partial<IConditionFormattingRule>;
9
+ protected get _ruleConfig(): IConditionalFormattingRuleConfig | null;
10
+ protected _getDefaultConfig(type?: CFRuleType): IConditionalFormattingRuleConfig;
11
+ constructor(initRule?: Partial<IConditionFormattingRule>);
12
+ protected _ensureAttr(obj: Record<string, any>, keys: string[]): Record<string, any>;
13
+ /**
14
+ * Constructs a conditional format rule from the settings applied to the builder.
15
+ * @returns {IConditionFormattingRule} The conditional format rule.
16
+ * @example
17
+ * ```typescript
18
+ * const fWorkbook = univerAPI.getActiveWorkbook();
19
+ * const fWorksheet = fWorkbook.getActiveSheet();
20
+ *
21
+ * // Create a conditional formatting rule that highlights cells with no content in red for the range A1:D10.
22
+ * const fRange = fWorksheet.getRange('A1:D10');
23
+ * const rule = fWorksheet.newConditionalFormattingRule()
24
+ * .whenCellEmpty()
25
+ * .setBackground('#FF0000')
26
+ * .setRanges([fRange.getRange()])
27
+ * .build();
28
+ * fWorksheet.addConditionalFormattingRule(rule);
29
+ * ```
30
+ */
31
+ build(): IConditionFormattingRule;
32
+ /**
33
+ * Deep clone a current builder.
34
+ * @returns {ConditionalFormatRuleBaseBuilder} A new builder with the same settings as the original.
35
+ * @example
36
+ * ```typescript
37
+ * const fWorkbook = univerAPI.getActiveWorkbook();
38
+ * const fWorksheet = fWorkbook.getActiveSheet();
39
+ *
40
+ * // Create a conditional formatting rule that highlights cells with no content in red for the range A1:D10.
41
+ * const fRange = fWorksheet.getRange('A1:D10');
42
+ * const builder = fWorksheet.newConditionalFormattingRule()
43
+ * .whenCellEmpty()
44
+ * .setBackground('#FF0000')
45
+ * .setRanges([fRange.getRange()]);
46
+ * fWorksheet.addConditionalFormattingRule(builder.build());
47
+ *
48
+ * // Copy the rule and change the background color to green for the range A1:B2.
49
+ * const newRange = fWorksheet.getRange('A1:B2');
50
+ * const newBuilder = builder.copy()
51
+ * .setBackground('#00FF00')
52
+ * .setRanges([newRange.getRange()]);
53
+ * fWorksheet.addConditionalFormattingRule(newBuilder.build());
54
+ * ```
55
+ */
56
+ copy(): ConditionalFormatRuleBaseBuilder;
57
+ /**
58
+ * Gets the scope of the current conditional format.
59
+ * @returns {IRange[]} The ranges to which the conditional format applies.
60
+ */
61
+ getRanges(): IRange[];
62
+ /**
63
+ * Get the icon set mapping dictionary.
64
+ * @returns {Record<string, string[]>} The icon set mapping dictionary.
65
+ */
66
+ getIconMap(): Record<string, string[]>;
67
+ /**
68
+ * Create a conditional format ID.
69
+ * @returns {string} The conditional format ID.
70
+ */
71
+ createCfId(): string;
72
+ /**
73
+ * Sets the scope for conditional formatting.
74
+ * @param {IRange[]} ranges - The ranges to which the conditional format applies.
75
+ * @returns {ConditionalFormatRuleBaseBuilder} This builder for chaining.
76
+ * @example
77
+ * ```typescript
78
+ * const fWorkbook = univerAPI.getActiveWorkbook();
79
+ * const fWorksheet = fWorkbook.getActiveSheet();
80
+ *
81
+ * // Create a conditional formatting rule that highlights cells with no content in red for the range A1:D10.
82
+ * const fRange = fWorksheet.getRange('A1:D10');
83
+ * const rule = fWorksheet.newConditionalFormattingRule()
84
+ * .whenCellEmpty()
85
+ * .setBackground('#FF0000')
86
+ * .setRanges([fRange.getRange()])
87
+ * .build();
88
+ * fWorksheet.addConditionalFormattingRule(rule);
89
+ * ```
90
+ */
91
+ setRanges(ranges: IRange[]): this;
92
+ }
93
+ /**
94
+ * @hideconstructor
95
+ */
96
+ declare class ConditionalFormatHighlightRuleBuilder extends ConditionalFormatRuleBaseBuilder {
97
+ constructor(initConfig?: Partial<IConditionFormattingRule>);
98
+ /**
99
+ * Deep clone a current builder.
100
+ * @returns {ConditionalFormatHighlightRuleBuilder} A new builder with the same settings as the original.
101
+ * @example
102
+ * ```typescript
103
+ * const fWorkbook = univerAPI.getActiveWorkbook();
104
+ * const fWorksheet = fWorkbook.getActiveSheet();
105
+ *
106
+ * // Create a conditional formatting rule that highlights cells with no content in red for the range A1:D10.
107
+ * const fRange = fWorksheet.getRange('A1:D10');
108
+ * const builder = fWorksheet.newConditionalFormattingRule()
109
+ * .whenCellEmpty()
110
+ * .setBackground('#FF0000')
111
+ * .setRanges([fRange.getRange()]);
112
+ * fWorksheet.addConditionalFormattingRule(builder.build());
113
+ *
114
+ * // Copy the rule and change the background color to green for the range A1:B2.
115
+ * const newRange = fWorksheet.getRange('A1:B2');
116
+ * const newBuilder = builder.copy()
117
+ * .setBackground('#00FF00')
118
+ * .setRanges([newRange.getRange()]);
119
+ * fWorksheet.addConditionalFormattingRule(newBuilder.build());
120
+ * ```
121
+ */
122
+ copy(): ConditionalFormatHighlightRuleBuilder;
123
+ /**
124
+ * Set average rule.
125
+ * @param {IAverageHighlightCell['operator']} operator - The operator to use for the average rule.
126
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
127
+ * @example
128
+ * ```typescript
129
+ * const fWorkbook = univerAPI.getActiveWorkbook();
130
+ * const fWorksheet = fWorkbook.getActiveSheet();
131
+ *
132
+ * // Create a conditional formatting rule that highlights cells with greater than average values in red for the range A1:D10.
133
+ * const fRange = fWorksheet.getRange('A1:D10');
134
+ * const rule = fWorksheet.newConditionalFormattingRule()
135
+ * .setAverage(univerAPI.Enum.ConditionFormatNumberOperatorEnum.greaterThan)
136
+ * .setBackground('#FF0000')
137
+ * .setRanges([fRange.getRange()])
138
+ * .build();
139
+ * fWorksheet.addConditionalFormattingRule(rule);
140
+ * ```
141
+ */
142
+ setAverage(operator: IAverageHighlightCell['operator']): ConditionalFormatHighlightRuleBuilder;
143
+ /**
144
+ * Set unique values rule.
145
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
146
+ * @example
147
+ * ```typescript
148
+ * const fWorkbook = univerAPI.getActiveWorkbook();
149
+ * const fWorksheet = fWorkbook.getActiveSheet();
150
+ *
151
+ * // Create a conditional formatting rule that highlights cells with unique values in red for the range A1:D10.
152
+ * const fRange = fWorksheet.getRange('A1:D10');
153
+ * const rule = fWorksheet.newConditionalFormattingRule()
154
+ * .setUniqueValues()
155
+ * .setBackground('#FF0000')
156
+ * .setRanges([fRange.getRange()])
157
+ * .build();
158
+ * fWorksheet.addConditionalFormattingRule(rule);
159
+ * ```
160
+ */
161
+ setUniqueValues(): ConditionalFormatHighlightRuleBuilder;
162
+ /**
163
+ * Set duplicate values rule.
164
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
165
+ * @example
166
+ * ```typescript
167
+ * const fWorkbook = univerAPI.getActiveWorkbook();
168
+ * const fWorksheet = fWorkbook.getActiveSheet();
169
+ *
170
+ * // Create a conditional formatting rule that highlights cells with duplicate values in red for the range A1:D10.
171
+ * const fRange = fWorksheet.getRange('A1:D10');
172
+ * const rule = fWorksheet.newConditionalFormattingRule()
173
+ * .setDuplicateValues()
174
+ * .setBackground('#FF0000')
175
+ * .setRanges([fRange.getRange()])
176
+ * .build();
177
+ * fWorksheet.addConditionalFormattingRule(rule);
178
+ * ```
179
+ */
180
+ setDuplicateValues(): ConditionalFormatHighlightRuleBuilder;
181
+ /**
182
+ * Set rank rule.
183
+ * @param {{ isBottom: boolean, isPercent: boolean, value: number }} config - The rank rule settings.
184
+ * @param {boolean} config.isBottom - Whether to highlight the bottom rank.
185
+ * @param {boolean} config.isPercent - Whether to use a percentage rank.
186
+ * @param {number} config.value - The rank value.
187
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
188
+ * @example
189
+ * ```typescript
190
+ * const fWorkbook = univerAPI.getActiveWorkbook();
191
+ * const fWorksheet = fWorkbook.getActiveSheet();
192
+ *
193
+ * // Create a conditional formatting rule that highlights the bottom 10% of values in red for the range A1:D10.
194
+ * const fRange = fWorksheet.getRange('A1:D10');
195
+ * const rule = fWorksheet.newConditionalFormattingRule()
196
+ * .setRank({ isBottom: true, isPercent: true, value: 10 })
197
+ * .setBackground('#FF0000')
198
+ * .setRanges([fRange.getRange()])
199
+ * .build();
200
+ * fWorksheet.addConditionalFormattingRule(rule);
201
+ * ```
202
+ */
203
+ setRank(config: {
204
+ isBottom: boolean;
205
+ isPercent: boolean;
206
+ value: number;
207
+ }): ConditionalFormatHighlightRuleBuilder;
208
+ /**
209
+ * Sets the background color for the conditional format rule's format.
210
+ * @param {string} [color] - The background color to set. If not provided, the background color is removed.
211
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
212
+ * @example
213
+ * ```typescript
214
+ * const fWorkbook = univerAPI.getActiveWorkbook();
215
+ * const fWorksheet = fWorkbook.getActiveSheet();
216
+ *
217
+ * // Create a conditional formatting rule that highlights cells with no content in red for the range A1:D10.
218
+ * const fRange = fWorksheet.getRange('A1:D10');
219
+ * const rule = fWorksheet.newConditionalFormattingRule()
220
+ * .whenCellEmpty()
221
+ * .setBackground('#FF0000')
222
+ * .setRanges([fRange.getRange()])
223
+ * .build();
224
+ * fWorksheet.addConditionalFormattingRule(rule);
225
+ * ```
226
+ */
227
+ setBackground(color?: string): ConditionalFormatHighlightRuleBuilder;
228
+ /**
229
+ * Sets text bolding for the conditional format rule's format.
230
+ * @param {boolean} isBold - Whether to bold the text.
231
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
232
+ * @example
233
+ * ```typescript
234
+ * const fWorkbook = univerAPI.getActiveWorkbook();
235
+ * const fWorksheet = fWorkbook.getActiveSheet();
236
+ *
237
+ * // Create a conditional formatting rule that bolds the text for cells with not empty content in the range A1:D10.
238
+ * const fRange = fWorksheet.getRange('A1:D10');
239
+ * const rule = fWorksheet.newConditionalFormattingRule()
240
+ * .whenCellNotEmpty()
241
+ * .setBold(true)
242
+ * .setRanges([fRange.getRange()])
243
+ * .build();
244
+ * fWorksheet.addConditionalFormattingRule(rule);
245
+ * ```
246
+ */
247
+ setBold(isBold: boolean): ConditionalFormatHighlightRuleBuilder;
248
+ /**
249
+ * Sets the font color for the conditional format rule's format.
250
+ * @param {string} [color] - The font color to set. If not provided, the font color is removed.
251
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
252
+ * @example
253
+ * ```typescript
254
+ * const fWorkbook = univerAPI.getActiveWorkbook();
255
+ * const fWorksheet = fWorkbook.getActiveSheet();
256
+ *
257
+ * // Create a conditional formatting rule that changes the font color to red for cells with not empty content in the range A1:D10.
258
+ * const fRange = fWorksheet.getRange('A1:D10');
259
+ * const rule = fWorksheet.newConditionalFormattingRule()
260
+ * .whenCellNotEmpty()
261
+ * .setFontColor('#FF0000')
262
+ * .setRanges([fRange.getRange()])
263
+ * .build();
264
+ * fWorksheet.addConditionalFormattingRule(rule);
265
+ * ```
266
+ */
267
+ setFontColor(color?: string): ConditionalFormatHighlightRuleBuilder;
268
+ /**
269
+ * Sets text italics for the conditional format rule's format.
270
+ * @param {boolean} isItalic - Whether to italicize the text.
271
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
272
+ * @example
273
+ * ```typescript
274
+ * const fWorkbook = univerAPI.getActiveWorkbook();
275
+ * const fWorksheet = fWorkbook.getActiveSheet();
276
+ *
277
+ * // Create a conditional formatting rule that italicizes the text for cells with not empty content in the range A1:D10.
278
+ * const fRange = fWorksheet.getRange('A1:D10');
279
+ * const rule = fWorksheet.newConditionalFormattingRule()
280
+ * .whenCellNotEmpty()
281
+ * .setItalic(true)
282
+ * .setRanges([fRange.getRange()])
283
+ * .build();
284
+ * fWorksheet.addConditionalFormattingRule(rule);
285
+ * ```
286
+ */
287
+ setItalic(isItalic: boolean): ConditionalFormatHighlightRuleBuilder;
288
+ /**
289
+ * Sets text strikethrough for the conditional format rule's format.
290
+ * @param {boolean} isStrikethrough - Whether is strikethrough the text.
291
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
292
+ * @example
293
+ * ```typescript
294
+ * const fWorkbook = univerAPI.getActiveWorkbook();
295
+ * const fWorksheet = fWorkbook.getActiveSheet();
296
+ *
297
+ * // Create a conditional formatting rule that set text strikethrough for cells with not empty content in the range A1:D10.
298
+ * const fRange = fWorksheet.getRange('A1:D10');
299
+ * const rule = fWorksheet.newConditionalFormattingRule()
300
+ * .whenCellNotEmpty()
301
+ * .setStrikethrough(true)
302
+ * .setRanges([fRange.getRange()])
303
+ * .build();
304
+ * fWorksheet.addConditionalFormattingRule(rule);
305
+ * ```
306
+ */
307
+ setStrikethrough(isStrikethrough: boolean): ConditionalFormatHighlightRuleBuilder;
308
+ /**
309
+ * Sets text underlining for the conditional format rule's format.
310
+ * @param {boolean} isUnderline - Whether to underline the text.
311
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
312
+ * @example
313
+ * ```typescript
314
+ * const fWorkbook = univerAPI.getActiveWorkbook();
315
+ * const fWorksheet = fWorkbook.getActiveSheet();
316
+ *
317
+ * // Create a conditional formatting rule that underlines the text for cells with not empty content in the range A1:D10.
318
+ * const fRange = fWorksheet.getRange('A1:D10');
319
+ * const rule = fWorksheet.newConditionalFormattingRule()
320
+ * .whenCellNotEmpty()
321
+ * .setUnderline(true)
322
+ * .setRanges([fRange.getRange()])
323
+ * .build();
324
+ * fWorksheet.addConditionalFormattingRule(rule);
325
+ * ```
326
+ */
327
+ setUnderline(isUnderline: boolean): ConditionalFormatHighlightRuleBuilder;
328
+ /**
329
+ * Sets the conditional format rule to trigger when the cell is empty.
330
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
331
+ * @example
332
+ * ```typescript
333
+ * const fWorkbook = univerAPI.getActiveWorkbook();
334
+ * const fWorksheet = fWorkbook.getActiveSheet();
335
+ *
336
+ * // Create a conditional formatting rule that highlights cells with no content in red for the range A1:D10.
337
+ * const fRange = fWorksheet.getRange('A1:D10');
338
+ * const rule = fWorksheet.newConditionalFormattingRule()
339
+ * .whenCellEmpty()
340
+ * .setBackground('#FF0000')
341
+ * .setRanges([fRange.getRange()])
342
+ * .build();
343
+ * fWorksheet.addConditionalFormattingRule(rule);
344
+ * ```
345
+ */
346
+ whenCellEmpty(): ConditionalFormatHighlightRuleBuilder;
347
+ /**
348
+ * Sets the conditional format rule to trigger when the cell is not empty.
349
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
350
+ * @example
351
+ * ```typescript
352
+ * const fWorkbook = univerAPI.getActiveWorkbook();
353
+ * const fWorksheet = fWorkbook.getActiveSheet();
354
+ *
355
+ * // Create a conditional formatting rule that changes the font color to red for cells with not empty content in the range A1:D10.
356
+ * const fRange = fWorksheet.getRange('A1:D10');
357
+ * const rule = fWorksheet.newConditionalFormattingRule()
358
+ * .whenCellNotEmpty()
359
+ * .setFontColor('#FF0000')
360
+ * .setRanges([fRange.getRange()])
361
+ * .build();
362
+ * fWorksheet.addConditionalFormattingRule(rule);
363
+ * ```
364
+ */
365
+ whenCellNotEmpty(): ConditionalFormatHighlightRuleBuilder;
366
+ /**
367
+ * Sets the conditional format rule to trigger when a time period is met.
368
+ * @param {CFTimePeriodOperator} date - The time period to check for.
369
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
370
+ * @example
371
+ * ```typescript
372
+ * const fWorkbook = univerAPI.getActiveWorkbook();
373
+ * const fWorksheet = fWorkbook.getActiveSheet();
374
+ *
375
+ * // Create a conditional formatting rule that highlights cells with dates in the last 7 days in red for the range A1:D10.
376
+ * const fRange = fWorksheet.getRange('A1:D10');
377
+ * const rule = fWorksheet.newConditionalFormattingRule()
378
+ * .whenDate(univerAPI.Enum.ConditionFormatTimePeriodOperatorEnum.last7Days)
379
+ * .setBackground('#FF0000')
380
+ * .setRanges([fRange.getRange()])
381
+ * .build();
382
+ * fWorksheet.addConditionalFormattingRule(rule);
383
+ * ```
384
+ */
385
+ whenDate(date: CFTimePeriodOperator): ConditionalFormatHighlightRuleBuilder;
386
+ /**
387
+ * Sets the conditional format rule to trigger when that the given formula evaluates to `true`.
388
+ * @param {string} formulaString - A custom formula that evaluates to true if the input is valid. formulaString start with '='.
389
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
390
+ * @example
391
+ * ```typescript
392
+ * const fWorkbook = univerAPI.getActiveWorkbook();
393
+ * const fWorksheet = fWorkbook.getActiveSheet();
394
+ *
395
+ * // Create a conditional formatting rule that highlights cells with values greater than 10 in red for the range A1:D10.
396
+ * const fRange = fWorksheet.getRange('A1:D10');
397
+ * const rule = fWorksheet.newConditionalFormattingRule()
398
+ * .whenFormulaSatisfied('=A1>10')
399
+ * .setBackground('#FF0000')
400
+ * .setRanges([fRange.getRange()])
401
+ * .build();
402
+ * fWorksheet.addConditionalFormattingRule(rule);
403
+ * ```
404
+ */
405
+ whenFormulaSatisfied(formulaString: string): ConditionalFormatHighlightRuleBuilder;
406
+ /**
407
+ * Sets the conditional format rule to trigger when a number falls between, or is either of, two specified values.
408
+ * @param {number} start - The lowest acceptable value.
409
+ * @param {number} end - The highest acceptable value.
410
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
411
+ * @example
412
+ * ```typescript
413
+ * const fWorkbook = univerAPI.getActiveWorkbook();
414
+ * const fWorksheet = fWorkbook.getActiveSheet();
415
+ *
416
+ * // Create a conditional formatting rule that highlights cells with values between 10 and 20 in red for the range A1:D10.
417
+ * const fRange = fWorksheet.getRange('A1:D10');
418
+ * const rule = fWorksheet.newConditionalFormattingRule()
419
+ * .whenNumberBetween(10, 20)
420
+ * .setBackground('#FF0000')
421
+ * .setRanges([fRange.getRange()])
422
+ * .build();
423
+ * fWorksheet.addConditionalFormattingRule(rule);
424
+ * ```
425
+ */
426
+ whenNumberBetween(start: number, end: number): ConditionalFormatHighlightRuleBuilder;
427
+ /**
428
+ * Sets the conditional format rule to trigger when a number is equal to the given value.
429
+ * @param {number} value - The sole acceptable value.
430
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
431
+ * @example
432
+ * ```typescript
433
+ * const fWorkbook = univerAPI.getActiveWorkbook();
434
+ * const fWorksheet = fWorkbook.getActiveSheet();
435
+ *
436
+ * // Create a conditional formatting rule that highlights cells with values equal to 10 in red for the range A1:D10.
437
+ * const fRange = fWorksheet.getRange('A1:D10');
438
+ * const rule = fWorksheet.newConditionalFormattingRule()
439
+ * .whenNumberEqualTo(10)
440
+ * .setBackground('#FF0000')
441
+ * .setRanges([fRange.getRange()])
442
+ * .build();
443
+ * fWorksheet.addConditionalFormattingRule(rule);
444
+ * ```
445
+ */
446
+ whenNumberEqualTo(value: number): ConditionalFormatHighlightRuleBuilder;
447
+ /**
448
+ * Sets the conditional format rule to trigger when a number is greater than the given value.
449
+ * @param {number} value - The highest unacceptable value.
450
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
451
+ * @example
452
+ * ```typescript
453
+ * const fWorkbook = univerAPI.getActiveWorkbook();
454
+ * const fWorksheet = fWorkbook.getActiveSheet();
455
+ *
456
+ * // Create a conditional formatting rule that highlights cells with values greater than 10 in red for the range A1:D10.
457
+ * const fRange = fWorksheet.getRange('A1:D10');
458
+ * const rule = fWorksheet.newConditionalFormattingRule()
459
+ * .whenNumberGreaterThan(10)
460
+ * .setBackground('#FF0000')
461
+ * .setRanges([fRange.getRange()])
462
+ * .build();
463
+ * fWorksheet.addConditionalFormattingRule(rule);
464
+ * ```
465
+ */
466
+ whenNumberGreaterThan(value: number): ConditionalFormatHighlightRuleBuilder;
467
+ /**
468
+ * Sets the conditional format rule to trigger when a number is greater than or equal to the given value.
469
+ * @param {number} value - The lowest acceptable value.
470
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
471
+ * @example
472
+ * ```typescript
473
+ * const fWorkbook = univerAPI.getActiveWorkbook();
474
+ * const fWorksheet = fWorkbook.getActiveSheet();
475
+ *
476
+ * // Create a conditional formatting rule that highlights cells with values greater than or equal to 10 in red for the range A1:D10.
477
+ * const fRange = fWorksheet.getRange('A1:D10');
478
+ * const rule = fWorksheet.newConditionalFormattingRule()
479
+ * .whenNumberGreaterThanOrEqualTo(10)
480
+ * .setBackground('#FF0000')
481
+ * .setRanges([fRange.getRange()])
482
+ * .build();
483
+ * fWorksheet.addConditionalFormattingRule(rule);
484
+ * ```
485
+ */
486
+ whenNumberGreaterThanOrEqualTo(value: number): ConditionalFormatHighlightRuleBuilder;
487
+ /**
488
+ * Sets the conditional conditional format rule to trigger when a number less than the given value.
489
+ * @param {number} value - The lowest unacceptable value.
490
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
491
+ * @example
492
+ * ```typescript
493
+ * const fWorkbook = univerAPI.getActiveWorkbook();
494
+ * const fWorksheet = fWorkbook.getActiveSheet();
495
+ *
496
+ * // Create a conditional formatting rule that highlights cells with values less than 10 in red for the range A1:D10.
497
+ * const fRange = fWorksheet.getRange('A1:D10');
498
+ * const rule = fWorksheet.newConditionalFormattingRule()
499
+ * .whenNumberLessThan(10)
500
+ * .setBackground('#FF0000')
501
+ * .setRanges([fRange.getRange()])
502
+ * .build();
503
+ * fWorksheet.addConditionalFormattingRule(rule);
504
+ * ```
505
+ */
506
+ whenNumberLessThan(value: number): ConditionalFormatHighlightRuleBuilder;
507
+ /**
508
+ * Sets the conditional format rule to trigger when a number less than or equal to the given value.
509
+ * @param {number} value - The highest acceptable value.
510
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
511
+ * @example
512
+ * ```typescript
513
+ * const fWorkbook = univerAPI.getActiveWorkbook();
514
+ * const fWorksheet = fWorkbook.getActiveSheet();
515
+ *
516
+ * // Create a conditional formatting rule that highlights cells with values less than or equal to 10 in red for the range A1:D10.
517
+ * const fRange = fWorksheet.getRange('A1:D10');
518
+ * const rule = fWorksheet.newConditionalFormattingRule()
519
+ * .whenNumberLessThanOrEqualTo(10)
520
+ * .setBackground('#FF0000')
521
+ * .setRanges([fRange.getRange()])
522
+ * .build();
523
+ * fWorksheet.addConditionalFormattingRule(rule);
524
+ * ```
525
+ */
526
+ whenNumberLessThanOrEqualTo(value: number): ConditionalFormatHighlightRuleBuilder;
527
+ /**
528
+ * Sets the conditional format rule to trigger when a number does not fall between, and is neither of, two specified values.
529
+ * @param {number} start - The lowest unacceptable value.
530
+ * @param {number} end - The highest unacceptable value.
531
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
532
+ * @example
533
+ * ```typescript
534
+ * const fWorkbook = univerAPI.getActiveWorkbook();
535
+ * const fWorksheet = fWorkbook.getActiveSheet();
536
+ *
537
+ * // Create a conditional formatting rule that highlights cells with values not between 10 and 20 in red for the range A1:D10.
538
+ * const fRange = fWorksheet.getRange('A1:D10');
539
+ * const rule = fWorksheet.newConditionalFormattingRule()
540
+ * .whenNumberNotBetween(10, 20)
541
+ * .setBackground('#FF0000')
542
+ * .setRanges([fRange.getRange()])
543
+ * .build();
544
+ * fWorksheet.addConditionalFormattingRule(rule);
545
+ * ```
546
+ */
547
+ whenNumberNotBetween(start: number, end: number): ConditionalFormatHighlightRuleBuilder;
548
+ /**
549
+ * Sets the conditional format rule to trigger when a number is not equal to the given value.
550
+ * @param {number} value - The sole unacceptable value.
551
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
552
+ * @example
553
+ * ```typescript
554
+ * const fWorkbook = univerAPI.getActiveWorkbook();
555
+ * const fWorksheet = fWorkbook.getActiveSheet();
556
+ *
557
+ * // Create a conditional formatting rule that highlights cells with values not equal to 10 in red for the range A1:D10.
558
+ * const fRange = fWorksheet.getRange('A1:D10');
559
+ * const rule = fWorksheet.newConditionalFormattingRule()
560
+ * .whenNumberNotEqualTo(10)
561
+ * .setBackground('#FF0000')
562
+ * .setRanges([fRange.getRange()])
563
+ * .build();
564
+ * fWorksheet.addConditionalFormattingRule(rule);
565
+ * ```
566
+ */
567
+ whenNumberNotEqualTo(value: number): ConditionalFormatHighlightRuleBuilder;
568
+ /**
569
+ * Sets the conditional format rule to trigger when that the input contains the given value.
570
+ * @param {string} text - The value that the input must contain.
571
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
572
+ * @example
573
+ * ```typescript
574
+ * const fWorkbook = univerAPI.getActiveWorkbook();
575
+ * const fWorksheet = fWorkbook.getActiveSheet();
576
+ *
577
+ * // Create a conditional formatting rule that highlights cells with text containing 'apple' in red for the range A1:D10.
578
+ * const fRange = fWorksheet.getRange('A1:D10');
579
+ * const rule = fWorksheet.newConditionalFormattingRule()
580
+ * .whenTextContains('apple')
581
+ * .setBackground('#FF0000')
582
+ * .setRanges([fRange.getRange()])
583
+ * .build();
584
+ * fWorksheet.addConditionalFormattingRule(rule);
585
+ * ```
586
+ */
587
+ whenTextContains(text: string): ConditionalFormatHighlightRuleBuilder;
588
+ /**
589
+ * Sets the conditional format rule to trigger when that the input does not contain the given value.
590
+ * @param {string} text - The value that the input must not contain.
591
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
592
+ * @example
593
+ * ```typescript
594
+ * const fWorkbook = univerAPI.getActiveWorkbook();
595
+ * const fWorksheet = fWorkbook.getActiveSheet();
596
+ *
597
+ * // Create a conditional formatting rule that highlights cells with text not containing 'apple' in red for the range A1:D10.
598
+ * const fRange = fWorksheet.getRange('A1:D10');
599
+ * const rule = fWorksheet.newConditionalFormattingRule()
600
+ * .whenTextDoesNotContain('apple')
601
+ * .setBackground('#FF0000')
602
+ * .setRanges([fRange.getRange()])
603
+ * .build();
604
+ * fWorksheet.addConditionalFormattingRule(rule);
605
+ * ```
606
+ */
607
+ whenTextDoesNotContain(text: string): ConditionalFormatHighlightRuleBuilder;
608
+ /**
609
+ * Sets the conditional format rule to trigger when that the input ends with the given value.
610
+ * @param {string} text - Text to compare against the end of the string.
611
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
612
+ * @example
613
+ * ```typescript
614
+ * const fWorkbook = univerAPI.getActiveWorkbook();
615
+ * const fWorksheet = fWorkbook.getActiveSheet();
616
+ *
617
+ * // Create a conditional formatting rule that highlights cells with text ending with '.ai' in red for the range A1:D10.
618
+ * const fRange = fWorksheet.getRange('A1:D10');
619
+ * const rule = fWorksheet.newConditionalFormattingRule()
620
+ * .whenTextEndsWith('.ai')
621
+ * .setBackground('#FF0000')
622
+ * .setRanges([fRange.getRange()])
623
+ * .build();
624
+ * fWorksheet.addConditionalFormattingRule(rule);
625
+ * ```
626
+ */
627
+ whenTextEndsWith(text: string): ConditionalFormatHighlightRuleBuilder;
628
+ /**
629
+ * Sets the conditional format rule to trigger when that the input is equal to the given value.
630
+ * @param {string} text - The sole acceptable value.
631
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
632
+ * @example
633
+ * ```typescript
634
+ * const fWorkbook = univerAPI.getActiveWorkbook();
635
+ * const fWorksheet = fWorkbook.getActiveSheet();
636
+ *
637
+ * // Create a conditional formatting rule that highlights cells with text equal to 'apple' in red for the range A1:D10.
638
+ * const fRange = fWorksheet.getRange('A1:D10');
639
+ * const rule = fWorksheet.newConditionalFormattingRule()
640
+ * .whenTextEqualTo('apple')
641
+ * .setBackground('#FF0000')
642
+ * .setRanges([fRange.getRange()])
643
+ * .build();
644
+ * fWorksheet.addConditionalFormattingRule(rule);
645
+ * ```
646
+ */
647
+ whenTextEqualTo(text: string): ConditionalFormatHighlightRuleBuilder;
648
+ /**
649
+ * Sets the conditional format rule to trigger when that the input starts with the given value.
650
+ * @param {string} text - Text to compare against the beginning of the string.
651
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
652
+ * @example
653
+ * ```typescript
654
+ * const fWorkbook = univerAPI.getActiveWorkbook();
655
+ * const fWorksheet = fWorkbook.getActiveSheet();
656
+ *
657
+ * // Create a conditional formatting rule that highlights cells with text starting with 'https://' in red for the range A1:D10.
658
+ * const fRange = fWorksheet.getRange('A1:D10');
659
+ * const rule = fWorksheet.newConditionalFormattingRule()
660
+ * .whenTextStartsWith('https://')
661
+ * .setBackground('#FF0000')
662
+ * .setRanges([fRange.getRange()])
663
+ * .build();
664
+ * fWorksheet.addConditionalFormattingRule(rule);
665
+ * ```
666
+ */
667
+ whenTextStartsWith(text: string): ConditionalFormatHighlightRuleBuilder;
668
+ }
669
+ declare class ConditionalFormatDataBarRuleBuilder extends ConditionalFormatRuleBaseBuilder {
670
+ /**
671
+ * Deep clone a current builder.
672
+ * @returns {ConditionalFormatDataBarRuleBuilder} A new instance of the builder with the same settings as the original.
673
+ * @example
674
+ * ```typescript
675
+ * const fWorkbook = univerAPI.getActiveWorkbook();
676
+ * const fWorksheet = fWorkbook.getActiveSheet();
677
+ *
678
+ * // Create a conditional formatting rule that adds a data bar to cells with values between -100 and 100 in the range A1:D10.
679
+ * // positive values are green and negative values are red.
680
+ * const fRange = fWorksheet.getRange('A1:D10');
681
+ * const builder = fWorksheet.newConditionalFormattingRule()
682
+ * .setDataBar({
683
+ * min: { type: 'num', value: -100 },
684
+ * max: { type: 'num', value: 100 },
685
+ * positiveColor: '#00FF00',
686
+ * nativeColor: '#FF0000',
687
+ * isShowValue: true
688
+ * })
689
+ * .setRanges([fRange.getRange()]);
690
+ * fWorksheet.addConditionalFormattingRule(builder.build());
691
+ *
692
+ * // Copy the rule and apply it to a new range.
693
+ * const newRange = fWorksheet.getRange('F1:F10');
694
+ * const newBuilder = builder.copy()
695
+ * .setRanges([newRange.getRange()]);
696
+ * fWorksheet.addConditionalFormattingRule(newBuilder.build());
697
+ * ```
698
+ */
699
+ copy(): ConditionalFormatDataBarRuleBuilder;
700
+ /**
701
+ * Set data bar rule.
702
+ * @param {{
703
+ * min: IValueConfig;
704
+ * max: IValueConfig;
705
+ * isGradient?: boolean;
706
+ * positiveColor: string;
707
+ * nativeColor: string;
708
+ * isShowValue?: boolean;
709
+ * }} config - The data bar rule settings.
710
+ * @param {IValueConfig} config.min - The minimum value for the data bar.
711
+ * @param {IValueConfig} config.max - The maximum value for the data bar.
712
+ * @param {boolean} [config.isGradient] - Whether the data bar is gradient.
713
+ * @param {string} config.positiveColor - The color for positive values.
714
+ * @param {string} config.nativeColor - The color for negative values.
715
+ * @param {boolean} [config.isShowValue] - Whether to show the value in the cell.
716
+ * @returns {ConditionalFormatDataBarRuleBuilder} This builder for chaining.
717
+ * @example
718
+ * ```typescript
719
+ * const fWorkbook = univerAPI.getActiveWorkbook();
720
+ * const fWorksheet = fWorkbook.getActiveSheet();
721
+ *
722
+ * // Create a conditional formatting rule that adds a data bar to cells with values between -100 and 100 in the range A1:D10.
723
+ * // positive values are green and negative values are red.
724
+ * const fRange = fWorksheet.getRange('A1:D10');
725
+ * const rule = fWorksheet.newConditionalFormattingRule()
726
+ * .setDataBar({
727
+ * min: { type: 'num', value: -100 },
728
+ * max: { type: 'num', value: 100 },
729
+ * positiveColor: '#00FF00',
730
+ * nativeColor: '#FF0000',
731
+ * isShowValue: true
732
+ * })
733
+ * .setRanges([fRange.getRange()])
734
+ * .build();
735
+ * fWorksheet.addConditionalFormattingRule(rule);
736
+ * ```
737
+ */
738
+ setDataBar(config: {
739
+ min: IValueConfig;
740
+ max: IValueConfig;
741
+ isGradient?: boolean;
742
+ positiveColor: string;
743
+ nativeColor: string;
744
+ isShowValue?: boolean;
745
+ }): ConditionalFormatDataBarRuleBuilder;
746
+ }
747
+ declare class ConditionalFormatColorScaleRuleBuilder extends ConditionalFormatRuleBaseBuilder {
748
+ /**
749
+ * Deep clone a current builder.
750
+ * @returns {ConditionalFormatColorScaleRuleBuilder} A new instance of the builder with the same settings as the original.
751
+ * @example
752
+ * ```typescript
753
+ * const fWorkbook = univerAPI.getActiveWorkbook();
754
+ * const fWorksheet = fWorkbook.getActiveSheet();
755
+ *
756
+ * // Create a conditional formatting rule that adds a color scale to cells with values between 0 and 100 in the range A1:D10.
757
+ * // The color scale is green for 0, yellow for 50, and red for 100.
758
+ * const fRange = fWorksheet.getRange('A1:D10');
759
+ * const builder = fWorksheet.newConditionalFormattingRule()
760
+ * .setColorScale([
761
+ * { index: 0, color: '#00FF00', value: { type: 'num', value: 0 } },
762
+ * { index: 1, color: '#FFFF00', value: { type: 'num', value: 50 } },
763
+ * { index: 2, color: '#FF0000', value: { type: 'num', value: 100 } }
764
+ * ])
765
+ * .setRanges([fRange.getRange()]);
766
+ * fWorksheet.addConditionalFormattingRule(builder.build());
767
+ *
768
+ * // Copy the rule and apply it to a new range.
769
+ * const newRange = fWorksheet.getRange('F1:F10');
770
+ * const newBuilder = builder.copy()
771
+ * .setRanges([newRange.getRange()]);
772
+ * fWorksheet.addConditionalFormattingRule(newBuilder.build());
773
+ * ```
774
+ */
775
+ copy(): ConditionalFormatColorScaleRuleBuilder;
776
+ /**
777
+ * Set color scale rule.
778
+ * @param {{ index: number; color: string; value: IValueConfig }[]} config - The color scale rule settings.
779
+ * @param {number} config.index - The index of the color scale configuration.
780
+ * @param {string} config.color - The color corresponding to the index of the color scale configuration.
781
+ * @param {IValueConfig} config.value - The condition value corresponding to the index of the color scale configuration.
782
+ * @returns {ConditionalFormatColorScaleRuleBuilder} This builder for chaining.
783
+ * @example
784
+ * ```typescript
785
+ * const fWorkbook = univerAPI.getActiveWorkbook();
786
+ * const fWorksheet = fWorkbook.getActiveSheet();
787
+ *
788
+ * // Create a conditional formatting rule that adds a color scale to cells with values between 0 and 100 in the range A1:D10.
789
+ * // The color scale is green for 0, yellow for 50, and red for 100.
790
+ * const fRange = fWorksheet.getRange('A1:D10');
791
+ * const rule = fWorksheet.newConditionalFormattingRule()
792
+ * .setColorScale([
793
+ * { index: 0, color: '#00FF00', value: { type: 'num', value: 0 } },
794
+ * { index: 1, color: '#FFFF00', value: { type: 'num', value: 50 } },
795
+ * { index: 2, color: '#FF0000', value: { type: 'num', value: 100 } }
796
+ * ])
797
+ * .setRanges([fRange.getRange()])
798
+ * .build();
799
+ * fWorksheet.addConditionalFormattingRule(rule);
800
+ * ```
801
+ */
802
+ setColorScale(config: IColorScale['config']): ConditionalFormatColorScaleRuleBuilder;
803
+ }
804
+ declare class ConditionalFormatIconSetRuleBuilder extends ConditionalFormatRuleBaseBuilder {
805
+ /**
806
+ * Deep clone a current builder.
807
+ * @returns {ConditionalFormatIconSetRuleBuilder} A new instance of the builder with the same settings as the original.
808
+ * @example
809
+ * ```typescript
810
+ * const fWorkbook = univerAPI.getActiveWorkbook();
811
+ * const fWorksheet = fWorkbook.getActiveSheet();
812
+ *
813
+ * // Create a 3-arrow icon set conditional formatting rule in the range A1:D10.
814
+ * // The first arrow is green for values greater than 20.
815
+ * // The second arrow is yellow for values greater than 10.
816
+ * // The third arrow is red for values less than or equal to 10.
817
+ * const fRange = fWorksheet.getRange('A1:D10');
818
+ * const builder = fWorksheet.newConditionalFormattingRule()
819
+ * .setIconSet({
820
+ * iconConfigs: [
821
+ * { iconType: '3Arrows', iconId: '0', operator: univerAPI.Enum.ConditionFormatNumberOperatorEnum.greaterThan, value: { type: 'num', value: 20 } },
822
+ * { iconType: '3Arrows', iconId: '1', operator: univerAPI.Enum.ConditionFormatNumberOperatorEnum.greaterThan, value: { type: 'num', value: 10 } },
823
+ * { iconType: '3Arrows', iconId: '2', operator: univerAPI.Enum.ConditionFormatNumberOperatorEnum.lessThanOrEqual, value: { type: 'num', value: 10 } }
824
+ * ],
825
+ * isShowValue: true,
826
+ * })
827
+ * .setRanges([fRange.getRange()]);
828
+ * fWorksheet.addConditionalFormattingRule(builder.build());
829
+ *
830
+ * // Copy the rule and apply it to a new range.
831
+ * const newRange = fWorksheet.getRange('F1:F10');
832
+ * const newBuilder = builder.copy()
833
+ * .setRanges([newRange.getRange()]);
834
+ * fWorksheet.addConditionalFormattingRule(newBuilder.build());
835
+ * ```
836
+ */
837
+ copy(): ConditionalFormatIconSetRuleBuilder;
838
+ /**
839
+ * Set up icon set conditional formatting rule.
840
+ * @param {{ iconConfigs: IIconSet['config'], isShowValue: boolean }} config - The icon set conditional formatting rule settings.
841
+ * @param {IIconSet['config']} config.iconConfigs - The icon configurations. iconId property is a string indexing of a group icons.
842
+ * @param {boolean} config.isShowValue - Whether to show the value in the cell.
843
+ * @returns {ConditionalFormatIconSetRuleBuilder} This builder for chaining.
844
+ * @example
845
+ * ```typescript
846
+ * const fWorkbook = univerAPI.getActiveWorkbook();
847
+ * const fWorksheet = fWorkbook.getActiveSheet();
848
+ *
849
+ * // Create a 3-arrow icon set conditional formatting rule in the range A1:D10.
850
+ * // The first arrow is green for values greater than 20.
851
+ * // The second arrow is yellow for values greater than 10.
852
+ * // The third arrow is red for values less than or equal to 10.
853
+ * const fRange = fWorksheet.getRange('A1:D10');
854
+ * const builder = fWorksheet.newConditionalFormattingRule();
855
+ * console.log(builder.getIconMap()); // icons key-value map
856
+ * const rule = builder.setIconSet({
857
+ * iconConfigs: [
858
+ * { iconType: '3Arrows', iconId: '0', operator: univerAPI.Enum.ConditionFormatNumberOperatorEnum.greaterThan, value: { type: 'num', value: 20 } },
859
+ * { iconType: '3Arrows', iconId: '1', operator: univerAPI.Enum.ConditionFormatNumberOperatorEnum.greaterThan, value: { type: 'num', value: 10 } },
860
+ * { iconType: '3Arrows', iconId: '2', operator: univerAPI.Enum.ConditionFormatNumberOperatorEnum.lessThanOrEqual, value: { type: 'num', value: 10 } }
861
+ * ],
862
+ * isShowValue: true,
863
+ * })
864
+ * .setRanges([fRange.getRange()])
865
+ * .build();
866
+ * fWorksheet.addConditionalFormattingRule(rule);
867
+ * ```
868
+ */
869
+ setIconSet(config: {
870
+ iconConfigs: IIconSet['config'];
871
+ isShowValue: boolean;
872
+ }): ConditionalFormatIconSetRuleBuilder;
873
+ }
874
+ /**
875
+ * @hideconstructor
876
+ */
877
+ export declare class FConditionalFormattingBuilder {
878
+ private _initConfig;
879
+ constructor(_initConfig?: {
880
+ ranges?: IRange[];
881
+ });
882
+ /**
883
+ * Constructs a conditional format rule from the settings applied to the builder.
884
+ * @returns {IConditionFormattingRule} The conditional format rule.
885
+ * @example
886
+ * ```typescript
887
+ * const fWorkbook = univerAPI.getActiveWorkbook();
888
+ * const fWorksheet = fWorkbook.getActiveSheet();
889
+ *
890
+ * // Create a conditional formatting rule that highlights cells with values greater than 10 in red for the range A1:D10.
891
+ * const fRange = fWorksheet.getRange('A1:D10');
892
+ * const rule = fWorksheet.newConditionalFormattingRule()
893
+ * .whenNumberGreaterThan(10)
894
+ * .setBackground('#FF0000')
895
+ * .setRanges([fRange.getRange()])
896
+ * .build();
897
+ * fWorksheet.addConditionalFormattingRule(rule);
898
+ * ```
899
+ */
900
+ build(): IConditionFormattingRule;
901
+ /**
902
+ * Set average rule.
903
+ * @param {IAverageHighlightCell['operator']} operator - The operator to use for the average rule.
904
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
905
+ * @example
906
+ * ```typescript
907
+ * const fWorkbook = univerAPI.getActiveWorkbook();
908
+ * const fWorksheet = fWorkbook.getActiveSheet();
909
+ *
910
+ * // Create a conditional formatting rule that highlights cells with greater than average values in red for the range A1:D10.
911
+ * const fRange = fWorksheet.getRange('A1:D10');
912
+ * const rule = fWorksheet.newConditionalFormattingRule()
913
+ * .setAverage(univerAPI.Enum.ConditionFormatNumberOperatorEnum.greaterThan)
914
+ * .setBackground('#FF0000')
915
+ * .setRanges([fRange.getRange()])
916
+ * .build();
917
+ * fWorksheet.addConditionalFormattingRule(rule);
918
+ * ```
919
+ */
920
+ setAverage(operator: IAverageHighlightCell['operator']): ConditionalFormatHighlightRuleBuilder;
921
+ /**
922
+ * Set unique values rule.
923
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
924
+ * @example
925
+ * ```typescript
926
+ * const fWorkbook = univerAPI.getActiveWorkbook();
927
+ * const fWorksheet = fWorkbook.getActiveSheet();
928
+ *
929
+ * // Create a conditional formatting rule that highlights cells with unique values in red for the range A1:D10.
930
+ * const fRange = fWorksheet.getRange('A1:D10');
931
+ * const rule = fWorksheet.newConditionalFormattingRule()
932
+ * .setUniqueValues()
933
+ * .setBackground('#FF0000')
934
+ * .setRanges([fRange.getRange()])
935
+ * .build();
936
+ * fWorksheet.addConditionalFormattingRule(rule);
937
+ * ```
938
+ */
939
+ setUniqueValues(): ConditionalFormatHighlightRuleBuilder;
940
+ /**
941
+ * Set duplicate values rule.
942
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
943
+ * @example
944
+ * ```typescript
945
+ * const fWorkbook = univerAPI.getActiveWorkbook();
946
+ * const fWorksheet = fWorkbook.getActiveSheet();
947
+ *
948
+ * // Create a conditional formatting rule that highlights cells with duplicate values in red for the range A1:D10.
949
+ * const fRange = fWorksheet.getRange('A1:D10');
950
+ * const rule = fWorksheet.newConditionalFormattingRule()
951
+ * .setDuplicateValues()
952
+ * .setBackground('#FF0000')
953
+ * .setRanges([fRange.getRange()])
954
+ * .build();
955
+ * fWorksheet.addConditionalFormattingRule(rule);
956
+ * ```
957
+ */
958
+ setDuplicateValues(): ConditionalFormatHighlightRuleBuilder;
959
+ /**
960
+ * Set rank rule.
961
+ * @param {{ isBottom: boolean, isPercent: boolean, value: number }} config - The rank rule settings.
962
+ * @param {boolean} config.isBottom - Whether to highlight the bottom rank.
963
+ * @param {boolean} config.isPercent - Whether to use a percentage rank.
964
+ * @param {number} config.value - The rank value.
965
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
966
+ * @example
967
+ * ```typescript
968
+ * const fWorkbook = univerAPI.getActiveWorkbook();
969
+ * const fWorksheet = fWorkbook.getActiveSheet();
970
+ *
971
+ * // Create a conditional formatting rule that highlights the bottom 10% of values in red for the range A1:D10.
972
+ * const fRange = fWorksheet.getRange('A1:D10');
973
+ * const rule = fWorksheet.newConditionalFormattingRule()
974
+ * .setRank({ isBottom: true, isPercent: true, value: 10 })
975
+ * .setBackground('#FF0000')
976
+ * .setRanges([fRange.getRange()])
977
+ * .build();
978
+ * fWorksheet.addConditionalFormattingRule(rule);
979
+ * ```
980
+ */
981
+ setRank(config: {
982
+ isBottom: boolean;
983
+ isPercent: boolean;
984
+ value: number;
985
+ }): ConditionalFormatHighlightRuleBuilder;
986
+ /**
987
+ * Get the icon set mapping dictionary.
988
+ * @returns {Record<string, string[]>} The icon set mapping dictionary.
989
+ * @example
990
+ * ```typescript
991
+ * const fWorkbook = univerAPI.getActiveWorkbook();
992
+ * const fWorksheet = fWorkbook.getActiveSheet();
993
+ * console.log(fWorksheet.newConditionalFormattingRule().getIconMap()); // icons key-value map
994
+ * ```
995
+ */
996
+ getIconMap(): Record<string, string[]>;
997
+ /**
998
+ * Set up icon set conditional formatting rule.
999
+ * @param {{ iconConfigs: IIconSet['config'], isShowValue: boolean }} config - The icon set conditional formatting rule settings.
1000
+ * @param {IIconSet['config']} config.iconConfigs - The icon configurations. iconId property is a string indexing of a group icons.
1001
+ * @param {boolean} config.isShowValue - Whether to show the value in the cell.
1002
+ * @returns {ConditionalFormatIconSetRuleBuilder} The conditional format icon set rule builder.
1003
+ * @example
1004
+ * ```typescript
1005
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1006
+ * const fWorksheet = fWorkbook.getActiveSheet();
1007
+ *
1008
+ * // Create a 3-arrow icon set conditional formatting rule in the range A1:D10.
1009
+ * // The first arrow is green for values greater than 20.
1010
+ * // The second arrow is yellow for values greater than 10.
1011
+ * // The third arrow is red for values less than or equal to 10.
1012
+ * const fRange = fWorksheet.getRange('A1:D10');
1013
+ * const builder = fWorksheet.newConditionalFormattingRule();
1014
+ * console.log(builder.getIconMap()); // icons key-value map
1015
+ * const rule = builder.setIconSet({
1016
+ * iconConfigs: [
1017
+ * { iconType: '3Arrows', iconId: '0', operator: univerAPI.Enum.ConditionFormatNumberOperatorEnum.greaterThan, value: { type: 'num', value: 20 } },
1018
+ * { iconType: '3Arrows', iconId: '1', operator: univerAPI.Enum.ConditionFormatNumberOperatorEnum.greaterThan, value: { type: 'num', value: 10 } },
1019
+ * { iconType: '3Arrows', iconId: '2', operator: univerAPI.Enum.ConditionFormatNumberOperatorEnum.lessThanOrEqual, value: { type: 'num', value: 10 } }
1020
+ * ],
1021
+ * isShowValue: true,
1022
+ * })
1023
+ * .setRanges([fRange.getRange()])
1024
+ * .build();
1025
+ * fWorksheet.addConditionalFormattingRule(rule);
1026
+ * ```
1027
+ */
1028
+ setIconSet(config: {
1029
+ iconConfigs: IIconSet['config'];
1030
+ isShowValue: boolean;
1031
+ }): ConditionalFormatIconSetRuleBuilder;
1032
+ /**
1033
+ * Set color scale rule.
1034
+ * @param {{ index: number; color: string; value: IValueConfig }[]} config - The color scale rule settings.
1035
+ * @param {number} config.index - The index of the color scale.
1036
+ * @param {string} config.color - The color for the color scale.
1037
+ * @param {IValueConfig} config.value - The value for the color scale.
1038
+ * @returns {ConditionalFormatColorScaleRuleBuilder} The conditional format color scale rule builder.
1039
+ * @example
1040
+ * ```typescript
1041
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1042
+ * const fWorksheet = fWorkbook.getActiveSheet();
1043
+ *
1044
+ * // Create a conditional formatting rule that adds a color scale to cells with values between 0 and 100 in the range A1:D10.
1045
+ * // The color scale is green for 0, yellow for 50, and red for 100.
1046
+ * const fRange = fWorksheet.getRange('A1:D10');
1047
+ * const rule = fWorksheet.newConditionalFormattingRule()
1048
+ * .setColorScale([
1049
+ * { index: 0, color: '#00FF00', value: { type: 'num', value: 0 } },
1050
+ * { index: 1, color: '#FFFF00', value: { type: 'num', value: 50 } },
1051
+ * { index: 2, color: '#FF0000', value: { type: 'num', value: 100 } }
1052
+ * ])
1053
+ * .setRanges([fRange.getRange()])
1054
+ * .build();
1055
+ * fWorksheet.addConditionalFormattingRule(rule);
1056
+ * ```
1057
+ */
1058
+ setColorScale(config: IColorScale['config']): ConditionalFormatColorScaleRuleBuilder;
1059
+ /**
1060
+ * Set data bar rule.
1061
+ * @param {{
1062
+ * min: IValueConfig;
1063
+ * max: IValueConfig;
1064
+ * isGradient?: boolean;
1065
+ * positiveColor: string;
1066
+ * nativeColor: string;
1067
+ * isShowValue?: boolean;
1068
+ * }} config - The data bar rule settings.
1069
+ * @param {IValueConfig} config.min - The minimum value for the data bar.
1070
+ * @param {IValueConfig} config.max - The maximum value for the data bar.
1071
+ * @param {boolean} [config.isGradient] - Whether the data bar is gradient.
1072
+ * @param {string} config.positiveColor - The color for positive values.
1073
+ * @param {string} config.nativeColor - The color for negative values.
1074
+ * @param {boolean} [config.isShowValue] - Whether to show the value in the cell.
1075
+ * @returns {ConditionalFormatDataBarRuleBuilder} The conditional format data bar rule builder.
1076
+ * @example
1077
+ * ```typescript
1078
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1079
+ * const fWorksheet = fWorkbook.getActiveSheet();
1080
+ *
1081
+ * // Create a conditional formatting rule that adds a data bar to cells with values between -100 and 100 in the range A1:D10.
1082
+ * // positive values are green and negative values are red.
1083
+ * const fRange = fWorksheet.getRange('A1:D10');
1084
+ * const rule = fWorksheet.newConditionalFormattingRule()
1085
+ * .setDataBar({
1086
+ * min: { type: 'num', value: -100 },
1087
+ * max: { type: 'num', value: 100 },
1088
+ * positiveColor: '#00FF00',
1089
+ * nativeColor: '#FF0000',
1090
+ * isShowValue: true
1091
+ * })
1092
+ * .setRanges([fRange.getRange()])
1093
+ * .build();
1094
+ * fWorksheet.addConditionalFormattingRule(rule);
1095
+ * ```
1096
+ */
1097
+ setDataBar(config: {
1098
+ min: IValueConfig;
1099
+ max: IValueConfig;
1100
+ isGradient?: boolean;
1101
+ positiveColor: string;
1102
+ nativeColor: string;
1103
+ isShowValue?: boolean;
1104
+ }): ConditionalFormatDataBarRuleBuilder;
1105
+ /**
1106
+ * Sets the background color for the conditional format rule's format.
1107
+ * @param {string} [color] - The background color to set. If not provided, the background color is removed.
1108
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1109
+ * @example
1110
+ * ```typescript
1111
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1112
+ * const fWorksheet = fWorkbook.getActiveSheet();
1113
+ *
1114
+ * // Create a conditional formatting rule that highlights cells with no content in red for the range A1:D10.
1115
+ * const fRange = fWorksheet.getRange('A1:D10');
1116
+ * const rule = fWorksheet.newConditionalFormattingRule()
1117
+ * .whenCellEmpty()
1118
+ * .setBackground('#FF0000')
1119
+ * .setRanges([fRange.getRange()])
1120
+ * .build();
1121
+ * fWorksheet.addConditionalFormattingRule(rule);
1122
+ * ```
1123
+ */
1124
+ setBackground(color?: string): ConditionalFormatHighlightRuleBuilder;
1125
+ /**
1126
+ * Sets text bolding for the conditional format rule's format.
1127
+ * @param {boolean} isBold - Whether to bold the text.
1128
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1129
+ * @example
1130
+ * ```typescript
1131
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1132
+ * const fWorksheet = fWorkbook.getActiveSheet();
1133
+ *
1134
+ * // Create a conditional formatting rule that bolds the text for cells with not empty content in the range A1:D10.
1135
+ * const fRange = fWorksheet.getRange('A1:D10');
1136
+ * const rule = fWorksheet.newConditionalFormattingRule()
1137
+ * .whenCellNotEmpty()
1138
+ * .setBold(true)
1139
+ * .setRanges([fRange.getRange()])
1140
+ * .build();
1141
+ * fWorksheet.addConditionalFormattingRule(rule);
1142
+ * ```
1143
+ */
1144
+ setBold(isBold: boolean): ConditionalFormatHighlightRuleBuilder;
1145
+ /**
1146
+ * Sets the font color for the conditional format rule's format.
1147
+ * @param {string} [color] - The font color to set. If not provided, the font color is removed.
1148
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1149
+ * @example
1150
+ * ```typescript
1151
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1152
+ * const fWorksheet = fWorkbook.getActiveSheet();
1153
+ *
1154
+ * // Create a conditional formatting rule that changes the font color to red for cells with not empty content in the range A1:D10.
1155
+ * const fRange = fWorksheet.getRange('A1:D10');
1156
+ * const rule = fWorksheet.newConditionalFormattingRule()
1157
+ * .whenCellNotEmpty()
1158
+ * .setFontColor('#FF0000')
1159
+ * .setRanges([fRange.getRange()])
1160
+ * .build();
1161
+ * fWorksheet.addConditionalFormattingRule(rule);
1162
+ * ```
1163
+ */
1164
+ setFontColor(color?: string): ConditionalFormatHighlightRuleBuilder;
1165
+ /**
1166
+ * Sets text italics for the conditional format rule's format.
1167
+ * @param {boolean} isItalic - Whether to italicize the text.
1168
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1169
+ * @example
1170
+ * ```typescript
1171
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1172
+ * const fWorksheet = fWorkbook.getActiveSheet();
1173
+ *
1174
+ * // Create a conditional formatting rule that italicizes the text for cells with not empty content in the range A1:D10.
1175
+ * const fRange = fWorksheet.getRange('A1:D10');
1176
+ * const rule = fWorksheet.newConditionalFormattingRule()
1177
+ * .whenCellNotEmpty()
1178
+ * .setItalic(true)
1179
+ * .setRanges([fRange.getRange()])
1180
+ * .build();
1181
+ * fWorksheet.addConditionalFormattingRule(rule);
1182
+ * ```
1183
+ */
1184
+ setItalic(isItalic: boolean): ConditionalFormatHighlightRuleBuilder;
1185
+ /**
1186
+ * Sets text strikethrough for the conditional format rule's format.
1187
+ * @param {boolean} isStrikethrough - Whether is strikethrough the text.
1188
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1189
+ * @example
1190
+ * ```typescript
1191
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1192
+ * const fWorksheet = fWorkbook.getActiveSheet();
1193
+ *
1194
+ * // Create a conditional formatting rule that set text strikethrough for cells with not empty content in the range A1:D10.
1195
+ * const fRange = fWorksheet.getRange('A1:D10');
1196
+ * const rule = fWorksheet.newConditionalFormattingRule()
1197
+ * .whenCellNotEmpty()
1198
+ * .setStrikethrough(true)
1199
+ * .setRanges([fRange.getRange()])
1200
+ * .build();
1201
+ * fWorksheet.addConditionalFormattingRule(rule);
1202
+ * ```
1203
+ */
1204
+ setStrikethrough(isStrikethrough: boolean): ConditionalFormatHighlightRuleBuilder;
1205
+ /**
1206
+ * Sets text underlining for the conditional format rule's format.
1207
+ * @param {boolean} isUnderline - Whether to underline the text.
1208
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1209
+ * @example
1210
+ * ```typescript
1211
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1212
+ * const fWorksheet = fWorkbook.getActiveSheet();
1213
+ *
1214
+ * // Create a conditional formatting rule that underlines the text for cells with not empty content in the range A1:D10.
1215
+ * const fRange = fWorksheet.getRange('A1:D10');
1216
+ * const rule = fWorksheet.newConditionalFormattingRule()
1217
+ * .whenCellNotEmpty()
1218
+ * .setUnderline(true)
1219
+ * .setRanges([fRange.getRange()])
1220
+ * .build();
1221
+ * fWorksheet.addConditionalFormattingRule(rule);
1222
+ * ```
1223
+ */
1224
+ setUnderline(isUnderline: boolean): ConditionalFormatHighlightRuleBuilder;
1225
+ /**
1226
+ * Sets the conditional format rule to trigger when the cell is empty.
1227
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1228
+ * @example
1229
+ * ```typescript
1230
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1231
+ * const fWorksheet = fWorkbook.getActiveSheet();
1232
+ *
1233
+ * // Create a conditional formatting rule that highlights cells with no content in red for the range A1:D10.
1234
+ * const fRange = fWorksheet.getRange('A1:D10');
1235
+ * const rule = fWorksheet.newConditionalFormattingRule()
1236
+ * .whenCellEmpty()
1237
+ * .setBackground('#FF0000')
1238
+ * .setRanges([fRange.getRange()])
1239
+ * .build();
1240
+ * fWorksheet.addConditionalFormattingRule(rule);
1241
+ * ```
1242
+ */
1243
+ whenCellEmpty(): ConditionalFormatHighlightRuleBuilder;
1244
+ /**
1245
+ * Sets the conditional format rule to trigger when the cell is not empty.
1246
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1247
+ * @example
1248
+ * ```typescript
1249
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1250
+ * const fWorksheet = fWorkbook.getActiveSheet();
1251
+ *
1252
+ * // Create a conditional formatting rule that changes the font color to red for cells with not empty content in the range A1:D10.
1253
+ * const fRange = fWorksheet.getRange('A1:D10');
1254
+ * const rule = fWorksheet.newConditionalFormattingRule()
1255
+ * .whenCellNotEmpty()
1256
+ * .setFontColor('#FF0000')
1257
+ * .setRanges([fRange.getRange()])
1258
+ * .build();
1259
+ * fWorksheet.addConditionalFormattingRule(rule);
1260
+ * ```
1261
+ */
1262
+ whenCellNotEmpty(): ConditionalFormatHighlightRuleBuilder;
1263
+ /**
1264
+ * Sets the conditional format rule to trigger when a time period is met.
1265
+ * @param {CFTimePeriodOperator} date - The time period to check for.
1266
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1267
+ * @example
1268
+ * ```typescript
1269
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1270
+ * const fWorksheet = fWorkbook.getActiveSheet();
1271
+ *
1272
+ * // Create a conditional formatting rule that highlights cells with dates in the last 7 days in red for the range A1:D10.
1273
+ * const fRange = fWorksheet.getRange('A1:D10');
1274
+ * const rule = fWorksheet.newConditionalFormattingRule()
1275
+ * .whenDate(univerAPI.Enum.ConditionFormatTimePeriodOperatorEnum.last7Days)
1276
+ * .setBackground('#FF0000')
1277
+ * .setRanges([fRange.getRange()])
1278
+ * .build();
1279
+ * fWorksheet.addConditionalFormattingRule(rule);
1280
+ * ```
1281
+ */
1282
+ whenDate(date: CFTimePeriodOperator): ConditionalFormatHighlightRuleBuilder;
1283
+ /**
1284
+ * Sets the conditional format rule to trigger when that the given formula evaluates to `true`.
1285
+ * @param {string} formulaString - A custom formula that evaluates to true if the input is valid. formulaString start with '='.
1286
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1287
+ * @example
1288
+ * ```typescript
1289
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1290
+ * const fWorksheet = fWorkbook.getActiveSheet();
1291
+ *
1292
+ * // Create a conditional formatting rule that highlights cells with values greater than 10 in red for the range A1:D10.
1293
+ * const fRange = fWorksheet.getRange('A1:D10');
1294
+ * const rule = fWorksheet.newConditionalFormattingRule()
1295
+ * .whenFormulaSatisfied('=A1>10')
1296
+ * .setBackground('#FF0000')
1297
+ * .setRanges([fRange.getRange()])
1298
+ * .build();
1299
+ * fWorksheet.addConditionalFormattingRule(rule);
1300
+ * ```
1301
+ */
1302
+ whenFormulaSatisfied(formulaString: string): ConditionalFormatHighlightRuleBuilder;
1303
+ /**
1304
+ * Sets the conditional format rule to trigger when a number falls between, or is either of, two specified values.
1305
+ * @param {number} start - The lowest acceptable value.
1306
+ * @param {number} end - The highest acceptable value.
1307
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1308
+ * @example
1309
+ * ```typescript
1310
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1311
+ * const fWorksheet = fWorkbook.getActiveSheet();
1312
+ *
1313
+ * // Create a conditional formatting rule that highlights cells with values between 10 and 20 in red for the range A1:D10.
1314
+ * const fRange = fWorksheet.getRange('A1:D10');
1315
+ * const rule = fWorksheet.newConditionalFormattingRule()
1316
+ * .whenNumberBetween(10, 20)
1317
+ * .setBackground('#FF0000')
1318
+ * .setRanges([fRange.getRange()])
1319
+ * .build();
1320
+ * fWorksheet.addConditionalFormattingRule(rule);
1321
+ * ```
1322
+ */
1323
+ whenNumberBetween(start: number, end: number): ConditionalFormatHighlightRuleBuilder;
1324
+ /**
1325
+ * Sets the conditional format rule to trigger when a number is equal to the given value.
1326
+ * @param {number} value - The sole acceptable value.
1327
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1328
+ * @example
1329
+ * ```typescript
1330
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1331
+ * const fWorksheet = fWorkbook.getActiveSheet();
1332
+ *
1333
+ * // Create a conditional formatting rule that highlights cells with values equal to 10 in red for the range A1:D10.
1334
+ * const fRange = fWorksheet.getRange('A1:D10');
1335
+ * const rule = fWorksheet.newConditionalFormattingRule()
1336
+ * .whenNumberEqualTo(10)
1337
+ * .setBackground('#FF0000')
1338
+ * .setRanges([fRange.getRange()])
1339
+ * .build();
1340
+ * fWorksheet.addConditionalFormattingRule(rule);
1341
+ * ```
1342
+ */
1343
+ whenNumberEqualTo(value: number): ConditionalFormatHighlightRuleBuilder;
1344
+ /**
1345
+ * Sets the conditional format rule to trigger when a number is greater than the given value.
1346
+ * @param {number} value - The highest unacceptable value.
1347
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1348
+ * @example
1349
+ * ```typescript
1350
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1351
+ * const fWorksheet = fWorkbook.getActiveSheet();
1352
+ *
1353
+ * // Create a conditional formatting rule that highlights cells with values greater than 10 in red for the range A1:D10.
1354
+ * const fRange = fWorksheet.getRange('A1:D10');
1355
+ * const rule = fWorksheet.newConditionalFormattingRule()
1356
+ * .whenNumberGreaterThan(10)
1357
+ * .setBackground('#FF0000')
1358
+ * .setRanges([fRange.getRange()])
1359
+ * .build();
1360
+ * fWorksheet.addConditionalFormattingRule(rule);
1361
+ * ```
1362
+ */
1363
+ whenNumberGreaterThan(value: number): ConditionalFormatHighlightRuleBuilder;
1364
+ /**
1365
+ * Sets the conditional format rule to trigger when a number is greater than or equal to the given value.
1366
+ * @param {number} value - The lowest acceptable value.
1367
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1368
+ * @example
1369
+ * ```typescript
1370
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1371
+ * const fWorksheet = fWorkbook.getActiveSheet();
1372
+ *
1373
+ * // Create a conditional formatting rule that highlights cells with values greater than or equal to 10 in red for the range A1:D10.
1374
+ * const fRange = fWorksheet.getRange('A1:D10');
1375
+ * const rule = fWorksheet.newConditionalFormattingRule()
1376
+ * .whenNumberGreaterThanOrEqualTo(10)
1377
+ * .setBackground('#FF0000')
1378
+ * .setRanges([fRange.getRange()])
1379
+ * .build();
1380
+ * fWorksheet.addConditionalFormattingRule(rule);
1381
+ * ```
1382
+ */
1383
+ whenNumberGreaterThanOrEqualTo(value: number): ConditionalFormatHighlightRuleBuilder;
1384
+ /**
1385
+ * Sets the conditional conditional format rule to trigger when a number less than the given value.
1386
+ * @param {number} value - The lowest unacceptable value.
1387
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1388
+ * @example
1389
+ * ```typescript
1390
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1391
+ * const fWorksheet = fWorkbook.getActiveSheet();
1392
+ *
1393
+ * // Create a conditional formatting rule that highlights cells with values less than 10 in red for the range A1:D10.
1394
+ * const fRange = fWorksheet.getRange('A1:D10');
1395
+ * const rule = fWorksheet.newConditionalFormattingRule()
1396
+ * .whenNumberLessThan(10)
1397
+ * .setBackground('#FF0000')
1398
+ * .setRanges([fRange.getRange()])
1399
+ * .build();
1400
+ * fWorksheet.addConditionalFormattingRule(rule);
1401
+ * ```
1402
+ */
1403
+ whenNumberLessThan(value: number): ConditionalFormatHighlightRuleBuilder;
1404
+ /**
1405
+ * Sets the conditional format rule to trigger when a number less than or equal to the given value.
1406
+ * @param {number} value - The highest acceptable value.
1407
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1408
+ * @example
1409
+ * ```typescript
1410
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1411
+ * const fWorksheet = fWorkbook.getActiveSheet();
1412
+ *
1413
+ * // Create a conditional formatting rule that highlights cells with values less than or equal to 10 in red for the range A1:D10.
1414
+ * const fRange = fWorksheet.getRange('A1:D10');
1415
+ * const rule = fWorksheet.newConditionalFormattingRule()
1416
+ * .whenNumberLessThanOrEqualTo(10)
1417
+ * .setBackground('#FF0000')
1418
+ * .setRanges([fRange.getRange()])
1419
+ * .build();
1420
+ * fWorksheet.addConditionalFormattingRule(rule);
1421
+ * ```
1422
+ */
1423
+ whenNumberLessThanOrEqualTo(value: number): ConditionalFormatHighlightRuleBuilder;
1424
+ /**
1425
+ * Sets the conditional format rule to trigger when a number does not fall between, and is neither of, two specified values.
1426
+ * @param {number} start - The lowest unacceptable value.
1427
+ * @param {number} end - The highest unacceptable value.
1428
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1429
+ * @example
1430
+ * ```typescript
1431
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1432
+ * const fWorksheet = fWorkbook.getActiveSheet();
1433
+ *
1434
+ * // Create a conditional formatting rule that highlights cells with values not between 10 and 20 in red for the range A1:D10.
1435
+ * const fRange = fWorksheet.getRange('A1:D10');
1436
+ * const rule = fWorksheet.newConditionalFormattingRule()
1437
+ * .whenNumberNotBetween(10, 20)
1438
+ * .setBackground('#FF0000')
1439
+ * .setRanges([fRange.getRange()])
1440
+ * .build();
1441
+ * fWorksheet.addConditionalFormattingRule(rule);
1442
+ * ```
1443
+ */
1444
+ whenNumberNotBetween(start: number, end: number): ConditionalFormatHighlightRuleBuilder;
1445
+ /**
1446
+ * Sets the conditional format rule to trigger when a number is not equal to the given value.
1447
+ * @param {number} value - The sole unacceptable value.
1448
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1449
+ * @example
1450
+ * ```typescript
1451
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1452
+ * const fWorksheet = fWorkbook.getActiveSheet();
1453
+ *
1454
+ * // Create a conditional formatting rule that highlights cells with values not equal to 10 in red for the range A1:D10.
1455
+ * const fRange = fWorksheet.getRange('A1:D10');
1456
+ * const rule = fWorksheet.newConditionalFormattingRule()
1457
+ * .whenNumberNotEqualTo(10)
1458
+ * .setBackground('#FF0000')
1459
+ * .setRanges([fRange.getRange()])
1460
+ * .build();
1461
+ * fWorksheet.addConditionalFormattingRule(rule);
1462
+ * ```
1463
+ */
1464
+ whenNumberNotEqualTo(value: number): ConditionalFormatHighlightRuleBuilder;
1465
+ /**
1466
+ * Sets the conditional format rule to trigger when that the input contains the given value.
1467
+ * @param {string} text - The value that the input must contain.
1468
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1469
+ * @example
1470
+ * ```typescript
1471
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1472
+ * const fWorksheet = fWorkbook.getActiveSheet();
1473
+ *
1474
+ * // Create a conditional formatting rule that highlights cells with text containing 'apple' in red for the range A1:D10.
1475
+ * const fRange = fWorksheet.getRange('A1:D10');
1476
+ * const rule = fWorksheet.newConditionalFormattingRule()
1477
+ * .whenTextContains('apple')
1478
+ * .setBackground('#FF0000')
1479
+ * .setRanges([fRange.getRange()])
1480
+ * .build();
1481
+ * fWorksheet.addConditionalFormattingRule(rule);
1482
+ * ```
1483
+ */
1484
+ whenTextContains(text: string): ConditionalFormatHighlightRuleBuilder;
1485
+ /**
1486
+ * Sets the conditional format rule to trigger when that the input does not contain the given value.
1487
+ * @param {string} text - The value that the input must not contain.
1488
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1489
+ * @example
1490
+ * ```typescript
1491
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1492
+ * const fWorksheet = fWorkbook.getActiveSheet();
1493
+ *
1494
+ * // Create a conditional formatting rule that highlights cells with text not containing 'apple' in red for the range A1:D10.
1495
+ * const fRange = fWorksheet.getRange('A1:D10');
1496
+ * const rule = fWorksheet.newConditionalFormattingRule()
1497
+ * .whenTextDoesNotContain('apple')
1498
+ * .setBackground('#FF0000')
1499
+ * .setRanges([fRange.getRange()])
1500
+ * .build();
1501
+ * fWorksheet.addConditionalFormattingRule(rule);
1502
+ * ```
1503
+ */
1504
+ whenTextDoesNotContain(text: string): ConditionalFormatHighlightRuleBuilder;
1505
+ /**
1506
+ * Sets the conditional format rule to trigger when that the input ends with the given value.
1507
+ * @param {string} text - Text to compare against the end of the string.
1508
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1509
+ * @example
1510
+ * ```typescript
1511
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1512
+ * const fWorksheet = fWorkbook.getActiveSheet();
1513
+ *
1514
+ * // Create a conditional formatting rule that highlights cells with text ending with '.ai' in red for the range A1:D10.
1515
+ * const fRange = fWorksheet.getRange('A1:D10');
1516
+ * const rule = fWorksheet.newConditionalFormattingRule()
1517
+ * .whenTextEndsWith('.ai')
1518
+ * .setBackground('#FF0000')
1519
+ * .setRanges([fRange.getRange()])
1520
+ * .build();
1521
+ * fWorksheet.addConditionalFormattingRule(rule);
1522
+ * ```
1523
+ */
1524
+ whenTextEndsWith(text: string): ConditionalFormatHighlightRuleBuilder;
1525
+ /**
1526
+ * Sets the conditional format rule to trigger when that the input is equal to the given value.
1527
+ * @param {string} text - The sole acceptable value.
1528
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1529
+ * @example
1530
+ * ```typescript
1531
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1532
+ * const fWorksheet = fWorkbook.getActiveSheet();
1533
+ *
1534
+ * // Create a conditional formatting rule that highlights cells with text equal to 'apple' in red for the range A1:D10.
1535
+ * const fRange = fWorksheet.getRange('A1:D10');
1536
+ * const rule = fWorksheet.newConditionalFormattingRule()
1537
+ * .whenTextEqualTo('apple')
1538
+ * .setBackground('#FF0000')
1539
+ * .setRanges([fRange.getRange()])
1540
+ * .build();
1541
+ * fWorksheet.addConditionalFormattingRule(rule);
1542
+ * ```
1543
+ */
1544
+ whenTextEqualTo(text: string): ConditionalFormatHighlightRuleBuilder;
1545
+ /**
1546
+ * Sets the conditional format rule to trigger when that the input starts with the given value.
1547
+ * @param {string} text - Text to compare against the beginning of the string.
1548
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1549
+ * @example
1550
+ * ```typescript
1551
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1552
+ * const fWorksheet = fWorkbook.getActiveSheet();
1553
+ *
1554
+ * // Create a conditional formatting rule that highlights cells with text starting with 'https://' in red for the range A1:D10.
1555
+ * const fRange = fWorksheet.getRange('A1:D10');
1556
+ * const rule = fWorksheet.newConditionalFormattingRule()
1557
+ * .whenTextStartsWith('https://')
1558
+ * .setBackground('#FF0000')
1559
+ * .setRanges([fRange.getRange()])
1560
+ * .build();
1561
+ * fWorksheet.addConditionalFormattingRule(rule);
1562
+ * ```
1563
+ */
1564
+ whenTextStartsWith(text: string): ConditionalFormatHighlightRuleBuilder;
1565
+ }
1566
+ export {};