aspose-cells-foss 25.12.1__py3-none-any.whl → 26.2.2__py3-none-any.whl

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.
Files changed (93) hide show
  1. aspose_cells/__init__.py +88 -0
  2. aspose_cells/auto_filter.py +527 -0
  3. aspose_cells/cell.py +483 -0
  4. aspose_cells/cell_value_handler.py +319 -0
  5. aspose_cells/cells.py +779 -0
  6. aspose_cells/cfb_handler.py +445 -0
  7. aspose_cells/cfb_writer.py +659 -0
  8. aspose_cells/cfb_writer_minimal.py +337 -0
  9. aspose_cells/comment_xml.py +475 -0
  10. aspose_cells/conditional_format.py +1185 -0
  11. aspose_cells/csv_handler.py +690 -0
  12. aspose_cells/data_validation.py +911 -0
  13. aspose_cells/document_properties.py +356 -0
  14. aspose_cells/encryption_crypto.py +247 -0
  15. aspose_cells/encryption_params.py +138 -0
  16. aspose_cells/hyperlink.py +372 -0
  17. aspose_cells/json_handler.py +185 -0
  18. aspose_cells/markdown_handler.py +583 -0
  19. aspose_cells/shared_strings.py +101 -0
  20. aspose_cells/style.py +841 -0
  21. aspose_cells/workbook.py +499 -0
  22. aspose_cells/workbook_hash_password.py +68 -0
  23. aspose_cells/workbook_properties.py +712 -0
  24. aspose_cells/worksheet.py +570 -0
  25. aspose_cells/worksheet_properties.py +1239 -0
  26. aspose_cells/xlsx_encryptor.py +403 -0
  27. aspose_cells/xml_autofilter_loader.py +195 -0
  28. aspose_cells/xml_autofilter_saver.py +173 -0
  29. aspose_cells/xml_conditional_format_loader.py +215 -0
  30. aspose_cells/xml_conditional_format_saver.py +351 -0
  31. aspose_cells/xml_datavalidation_loader.py +239 -0
  32. aspose_cells/xml_datavalidation_saver.py +245 -0
  33. aspose_cells/xml_hyperlink_handler.py +323 -0
  34. aspose_cells/xml_loader.py +986 -0
  35. aspose_cells/xml_properties_loader.py +512 -0
  36. aspose_cells/xml_properties_saver.py +607 -0
  37. aspose_cells/xml_saver.py +1306 -0
  38. aspose_cells_foss-26.2.2.dist-info/METADATA +190 -0
  39. aspose_cells_foss-26.2.2.dist-info/RECORD +41 -0
  40. {aspose_cells_foss-25.12.1.dist-info → aspose_cells_foss-26.2.2.dist-info}/WHEEL +1 -1
  41. aspose_cells_foss-26.2.2.dist-info/top_level.txt +1 -0
  42. aspose/__init__.py +0 -14
  43. aspose/cells/__init__.py +0 -31
  44. aspose/cells/cell.py +0 -350
  45. aspose/cells/constants.py +0 -44
  46. aspose/cells/converters/__init__.py +0 -13
  47. aspose/cells/converters/csv_converter.py +0 -55
  48. aspose/cells/converters/json_converter.py +0 -46
  49. aspose/cells/converters/markdown_converter.py +0 -453
  50. aspose/cells/drawing/__init__.py +0 -17
  51. aspose/cells/drawing/anchor.py +0 -172
  52. aspose/cells/drawing/collection.py +0 -233
  53. aspose/cells/drawing/image.py +0 -338
  54. aspose/cells/formats.py +0 -80
  55. aspose/cells/formula/__init__.py +0 -10
  56. aspose/cells/formula/evaluator.py +0 -360
  57. aspose/cells/formula/functions.py +0 -433
  58. aspose/cells/formula/tokenizer.py +0 -340
  59. aspose/cells/io/__init__.py +0 -27
  60. aspose/cells/io/csv/__init__.py +0 -8
  61. aspose/cells/io/csv/reader.py +0 -88
  62. aspose/cells/io/csv/writer.py +0 -98
  63. aspose/cells/io/factory.py +0 -138
  64. aspose/cells/io/interfaces.py +0 -48
  65. aspose/cells/io/json/__init__.py +0 -8
  66. aspose/cells/io/json/reader.py +0 -126
  67. aspose/cells/io/json/writer.py +0 -119
  68. aspose/cells/io/md/__init__.py +0 -8
  69. aspose/cells/io/md/reader.py +0 -161
  70. aspose/cells/io/md/writer.py +0 -334
  71. aspose/cells/io/models.py +0 -64
  72. aspose/cells/io/xlsx/__init__.py +0 -9
  73. aspose/cells/io/xlsx/constants.py +0 -312
  74. aspose/cells/io/xlsx/image_writer.py +0 -311
  75. aspose/cells/io/xlsx/reader.py +0 -284
  76. aspose/cells/io/xlsx/writer.py +0 -931
  77. aspose/cells/plugins/__init__.py +0 -6
  78. aspose/cells/plugins/docling_backend/__init__.py +0 -7
  79. aspose/cells/plugins/docling_backend/backend.py +0 -535
  80. aspose/cells/plugins/markitdown_plugin/__init__.py +0 -15
  81. aspose/cells/plugins/markitdown_plugin/plugin.py +0 -128
  82. aspose/cells/range.py +0 -210
  83. aspose/cells/style.py +0 -287
  84. aspose/cells/utils/__init__.py +0 -54
  85. aspose/cells/utils/coordinates.py +0 -68
  86. aspose/cells/utils/exceptions.py +0 -43
  87. aspose/cells/utils/validation.py +0 -102
  88. aspose/cells/workbook.py +0 -352
  89. aspose/cells/worksheet.py +0 -670
  90. aspose_cells_foss-25.12.1.dist-info/METADATA +0 -189
  91. aspose_cells_foss-25.12.1.dist-info/RECORD +0 -53
  92. aspose_cells_foss-25.12.1.dist-info/entry_points.txt +0 -2
  93. aspose_cells_foss-25.12.1.dist-info/top_level.txt +0 -1
