zhao
2021-07-19 8347f2fbddbd25369359dcb2da1233ac48a19fdc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
/*******************************************************************************
 * You may amend and distribute as you like, but don't remove this header!
 *
 * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
 * See http://www.codeplex.com/EPPlus for details.
 *
 * Copyright (C) 2011  Jan Källman
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
 * See the GNU Lesser General Public License for more details.
 *
 * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
 * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
 *
 * All code and executables are provided "as is" with no warranty either express or implied. 
 * The author accepts no liability for any damage or loss of business that this product may cause.
 *
 * Code change notes:
 * 
 * Author          Change                                          Date
 * ******************************************************************************
 * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
 *******************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
 
namespace HH.WMS.Utils.EPPlus.ConditionalFormatting
{
  /// <summary>
  /// Enum for Conditional Format Type ST_CfType §18.18.12. With some changes.
  /// </summary>
  public enum eExcelConditionalFormattingRuleType
  {
    #region Average
    /// <summary>
    /// This conditional formatting rule highlights cells that are above the average
    /// for all values in the range.
    /// </summary>
    /// <remarks>AboveAverage Excel CF Rule Type</remarks>
    AboveAverage,
 
    /// <summary>
    /// This conditional formatting rule highlights cells that are above or equal
    /// the average for all values in the range.
    /// </summary>
    /// <remarks>AboveAverage Excel CF Rule Type</remarks>
    AboveOrEqualAverage,
 
    /// <summary>
    /// This conditional formatting rule highlights cells that are below the average
    /// for all values in the range.
    /// </summary>
    /// <remarks>AboveAverage Excel CF Rule Type</remarks>
    BelowAverage,
 
    /// <summary>
    /// This conditional formatting rule highlights cells that are below or equal
    /// the average for all values in the range.
    /// </summary>
    /// <remarks>AboveAverage Excel CF Rule Type</remarks>
    BelowOrEqualAverage,
    #endregion
 
    #region StdDev
    /// <summary>
    /// This conditional formatting rule highlights cells that are above the standard
    /// deviationa for all values in the range.
    /// <remarks>AboveAverage Excel CF Rule Type</remarks>
    /// </summary>
    AboveStdDev,
 
    /// <summary>
    /// This conditional formatting rule highlights cells that are below the standard
    /// deviationa for all values in the range.
    /// </summary>
    /// <remarks>AboveAverage Excel CF Rule Type</remarks>
    BelowStdDev,
    #endregion
 
    #region TopBottom
    /// <summary>
    /// This conditional formatting rule highlights cells whose values fall in the
    /// bottom N bracket as specified.
    /// </summary>
    /// <remarks>Top10 Excel CF Rule Type</remarks>
    Bottom,
 
    /// <summary>
    /// This conditional formatting rule highlights cells whose values fall in the
    /// bottom N percent as specified.
    /// </summary>
    /// <remarks>Top10 Excel CF Rule Type</remarks>
    BottomPercent,
 
    /// <summary>
    /// This conditional formatting rule highlights cells whose values fall in the
    /// top N bracket as specified.
    /// </summary>
    /// <remarks>Top10 Excel CF Rule Type</remarks>
    Top,
 
    /// <summary>
    /// This conditional formatting rule highlights cells whose values fall in the
    /// top N percent as specified.
    /// </summary>
    /// <remarks>Top10 Excel CF Rule Type</remarks>
    TopPercent,
    #endregion
 
    #region TimePeriod
    /// <summary>
    /// This conditional formatting rule highlights cells containing dates in the
    /// last 7 days.
    /// </summary>
    /// <remarks>TimePeriod Excel CF Rule Type</remarks>
    Last7Days,
 
    /// <summary>
    /// This conditional formatting rule highlights cells containing dates in the
    /// last month.
    /// </summary>
    /// <remarks>TimePeriod Excel CF Rule Type</remarks>
    LastMonth,
 
    /// <summary>
    /// This conditional formatting rule highlights cells containing dates in the
    /// last week.
    /// </summary>
    /// <remarks>TimePeriod Excel CF Rule Type</remarks>
    LastWeek,
 
    /// <summary>
    /// This conditional formatting rule highlights cells containing dates in the
    /// next month.
    /// </summary>
    /// <remarks>TimePeriod Excel CF Rule Type</remarks>
    NextMonth,
 
    /// <summary>
    /// This conditional formatting rule highlights cells containing dates in the
    /// next week.
    /// </summary>
    /// <remarks>TimePeriod Excel CF Rule Type</remarks>
    NextWeek,
 
    /// <summary>
    /// This conditional formatting rule highlights cells containing dates in this
    /// month.
    /// </summary>
    /// <remarks>TimePeriod Excel CF Rule Type</remarks>
    ThisMonth,
 
    /// <summary>
    /// This conditional formatting rule highlights cells containing dates in this
    /// week.
    /// </summary>
    /// <remarks>TimePeriod Excel CF Rule Type</remarks>
    ThisWeek,
 
    /// <summary>
    /// This conditional formatting rule highlights cells containing today dates.
    /// </summary>
    /// <remarks>TimePeriod Excel CF Rule Type</remarks>
    Today,
 
    /// <summary>
    /// This conditional formatting rule highlights cells containing tomorrow dates.
    /// </summary>
    /// <remarks>TimePeriod Excel CF Rule Type</remarks>
    Tomorrow,
 
    /// <summary>
    /// This conditional formatting rule highlights cells containing yesterday dates.
    /// </summary>
    /// <remarks>TimePeriod Excel CF Rule Type</remarks>
    Yesterday,
    #endregion
 
    #region CellIs
    /// <summary>
    /// This conditional formatting rule highlights cells in the range that begin with
    /// the given text.
    /// </summary>
    /// <remarks>
    /// Equivalent to using the LEFT() sheet function and comparing values.
    /// </remarks>
    /// <remarks>BeginsWith Excel CF Rule Type</remarks>
    BeginsWith,
 
    /// <summary>
    /// This conditional formatting rule highlights cells in the range between the
    /// given two formulas.
    /// </summary>
    /// <remarks>CellIs Excel CF Rule Type</remarks>
    Between,
 
    /// <summary>
    /// This conditional formatting rule highlights cells that are completely blank.
    /// </summary>
    /// <remarks>
    /// Equivalent of using LEN(TRIM()). This means that if the cell contains only
    /// characters that TRIM() would remove, then it is considered blank. An empty cell
    /// is also considered blank.
    /// </remarks>
    /// <remarks>ContainsBlanks Excel CF Rule Type</remarks>
    ContainsBlanks,
 
    /// <summary>
    /// This conditional formatting rule highlights cells with formula errors.
    /// </summary>
    /// <remarks>
    /// Equivalent to using ISERROR() sheet function to determine if there is
    /// a formula error.
    /// </remarks>
    /// <remarks>ContainsErrors Excel CF Rule Type</remarks>
    ContainsErrors,
 
    /// <summary>
    /// This conditional formatting rule highlights cells in the range that begin with
    /// the given text.
    /// </summary>
    /// <remarks>
    /// Equivalent to using the LEFT() sheet function and comparing values.
    /// </remarks>
    /// <remarks>ContainsText Excel CF Rule Type</remarks>
    ContainsText,
 
    /// <summary>
    /// This conditional formatting rule highlights duplicated values.
    /// </summary>
    /// <remarks>DuplicateValues Excel CF Rule Type</remarks>
    DuplicateValues,
 
    /// <summary>
    /// This conditional formatting rule highlights cells ending with given text.
    /// </summary>
    /// <remarks>
    /// Equivalent to using the RIGHT() sheet function and comparing values.
    /// </remarks>
    /// <remarks>EndsWith Excel CF Rule Type</remarks>
    EndsWith,
 
    /// <summary>
    /// This conditional formatting rule highlights cells equals to with given formula.
    /// </summary>
    /// <remarks>CellIs Excel CF Rule Type</remarks>
    Equal,
 
    /// <summary>
    /// This conditional formatting rule contains a formula to evaluate. When the 
    /// formula result is true, the cell is highlighted.
    /// </summary>
    /// <remarks>Expression Excel CF Rule Type</remarks>
    Expression,
 
    /// <summary>
    /// This conditional formatting rule highlights cells greater than the given formula.
    /// </summary>
    /// <remarks>CellIs Excel CF Rule Type</remarks>
    GreaterThan,
 
    /// <summary>
    /// This conditional formatting rule highlights cells greater than or equal the
    /// given formula.
    /// </summary>
    /// <remarks>CellIs Excel CF Rule Type</remarks>
    GreaterThanOrEqual,
 
    /// <summary>
    /// This conditional formatting rule highlights cells less than the given formula.
    /// </summary>
    /// <remarks>CellIs Excel CF Rule Type</remarks>
    LessThan,
 
    /// <summary>
    /// This conditional formatting rule highlights cells less than or equal the
    /// given formula.
    /// </summary>
    /// <remarks>CellIs Excel CF Rule Type</remarks>
    LessThanOrEqual,
 
    /// <summary>
    /// This conditional formatting rule highlights cells outside the range in
    /// given two formulas.
    /// </summary>
    /// <remarks>CellIs Excel CF Rule Type</remarks>
    NotBetween,
 
    /// <summary>
    /// This conditional formatting rule highlights cells that does not contains the
    /// given formula.
    /// </summary>
    /// <remarks>CellIs Excel CF Rule Type</remarks>
    NotContains,
 
    /// <summary>
    /// This conditional formatting rule highlights cells that are not blank.
    /// </summary>
    /// <remarks>
    /// Equivalent of using LEN(TRIM()). This means that if the cell contains only
    /// characters that TRIM() would remove, then it is considered blank. An empty cell
    /// is also considered blank.
    /// </remarks>
    /// <remarks>NotContainsBlanks Excel CF Rule Type</remarks>
    NotContainsBlanks,
 
    /// <summary>
    /// This conditional formatting rule highlights cells without formula errors.
    /// </summary>
    /// <remarks>
    /// Equivalent to using ISERROR() sheet function to determine if there is a
    /// formula error.
    /// </remarks>
    /// <remarks>NotContainsErrors Excel CF Rule Type</remarks>
    NotContainsErrors,
 
    /// <summary>
    /// This conditional formatting rule highlights cells that do not contain
    /// the given text.
    /// </summary>
    /// <remarks>
    /// Equivalent to using the SEARCH() sheet function.
    /// </remarks>
    /// <remarks>NotContainsText Excel CF Rule Type</remarks>
    NotContainsText,
 
    /// <summary>
    /// This conditional formatting rule highlights cells not equals to with
    /// given formula.
    /// </summary>
    /// <remarks>CellIs Excel CF Rule Type</remarks>
    NotEqual,
 
    /// <summary>
    /// This conditional formatting rule highlights unique values in the range.
    /// </summary>
    /// <remarks>UniqueValues Excel CF Rule Type</remarks>
    UniqueValues,
    #endregion
 
    #region ColorScale
    /// <summary>
    /// Three Color Scale (Low, Middle and High Color Scale)
    /// </summary>
    /// <remarks>ColorScale Excel CF Rule Type</remarks>
    ThreeColorScale,
 
    /// <summary>
    /// Two Color Scale (Low and High Color Scale)
    /// </summary>
    /// <remarks>ColorScale Excel CF Rule Type</remarks>
    TwoColorScale,
    #endregion
 
    #region IconSet
    /// <summary>
    /// This conditional formatting rule applies a 3 set icons to cells according
    /// to their values.
    /// </summary>
    /// <remarks>IconSet Excel CF Rule Type</remarks>
    ThreeIconSet,
 
    /// <summary>
    /// This conditional formatting rule applies a 4 set icons to cells according
    /// to their values.
    /// </summary>
    /// <remarks>IconSet Excel CF Rule Type</remarks>
    FourIconSet,
 
    /// <summary>
    /// This conditional formatting rule applies a 5 set icons to cells according
    /// to their values.
    /// </summary>
    /// <remarks>IconSet Excel CF Rule Type</remarks>
    FiveIconSet,
    #endregion
 
    #region DataBar
    /// <summary>
    /// This conditional formatting rule displays a gradated data bar in the range of cells.
    /// </summary>
    /// <remarks>DataBar Excel CF Rule Type</remarks>
    DataBar
    #endregion
  }
 
  /// <summary>
  /// Enum for Conditional Format Value Object Type ST_CfvoType §18.18.13
  /// </summary>
  public enum eExcelConditionalFormattingValueObjectType
  {
    /// <summary>
    /// Formula
    /// </summary>
    Formula,
 
    /// <summary>
    /// Maximum Value
    /// </summary>
    Max,
 
    /// <summary>
    /// Minimum Value
    /// </summary>
    Min,
 
    /// <summary>
    /// Number Value
    /// </summary>
    Num,
 
    /// <summary>
    /// Percent
    /// </summary>
    Percent,
 
    /// <summary>
    /// Percentile
    /// </summary>
    Percentile
  }
 
  /// <summary>
  /// Enum for Conditional Formatting Value Object Position
  /// </summary>
  public enum eExcelConditionalFormattingValueObjectPosition
  {
    /// <summary>
    /// The lower position for both TwoColorScale and ThreeColorScale
    /// </summary>
    Low,
 
    /// <summary>
    /// The middle position only for ThreeColorScale
    /// </summary>
    Middle,
 
    /// <summary>
    /// The highest position for both TwoColorScale and ThreeColorScale
    /// </summary>
    High
  }
 
  /// <summary>
  /// Enum for Conditional Formatting Value Object Node Type
  /// </summary>
  public enum eExcelConditionalFormattingValueObjectNodeType
  {
    /// <summary>
    /// 'cfvo' node
    /// </summary>
    Cfvo,
 
    /// <summary>
    /// 'color' node
    /// </summary>
    Color
  }
 
  /// <summary>
  /// Enum for Conditional Formatting Operartor Type ST_ConditionalFormattingOperator §18.18.15
  /// </summary>
  public enum eExcelConditionalFormattingOperatorType
  {
    /// <summary>
    /// Begins With. 'Begins with' operator
    /// </summary>
    BeginsWith,
 
    /// <summary>
    /// Between. 'Between' operator
    /// </summary>
    Between,
 
    /// <summary>
    /// Contains. 'Contains' operator
    /// </summary>
    ContainsText,
 
    /// <summary>
    /// Ends With. 'Ends with' operator
    /// </summary>
    EndsWith,
 
    /// <summary>
    /// Equal. 'Equal to' operator
    /// </summary>
    Equal,
 
    /// <summary>
    /// Greater Than. 'Greater than' operator
    /// </summary>
    GreaterThan,
 
    /// <summary>
    /// Greater Than Or Equal. 'Greater than or equal to' operator
    /// </summary>
    GreaterThanOrEqual,
 
    /// <summary>
    /// Less Than. 'Less than' operator
    /// </summary>
    LessThan,
 
    /// <summary>
    /// Less Than Or Equal. 'Less than or equal to' operator
    /// </summary>
    LessThanOrEqual,
 
    /// <summary>
    /// Not Between. 'Not between' operator
    /// </summary>
    NotBetween,
 
    /// <summary>
    /// Does Not Contain. 'Does not contain' operator
    /// </summary>
    NotContains,
 
    /// <summary>
    /// Not Equal. 'Not equal to' operator
    /// </summary>
    NotEqual
  }
 
  /// <summary>
  /// Enum for Conditional Formatting Time Period Type ST_TimePeriod §18.18.82
  /// </summary>
  public enum eExcelConditionalFormattingTimePeriodType
  {
    /// <summary>
    /// Last 7 Days. A date in the last seven days.
    /// </summary>
    Last7Days,
 
    /// <summary>
    /// Last Month. A date occuring in the last calendar month.
    /// </summary>
    LastMonth,
 
    /// <summary>
    /// Last Week. A date occuring last week.
    /// </summary>
    LastWeek,
 
    /// <summary>
    /// Next Month. A date occuring in the next calendar month.
    /// </summary>
    NextMonth,
 
    /// <summary>
    /// Next Week. A date occuring next week.
    /// </summary>
    NextWeek,
 
    /// <summary>
    /// This Month. A date occuring in this calendar month.
    /// </summary>
    ThisMonth,
 
    /// <summary>
    /// This Week. A date occuring this week.
    /// </summary>
    ThisWeek,
 
    /// <summary>
    /// Today. Today's date.
    /// </summary>
    Today,
 
    /// <summary>
    /// Tomorrow. Tomorrow's date.
    /// </summary>
    Tomorrow,
 
    /// <summary>
    /// Yesterday. Yesterday's date.
    /// </summary>
    Yesterday
  }
 
  /// <summary>
  /// 18.18.42 ST_IconSetType (Icon Set Type) - Only 3 icons
  /// </summary>
  public enum eExcelconditionalFormatting3IconsSetType
  {
    /// <summary>
    /// (3 Arrows) 3 arrows icon set.
    /// </summary>
    Arrows,
 
    /// <summary>
    /// (3 Arrows (Gray)) 3 gray arrows icon set.
    /// </summary>
    ArrowsGray,
 
    /// <summary>
    /// (3 Flags) 3 flags icon set. 
    /// </summary>
    Flags,
 
    /// <summary>
    /// (3 Signs) 3 signs icon set.
    /// </summary>
    Signs,
 
    /// <summary>
    /// (3 Symbols Circled) 3 symbols icon set.
    /// </summary>
    Symbols,
 
    /// <summary>
    /// (3 Symbols) 3 Symbols icon set.
    /// </summary>
    Symbols2,
 
    /// <summary>
    /// (3 Traffic Lights) 3 traffic lights icon set (#1).
    /// </summary>
    TrafficLights1,
 
    /// <summary>
    /// (3 Traffic Lights Black) 3 traffic lights icon set with thick black border.
    /// </summary>
    TrafficLights2
  }
 
  /// <summary>
  /// 18.18.42 ST_IconSetType (Icon Set Type) - Only 4 icons
  /// </summary>
  public enum eExcelconditionalFormatting4IconsSetType
  {
    /// <summary>
    /// (4 Arrows) 4 arrows icon set.
    /// </summary>
    Arrows,
 
    /// <summary>
    /// (4 Arrows (Gray)) 4 gray arrows icon set.
    /// </summary>
    ArrowsGray,
 
    /// <summary>
    /// (4 Ratings) 4 ratings icon set.
    /// </summary>
    Rating,
 
    /// <summary>
    /// (4 Red To Black) 4 'red to black' icon set.
    /// </summary>
    RedToBlack,
 
    /// <summary>
    /// (4 Traffic Lights) 4 traffic lights icon set.
    /// </summary>
    TrafficLights
  }
 
  /// <summary>
  /// 18.18.42 ST_IconSetType (Icon Set Type) - Only 5 icons
  /// </summary>
  public enum eExcelconditionalFormatting5IconsSetType
  {
    /// <summary>
    /// (5 Arrows) 5 arrows icon set.
    /// </summary>
    Arrows,
 
    /// <summary>
    /// (5 Arrows (Gray)) 5 gray arrows icon set.
    /// </summary>
    ArrowsGray,
 
    /// <summary>
    /// (5 Quarters) 5 quarters icon set.
    /// </summary>
    Quarters,
 
    /// <summary>
    /// (5 Ratings Icon Set) 5 rating icon set.
    /// </summary>
    Rating
  }
}