@@ -0,0 +1,1185 @@
1
+ """
2
+ Aspose.Cells for Python - Conditional Format Module
3
+
4
+ This module provides ConditionalFormat and ConditionalFormatCollection classes which represent
5
+ conditional formatting rules in Excel worksheets.
6
+
7
+ Compatible with Aspose.Cells for .NET API structure and ECMA-376 specification.
8
+ """
9
+
10
+
11
+ class ConditionalFormat:
12
+ """
13
+ Represents a single conditional formatting rule applied to a cell range.
14
+
15
+ The ConditionalFormat class provides properties for defining conditional formatting rules
16
+ including cell value comparisons, text rules, date rules, duplicate/unique values,
17
+ top/bottom rules, above/below average, color scales, data bars, icon sets, and formula rules.
18
+
19
+ Examples:
20
+ >>> from aspose_cells import Workbook, ConditionalFormat
21
+ >>> wb = Workbook()
22
+ >>> ws = wb.worksheets[0]
23
+ >>> cf = ws.conditional_formats.add()
24
+ >>> cf.type = "cellValue"
25
+ >>> cf.operator = "greaterThan"
26
+ >>> cf.formula1 = 100
27
+ >>> cf.range = "A1:A10"
28
+ >>> cf.font.bold = True
29
+ >>> cf.font.color = "FFFF0000"
30
+ """
31
+
32
+ def __init__(self):
33
+ """
34
+ Initializes a new instance of ConditionalFormat class.
35
+
36
+ Creates a new conditional format with default values for all properties.
37
+ Rule-specific properties are initialized to None and should be set
38
+ based on the conditional format type.
39
+ """
40
+ # Common properties
41
+ self._type = None # Rule type (cellValue, text, date, duplicateValues, top10, aboveAverage, colorScale, dataBar, iconSet, formula)
42
+ self._range = None # Cell range in A1 notation (e.g., "A1:A10")
43
+ self._stop_if_true = False # Stops lower priority rules if this rule is true
44
+ self._priority = 1 # Rule priority (lower = higher priority)
45
+
46
+ # Rule-specific properties
47
+ self._operator = None # Comparison operator (for cellValue, text, date rules)
48
+ self._formula1 = None # First value/formula for comparison
49
+ self._formula2 = None # Second value/formula (for between operators)
50
+ self._duplicate = None # Boolean for duplicate/unique values
51
+ self._top = None # Boolean for top/bottom rules
52
+ self._percent = None # Boolean for percentage (top/bottom rules)
53
+ self._rank = None # Integer rank value (top/bottom rules)
54
+ self._above = None # Boolean for above/below average
55
+ self._std_dev = None # Integer standard deviations (above/below average)
56
+ self._color_scale_type = None # '2-color' or '3-color'
57
+ self._min_color = None # RGB hex for minimum value (color scales)
58
+ self._mid_color = None # RGB hex for midpoint (3-color scales)
59
+ self._max_color = None # RGB hex for maximum value (color scales)
60
+ self._bar_color = None # RGB hex for bar color (data bars)
61
+ self._negative_color = None # RGB hex for negative values (data bars)
62
+ self._show_border = False # Show border (data bars)
63
+ self._direction = None # 'left-to-right' or 'right-to-left' (data bars)
64
+ self._bar_length = None # 'auto' or fixed value (data bars)
65
+ self._icon_set_type = None # Icon set name (icon sets)
66
+ self._reverse_icons = False # Reverse icon order (icon sets)
67
+ self._show_icon_only = False # Show only icons (icon sets)
68
+ self._formula = None # Excel formula string (formula rules)
69
+
70
+ # Formatting properties (applied when condition is true)
71
+ from .style import Font, Fill, Border, Borders, Alignment, Protection
72
+ self._font = Font()
73
+ self._border = Border()
74
+ self._fill = Fill()
75
+ self._alignment = Alignment()
76
+ self._number_format = 'General'
77
+
78
+ # Common properties
79
+
80
+ @property
81
+ def type(self):
82
+ """
83
+ Gets or sets the conditional format type.
84
+
85
+ Returns:
86
+ str: Rule type (cellValue, text, date, duplicateValues, top10, aboveAverage, colorScale, dataBar, iconSet, formula).
87
+
88
+ Examples:
89
+ >>> cf.type = "cellValue"
90
+ >>> print(cf.type)
91
+ """
92
+ # Map internal XML type name to user-friendly type name
93
+ # Excel persists "cellIs" in XML, but users expect "cellValue"
94
+ if self._type == 'cellIs':
95
+ return 'cellValue'
96
+ return self._type
97
+
98
+ @type.setter
99
+ def type(self, value):
100
+ """
101
+ Sets the conditional format type.
102
+
103
+ Args:
104
+ value (str): Rule type.
105
+
106
+ Raises:
107
+ ValueError: If type is not a valid conditional format type.
108
+ """
109
+ valid_types = [
110
+ 'cellValue', 'cellIs', # cellIs is the XML name for cellValue
111
+ 'text', 'containsText', 'notContainsText', 'beginsWith', 'endsWith', # text rule variants
112
+ 'date', 'timePeriod', # timePeriod is the XML name for date rules
113
+ 'duplicateValues', 'uniqueValues',
114
+ 'top10', 'bottom10', 'aboveAverage', 'belowAverage',
115
+ 'colorScale', 'dataBar', 'iconSet', 'formula', 'expression' # expression is alias for formula
116
+ ]
117
+ if value in valid_types:
118
+ self._type = value
119
+ else:
120
+ raise ValueError(f"Invalid conditional format type: {value}. Valid types: {valid_types}")
121
+
122
+ @property
123
+ def range(self):
124
+ """
125
+ Gets or sets the cell range for the conditional format.
126
+
127
+ Returns:
128
+ str or None: Cell range in A1 notation (e.g., "A1:A10").
129
+
130
+ Examples:
131
+ >>> cf.range = "A1:A10"
132
+ >>> print(cf.range)
133
+ """
134
+ return self._range
135
+
136
+ @range.setter
137
+ def range(self, value):
138
+ """
139
+ Sets the cell range for the conditional format.
140
+
141
+ Args:
142
+ value (str): Cell range in A1 notation.
143
+
144
+ Examples:
145
+ >>> cf.range = "A1:A10"
146
+ """
147
+ self._range = value
148
+
149
+ @property
150
+ def stop_if_true(self):
151
+ """
152
+ Gets or sets whether to stop evaluating lower priority rules if this rule is true.
153
+
154
+ Returns:
155
+ bool: True to stop lower priority rules, False otherwise.
156
+
157
+ Examples:
158
+ >>> cf.stop_if_true = True
159
+ >>> print(cf.stop_if_true)
160
+ """
161
+ return self._stop_if_true
162
+
163
+ @stop_if_true.setter
164
+ def stop_if_true(self, value):
165
+ """
166
+ Sets whether to stop evaluating lower priority rules if this rule is true.
167
+
168
+ Args:
169
+ value (bool): True to stop, False to continue.
170
+
171
+ Examples:
172
+ >>> cf.stop_if_true = True
173
+ """
174
+ self._stop_if_true = value
175
+
176
+ @property
177
+ def priority(self):
178
+ """
179
+ Gets or sets the rule priority.
180
+
181
+ Returns:
182
+ int: Rule priority (lower = higher priority).
183
+
184
+ Examples:
185
+ >>> cf.priority = 1
186
+ >>> print(cf.priority)
187
+ """
188
+ return self._priority
189
+
190
+ @priority.setter
191
+ def priority(self, value):
192
+ """
193
+ Sets the rule priority.
194
+
195
+ Args:
196
+ value (int): Rule priority (positive integer).
197
+
198
+ Examples:
199
+ >>> cf.priority = 1
200
+ """
201
+ if isinstance(value, int) and value > 0:
202
+ self._priority = value
203
+ else:
204
+ raise ValueError("Priority must be a positive integer")
205
+
206
+ # Cell Value Rule properties
207
+
208
+ @property
209
+ def operator(self):
210
+ """
211
+ Gets or sets the comparison operator for cell value rules.
212
+
213
+ Returns:
214
+ str or None: Comparison operator (equal, notEqual, greaterThan, lessThan, greaterThanOrEqual, lessThanOrEqual, between, notBetween).
215
+
216
+ Examples:
217
+ >>> cf.operator = "greaterThan"
218
+ >>> print(cf.operator)
219
+ """
220
+ return self._operator
221
+
222
+ @operator.setter
223
+ def operator(self, value):
224
+ """
225
+ Sets the comparison operator for cell value rules.
226
+
227
+ Args:
228
+ value (str): Comparison operator.
229
+
230
+ Raises:
231
+ ValueError: If operator is not valid.
232
+ """
233
+ valid_operators = [
234
+ 'equal', 'notEqual', 'greaterThan', 'lessThan',
235
+ 'greaterThanOrEqual', 'lessThanOrEqual', 'between', 'notBetween'
236
+ ]
237
+ if value in valid_operators:
238
+ self._operator = value
239
+ else:
240
+ raise ValueError(f"Invalid operator: {value}. Valid operators: {valid_operators}")
241
+
242
+ @property
243
+ def formula1(self):
244
+ """
245
+ Gets or sets the first value/formula for comparison.
246
+
247
+ Returns:
248
+ str or None: First value/formula.
249
+
250
+ Examples:
251
+ >>> cf.formula1 = "100"
252
+ >>> cf.formula1 = "=A1"
253
+ """
254
+ return self._formula1
255
+
256
+ @formula1.setter
257
+ def formula1(self, value):
258
+ """
259
+ Sets the first value/formula for comparison.
260
+
261
+ Args:
262
+ value (str): Value or formula string.
263
+
264
+ Examples:
265
+ >>> cf.formula1 = "100"
266
+ >>> cf.formula1 = "=A1"
267
+ """
268
+ self._formula1 = value
269
+
270
+ @property
271
+ def formula2(self):
272
+ """
273
+ Gets or sets the second value/formula for comparison.
274
+
275
+ Returns:
276
+ str or None: Second value/formula (for 'between' and 'notBetween' operators).
277
+
278
+ Examples:
279
+ >>> cf.formula2 = "200"
280
+ >>> cf.formula2 = "=B1"
281
+ """
282
+ return self._formula2
283
+
284
+ @formula2.setter
285
+ def formula2(self, value):
286
+ """
287
+ Sets the second value/formula for comparison.
288
+
289
+ Args:
290
+ value (str): Value or formula string.
291
+
292
+ Examples:
293
+ >>> cf.formula2 = "200"
294
+ >>> cf.formula2 = "=B1"
295
+ """
296
+ self._formula2 = value
297
+
298
+ # Text Rule properties
299
+
300
+ @property
301
+ def text_operator(self):
302
+ """
303
+ Gets or sets the text operator for text rules.
304
+
305
+ Returns:
306
+ str or None: Text operator (contains, notContains, beginsWith, endsWith).
307
+
308
+ Examples:
309
+ >>> cf.text_operator = "contains"
310
+ >>> print(cf.text_operator)
311
+ """
312
+ return self._operator
313
+
314
+ @text_operator.setter
315
+ def text_operator(self, value):
316
+ """
317
+ Sets the text operator for text rules.
318
+
319
+ Args:
320
+ value (str): Text operator.
321
+
322
+ Raises:
323
+ ValueError: If operator is not valid.
324
+ """
325
+ valid_operators = ['contains', 'notContains', 'beginsWith', 'endsWith']
326
+ if value in valid_operators:
327
+ self._operator = value
328
+ else:
329
+ raise ValueError(f"Invalid text operator: {value}. Valid operators: {valid_operators}")
330
+
331
+ @property
332
+ def text_formula(self):
333
+ """
334
+ Gets or sets the text value for comparison.
335
+
336
+ Returns:
337
+ str or None: Text value to compare.
338
+
339
+ Examples:
340
+ >>> cf.text_formula = "error"
341
+ >>> print(cf.text_formula)
342
+ """
343
+ return self._formula1
344
+
345
+ @text_formula.setter
346
+ def text_formula(self, value):
347
+ """
348
+ Sets the text value for comparison.
349
+
350
+ Args:
351
+ value (str): Text value to compare.
352
+
353
+ Examples:
354
+ >>> cf.text_formula = "error"
355
+ """
356
+ self._formula1 = value
357
+
358
+ # Date Rule properties
359
+
360
+ @property
361
+ def date_operator(self):
362
+ """
363
+ Gets or sets the date operator for date rules.
364
+
365
+ Returns:
366
+ str or None: Date operator (yesterday, today, tomorrow, last7Days, lastWeek, thisWeek, nextWeek, lastMonth, thisMonth, nextMonth, lastQuarter, thisQuarter, nextQuarter, lastYear, thisYear, nextYear, yearToDate).
367
+
368
+ Examples:
369
+ >>> cf.date_operator = "today"
370
+ >>> print(cf.date_operator)
371
+ """
372
+ return self._operator
373
+
374
+ @date_operator.setter
375
+ def date_operator(self, value):
376
+ """
377
+ Sets the date operator for date rules.
378
+
379
+ Args:
380
+ value (str): Date operator.
381
+
382
+ Raises:
383
+ ValueError: If operator is not valid.
384
+ """
385
+ valid_operators = [
386
+ 'yesterday', 'today', 'tomorrow', 'last7Days', 'lastWeek', 'thisWeek', 'nextWeek',
387
+ 'lastMonth', 'thisMonth', 'nextMonth', 'lastQuarter', 'thisQuarter', 'nextQuarter',
388
+ 'lastYear', 'thisYear', 'nextYear', 'yearToDate'
389
+ ]
390
+ if value in valid_operators:
391
+ self._operator = value
392
+ else:
393
+ raise ValueError(f"Invalid date operator: {value}. Valid operators: {valid_operators}")
394
+
395
+ @property
396
+ def date_formula(self):
397
+ """
398
+ Gets or sets the optional date value for comparison.
399
+
400
+ Returns:
401
+ str or None: Date value for comparison.
402
+
403
+ Examples:
404
+ >>> cf.date_formula = "2026-01-15"
405
+ >>> print(cf.date_formula)
406
+ """
407
+ return self._formula1
408
+
409
+ @date_formula.setter
410
+ def date_formula(self, value):
411
+ """
412
+ Sets the optional date value for comparison.
413
+
414
+ Args:
415
+ value (str): Date value for comparison.
416
+
417
+ Examples:
418
+ >>> cf.date_formula = "2026-01-15"
419
+ """
420
+ self._formula1 = value
421
+
422
+ # Duplicate/Unique Values properties
423
+
424
+ @property
425
+ def duplicate(self):
426
+ """
427
+ Gets or sets whether to highlight duplicate values.
428
+
429
+ Returns:
430
+ bool or None: True for duplicate, False for unique.
431
+
432
+ Examples:
433
+ >>> cf.duplicate = True
434
+ >>> print(cf.duplicate)
435
+ """
436
+ return self._duplicate
437
+
438
+ @duplicate.setter
439
+ def duplicate(self, value):
440
+ """
441
+ Sets whether to highlight duplicate values.
442
+
443
+ Args:
444
+ value (bool): True for duplicate, False for unique.
445
+
446
+ Examples:
447
+ >>> cf.duplicate = True
448
+ """
449
+ self._duplicate = value
450
+
451
+ # Top/Bottom Rule properties
452
+
453
+ @property
454
+ def top(self):
455
+ """
456
+ Gets or sets whether to highlight top values.
457
+
458
+ Returns:
459
+ bool or None: True for top, False for bottom.
460
+
461
+ Examples:
462
+ >>> cf.top = True
463
+ >>> print(cf.top)
464
+ """
465
+ return self._top
466
+
467
+ @top.setter
468
+ def top(self, value):
469
+ """
470
+ Sets whether to highlight top values.
471
+
472
+ Args:
473
+ value (bool): True for top, False for bottom.
474
+
475
+ Examples:
476
+ >>> cf.top = True
477
+ """
478
+ self._top = value
479
+
480
+ @property
481
+ def percent(self):
482
+ """
483
+ Gets or sets whether rank is a percentage.
484
+
485
+ Returns:
486
+ bool or None: True for percentage, False for count.
487
+
488
+ Examples:
489
+ >>> cf.percent = True
490
+ >>> print(cf.percent)
491
+ """
492
+ return self._percent
493
+
494
+ @percent.setter
495
+ def percent(self, value):
496
+ """
497
+ Sets whether rank is a percentage.
498
+
499
+ Args:
500
+ value (bool): True for percentage, False for count.
501
+
502
+ Examples:
503
+ >>> cf.percent = True
504
+ """
505
+ self._percent = value
506
+
507
+ @property
508
+ def rank(self):
509
+ """
510
+ Gets or sets the rank value.
511
+
512
+ Returns:
513
+ int or None: Rank value (e.g., 10 for top 10).
514
+
515
+ Examples:
516
+ >>> cf.rank = 10
517
+ >>> print(cf.rank)
518
+ """
519
+ return self._rank
520
+
521
+ @rank.setter
522
+ def rank(self, value):
523
+ """
524
+ Sets the rank value.
525
+
526
+ Args:
527
+ value (int): Rank value.
528
+
529
+ Examples:
530
+ >>> cf.rank = 10
531
+ """
532
+ self._rank = value
533
+
534
+ # Above/Below Average properties
535
+
536
+ @property
537
+ def above(self):
538
+ """
539
+ Gets or sets whether to highlight above average.
540
+
541
+ Returns:
542
+ bool or None: True for above average, False for below average.
543
+
544
+ Examples:
545
+ >>> cf.above = True
546
+ >>> print(cf.above)
547
+ """
548
+ return self._above
549
+
550
+ @above.setter
551
+ def above(self, value):
552
+ """
553
+ Sets whether to highlight above average.
554
+
555
+ Args:
556
+ value (bool): True for above average, False for below average.
557
+
558
+ Examples:
559
+ >>> cf.above = True
560
+ """
561
+ self._above = value
562
+
563
+ @property
564
+ def std_dev(self):
565
+ """
566
+ Gets or sets the number of standard deviations.
567
+
568
+ Returns:
569
+ int or None: Number of standard deviations.
570
+
571
+ Examples:
572
+ >>> cf.std_dev = 1
573
+ >>> print(cf.std_dev)
574
+ """
575
+ return self._std_dev
576
+
577
+ @std_dev.setter
578
+ def std_dev(self, value):
579
+ """
580
+ Sets the number of standard deviations.
581
+
582
+ Args:
583
+ value (int): Number of standard deviations.
584
+
585
+ Examples:
586
+ >>> cf.std_dev = 1
587
+ """
588
+ self._std_dev = value
589
+
590
+ # Color Scale properties
591
+
592
+ @property
593
+ def color_scale_type(self):
594
+ """
595
+ Gets or sets the color scale type.
596
+
597
+ Returns:
598
+ str or None: '2-color' or '3-color'.
599
+
600
+ Examples:
601
+ >>> cf.color_scale_type = "3-color"
602
+ >>> print(cf.color_scale_type)
603
+ """
604
+ return self._color_scale_type
605
+
606
+ @color_scale_type.setter
607
+ def color_scale_type(self, value):
608
+ """
609
+ Sets the color scale type.
610
+
611
+ Args:
612
+ value (str): '2-color' or '3-color'.
613
+
614
+ Raises:
615
+ ValueError: If type is not valid.
616
+ """
617
+ if value in ('2-color', '3-color'):
618
+ self._color_scale_type = value
619
+ else:
620
+ raise ValueError("Color scale type must be '2-color' or '3-color'")
621
+
622
+ @property
623
+ def min_color(self):
624
+ """
625
+ Gets or sets the minimum value color for color scales.
626
+
627
+ Returns:
628
+ str or None: RGB hex color string.
629
+
630
+ Examples:
631
+ >>> cf.min_color = "FF63C384" # Red
632
+ >>> print(cf.min_color)
633
+ """
634
+ return self._min_color
635
+
636
+ @min_color.setter
637
+ def min_color(self, value):
638
+ """
639
+ Sets the minimum value color for color scales.
640
+
641
+ Args:
642
+ value (str): RGB hex color string in AARRGGBB format.
643
+
644
+ Examples:
645
+ >>> cf.min_color = "FF63C384" # Red
646
+ """
647
+ self._min_color = value
648
+
649
+ @property
650
+ def mid_color(self):
651
+ """
652
+ Gets or sets the midpoint color for 3-color scales.
653
+
654
+ Returns:
655
+ str or None: RGB hex color string.
656
+
657
+ Examples:
658
+ >>> cf.mid_color = "FFFFEB84" # Yellow
659
+ >>> print(cf.mid_color)
660
+ """
661
+ return self._mid_color
662
+
663
+ @mid_color.setter
664
+ def mid_color(self, value):
665
+ """
666
+ Sets the midpoint color for 3-color scales.
667
+
668
+ Args:
669
+ value (str): RGB hex color string in AARRGGBB format.
670
+
671
+ Examples:
672
+ >>> cf.mid_color = "FFFFEB84" # Yellow
673
+ """
674
+ self._mid_color = value
675
+
676
+ @property
677
+ def max_color(self):
678
+ """
679
+ Gets or sets the maximum value color for color scales.
680
+
681
+ Returns:
682
+ str or None: RGB hex color string.
683
+
684
+ Examples:
685
+ >>> cf.max_color = "FF006100" # Green
686
+ >>> print(cf.max_color)
687
+ """
688
+ return self._max_color
689
+
690
+ @max_color.setter
691
+ def max_color(self, value):
692
+ """
693
+ Sets the maximum value color for color scales.
694
+
695
+ Args:
696
+ value (str): RGB hex color string in AARRGGBB format.
697
+
698
+ Examples:
699
+ >>> cf.max_color = "FF006100" # Green
700
+ """
701
+ self._max_color = value
702
+
703
+ # Data Bar properties
704
+
705
+ @property
706
+ def bar_color(self):
707
+ """
708
+ Gets or sets the bar color for data bars.
709
+
710
+ Returns:
711
+ str or None: RGB hex color string.
712
+
713
+ Examples:
714
+ >>> cf.bar_color = "FF006100" # Green
715
+ >>> print(cf.bar_color)
716
+ """
717
+ return self._bar_color
718
+
719
+ @bar_color.setter
720
+ def bar_color(self, value):
721
+ """
722
+ Sets the bar color for data bars.
723
+
724
+ Args:
725
+ value (str): RGB hex color string in AARRGGBB format.
726
+
727
+ Examples:
728
+ >>> cf.bar_color = "FF006100" # Green
729
+ """
730
+ self._bar_color = value
731
+
732
+ @property
733
+ def negative_color(self):
734
+ """
735
+ Gets or sets the negative value color for data bars.
736
+
737
+ Returns:
738
+ str or None: RGB hex color string.
739
+
740
+ Examples:
741
+ >>> cf.negative_color = "FFFF0000" # Red
742
+ >>> print(cf.negative_color)
743
+ """
744
+ return self._negative_color
745
+
746
+ @negative_color.setter
747
+ def negative_color(self, value):
748
+ """
749
+ Sets the negative value color for data bars.
750
+
751
+ Args:
752
+ value (str): RGB hex color string in AARRGGBB format.
753
+
754
+ Examples:
755
+ >>> cf.negative_color = "FFFF0000" # Red
756
+ """
757
+ self._negative_color = value
758
+
759
+ @property
760
+ def show_border(self):
761
+ """
762
+ Gets or sets whether to show border for data bars.
763
+
764
+ Returns:
765
+ bool: Show border.
766
+
767
+ Examples:
768
+ >>> cf.show_border = True
769
+ >>> print(cf.show_border)
770
+ """
771
+ return self._show_border
772
+
773
+ @show_border.setter
774
+ def show_border(self, value):
775
+ """
776
+ Sets whether to show border for data bars.
777
+
778
+ Args:
779
+ value (bool): True to show, False to hide.
780
+
781
+ Examples:
782
+ >>> cf.show_border = True
783
+ """
784
+ self._show_border = value
785
+
786
+ @property
787
+ def direction(self):
788
+ """
789
+ Gets or sets the bar direction for data bars.
790
+
791
+ Returns:
792
+ str or None: 'left-to-right' or 'right-to-left'.
793
+
794
+ Examples:
795
+ >>> cf.direction = "left-to-right"
796
+ >>> print(cf.direction)
797
+ """
798
+ return self._direction
799
+
800
+ @direction.setter
801
+ def direction(self, value):
802
+ """
803
+ Sets the bar direction for data bars.
804
+
805
+ Args:
806
+ value (str): 'left-to-right' or 'right-to-left'.
807
+
808
+ Raises:
809
+ ValueError: If direction is not valid.
810
+ """
811
+ if value in ('left-to-right', 'right-to-left'):
812
+ self._direction = value
813
+ else:
814
+ raise ValueError("Direction must be 'left-to-right' or 'right-to-left'")
815
+
816
+ @property
817
+ def bar_length(self):
818
+ """
819
+ Gets or sets the bar length for data bars.
820
+
821
+ Returns:
822
+ str or None: 'auto' or fixed length value.
823
+
824
+ Examples:
825
+ >>> cf.bar_length = "auto"
826
+ >>> print(cf.bar_length)
827
+ """
828
+ return self._bar_length
829
+
830
+ @bar_length.setter
831
+ def bar_length(self, value):
832
+ """
833
+ Sets the bar length for data bars.
834
+
835
+ Args:
836
+ value (str): 'auto' or fixed length value.
837
+
838
+ Examples:
839
+ >>> cf.bar_length = "auto"
840
+ >>> cf.bar_length = 50
841
+ """
842
+ self._bar_length = value
843
+
844
+ # Icon Set properties
845
+
846
+ @property
847
+ def icon_set_type(self):
848
+ """
849
+ Gets or sets the icon set type.
850
+
851
+ Returns:
852
+ str or None: Icon set name.
853
+
854
+ Examples:
855
+ >>> cf.icon_set_type = "3TrafficLights1"
856
+ >>> print(cf.icon_set_type)
857
+ """
858
+ return self._icon_set_type
859
+
860
+ @icon_set_type.setter
861
+ def icon_set_type(self, value):
862
+ """
863
+ Sets the icon set type.
864
+
865
+ Args:
866
+ value (str): Icon set name.
867
+
868
+ Raises:
869
+ ValueError: If icon set type is not valid.
870
+ """
871
+ valid_sets = [
872
+ '3Arrows', '3TrafficLights1', '3TrafficLights2', '3Flags', '3Signs',
873
+ '4Arrows', '4ArrowsGray', '4TrafficLights', '5Arrows', '5ArrowsGray',
874
+ '5Quarters', '5Rating', '5Symbols', '3Symbols', '3Symbols2'
875
+ ]
876
+ if value in valid_sets:
877
+ self._icon_set_type = value
878
+ else:
879
+ raise ValueError(f"Invalid icon set type: {value}. Valid types: {valid_sets}")
880
+
881
+ @property
882
+ def reverse_icons(self):
883
+ """
884
+ Gets or sets whether to reverse icon order.
885
+
886
+ Returns:
887
+ bool: Reverse icon order.
888
+
889
+ Examples:
890
+ >>> cf.reverse_icons = True
891
+ >>> print(cf.reverse_icons)
892
+ """
893
+ return self._reverse_icons
894
+
895
+ @reverse_icons.setter
896
+ def reverse_icons(self, value):
897
+ """
898
+ Sets whether to reverse icon order.
899
+
900
+ Args:
901
+ value (bool): True to reverse, False for normal.
902
+
903
+ Examples:
904
+ >>> cf.reverse_icons = True
905
+ """
906
+ self._reverse_icons = value
907
+
908
+ @property
909
+ def show_icon_only(self):
910
+ """
911
+ Gets or sets whether to show only icons.
912
+
913
+ Returns:
914
+ bool: Show only icons (hide values).
915
+
916
+ Examples:
917
+ >>> cf.show_icon_only = True
918
+ >>> print(cf.show_icon_only)
919
+ """
920
+ return self._show_icon_only
921
+
922
+ @show_icon_only.setter
923
+ def show_icon_only(self, value):
924
+ """
925
+ Sets whether to show only icons.
926
+
927
+ Args:
928
+ value (bool): True to show only icons, False to show values.
929
+
930
+ Examples:
931
+ >>> cf.show_icon_only = True
932
+ """
933
+ self._show_icon_only = value
934
+
935
+ # Formula Rule properties
936
+
937
+ @property
938
+ def formula(self):
939
+ """
940
+ Gets or sets the formula for formula-based rules.
941
+
942
+ Returns:
943
+ str or None: Excel formula string.
944
+
945
+ Examples:
946
+ >>> cf.formula = "=A1>100"
947
+ >>> print(cf.formula)
948
+ """
949
+ return self._formula
950
+
951
+ @formula.setter
952
+ def formula(self, value):
953
+ """
954
+ Sets the formula for formula-based rules.
955
+
956
+ Args:
957
+ value (str): Excel formula string.
958
+
959
+ Examples:
960
+ >>> cf.formula = "=A1>100"
961
+ """
962
+ self._formula = value
963
+
964
+ # Formatting properties (applied when condition is true)
965
+
966
+ @property
967
+ def font(self):
968
+ """
969
+ Gets the font settings for this conditional format.
970
+
971
+ Returns:
972
+ Font: Font object.
973
+
974
+ Examples:
975
+ >>> cf.font.bold = True
976
+ >>> cf.font.color = "FFFF0000"
977
+ """
978
+ return self._font
979
+
980
+ @property
981
+ def border(self):
982
+ """
983
+ Gets the border settings for this conditional format.
984
+
985
+ Returns:
986
+ Border: Border object.
987
+
988
+ Examples:
989
+ >>> cf.border.line_style = "thin"
990
+ >>> cf.border.color = "FFFF0000"
991
+ """
992
+ return self._border
993
+
994
+ @property
995
+ def fill(self):
996
+ """
997
+ Gets the fill settings for this conditional format.
998
+
999
+ Returns:
1000
+ Fill: Fill object.
1001
+
1002
+ Examples:
1003
+ >>> cf.fill.set_solid_fill('FFFF0000')
1004
+ """
1005
+ return self._fill
1006
+
1007
+ @property
1008
+ def alignment(self):
1009
+ """
1010
+ Gets the alignment settings for this conditional format.
1011
+
1012
+ Returns:
1013
+ Alignment: Alignment object.
1014
+
1015
+ Examples:
1016
+ >>> cf.alignment.horizontal = "center"
1017
+ """
1018
+ return self._alignment
1019
+
1020
+ @property
1021
+ def number_format(self):
1022
+ """
1023
+ Gets or sets the number format for this conditional format.
1024
+
1025
+ Returns:
1026
+ str: Number format string.
1027
+
1028
+ Examples:
1029
+ >>> cf.number_format = "0.00"
1030
+ """
1031
+ return self._number_format
1032
+
1033
+ @number_format.setter
1034
+ def number_format(self, value):
1035
+ """
1036
+ Sets the number format for this conditional format.
1037
+
1038
+ Args:
1039
+ value (str): Number format string.
1040
+
1041
+ Examples:
1042
+ >>> cf.number_format = "0.00"
1043
+ """
1044
+ self._number_format = value
1045
+
1046
+
1047
+ class ConditionalFormatCollection:
1048
+ """
1049
+ Represents a collection of conditional formats for a worksheet.
1050
+
1051
+ The ConditionalFormatCollection class provides methods for managing
1052
+ multiple conditional formatting rules applied to a worksheet.
1053
+
1054
+ Examples:
1055
+ >>> from aspose_cells import Workbook
1056
+ >>> wb = Workbook()
1057
+ >>> ws = wb.worksheets[0]
1058
+ >>> cf = ws.conditional_formats.add()
1059
+ >>> cf.type = "cellValue"
1060
+ >>> cf.range = "A1:A10"
1061
+ >>> print(len(ws.conditional_formats)) # 1
1062
+ """
1063
+
1064
+ def __init__(self):
1065
+ """
1066
+ Initializes a new instance of ConditionalFormatCollection class.
1067
+
1068
+ Creates an empty collection for conditional formats.
1069
+ """
1070
+ self._formats = []
1071
+
1072
+ @property
1073
+ def count(self):
1074
+ """
1075
+ Gets the number of conditional formats in the collection.
1076
+
1077
+ Returns:
1078
+ int: Number of conditional formats.
1079
+
1080
+ Examples:
1081
+ >>> print(len(ws.conditional_formats))
1082
+ """
1083
+ return len(self._formats)
1084
+
1085
+ def add(self):
1086
+ """
1087
+ Adds a new conditional format to the collection.
1088
+
1089
+ Returns:
1090
+ ConditionalFormat: The newly created ConditionalFormat object.
1091
+
1092
+ Examples:
1093
+ >>> cf = ws.conditional_formats.add()
1094
+ >>> cf.type = "cellValue"
1095
+ """
1096
+ cf = ConditionalFormat()
1097
+ self._formats.append(cf)
1098
+ return cf
1099
+
1100
+ def get_by_index(self, index):
1101
+ """
1102
+ Gets a conditional format by its index.
1103
+
1104
+ Args:
1105
+ index (int): Zero-based index of the conditional format.
1106
+
1107
+ Returns:
1108
+ ConditionalFormat or None: The ConditionalFormat object at the specified index, or None if not found.
1109
+
1110
+ Examples:
1111
+ >>> cf = ws.conditional_formats.get_by_index(0)
1112
+ >>> if cf:
1113
+ ... print(cf.type)
1114
+ """
1115
+ if 0 <= index < len(self._formats):
1116
+ return self._formats[index]
1117
+ return None
1118
+
1119
+ def get_by_range(self, range_str):
1120
+ """
1121
+ Gets a conditional format by its range.
1122
+
1123
+ Args:
1124
+ range_str (str): Cell range in A1 notation.
1125
+
1126
+ Returns:
1127
+ ConditionalFormat or None: The ConditionalFormat object at the specified range, or None if not found.
1128
+
1129
+ Examples:
1130
+ >>> cf = ws.conditional_formats.get_by_range("A1:A10")
1131
+ >>> if cf:
1132
+ ... print(cf.type)
1133
+ """
1134
+ for cf in self._formats:
1135
+ if cf.range == range_str:
1136
+ return cf
1137
+ return None
1138
+
1139
+ def remove(self, cf):
1140
+ """
1141
+ Removes a conditional format from the collection.
1142
+
1143
+ Args:
1144
+ cf (ConditionalFormat or int): The ConditionalFormat object or index to remove.
1145
+
1146
+ Examples:
1147
+ >>> ws.conditional_formats.remove(0) # Remove by index
1148
+ >>> ws.conditional_formats.remove(cf) # Remove by object
1149
+ """
1150
+ if isinstance(cf, int):
1151
+ if 0 <= cf < len(self._formats):
1152
+ del self._formats[cf]
1153
+ elif cf in self._formats:
1154
+ self._formats.remove(cf)
1155
+
1156
+ def clear(self):
1157
+ """
1158
+ Clears all conditional formats from the collection.
1159
+
1160
+ Examples:
1161
+ >>> ws.conditional_formats.clear()
1162
+ """
1163
+ self._formats = []
1164
+
1165
+ def __iter__(self):
1166
+ """
1167
+ Iterates over all conditional formats in the collection.
1168
+
1169
+ Yields:
1170
+ ConditionalFormat: Each conditional format in the collection.
1171
+
1172
+ Examples:
1173
+ >>> for cf in ws.conditional_formats:
1174
+ ... print(cf.type)
1175
+ """
1176
+ return iter(self._formats)
1177
+
1178
+ def __len__(self):
1179
+ """
1180
+ Gets the number of conditional formats in the collection.
1181
+
1182
+ Returns:
1183
+ int: Number of conditional formats.
1184
+ """
1185
+ return len(self._formats)