1 | /*******************************************************************************
|
---|
2 | * You may amend and distribute as you like, but don't remove this header!
|
---|
3 | *
|
---|
4 | * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
|
---|
5 | * See http://www.codeplex.com/EPPlus for details.
|
---|
6 | *
|
---|
7 | * Copyright (C) 2011 Jan Källman
|
---|
8 | *
|
---|
9 | * This library is free software; you can redistribute it and/or
|
---|
10 | * modify it under the terms of the GNU Lesser General Public
|
---|
11 | * License as published by the Free Software Foundation; either
|
---|
12 | * version 2.1 of the License, or (at your option) any later version.
|
---|
13 |
|
---|
14 | * This library is distributed in the hope that it will be useful,
|
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
---|
17 | * See the GNU Lesser General Public License for more details.
|
---|
18 | *
|
---|
19 | * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
|
---|
20 | * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
|
---|
21 | *
|
---|
22 | * All code and executables are provided "as is" with no warranty either express or implied.
|
---|
23 | * The author accepts no liability for any damage or loss of business that this product may cause.
|
---|
24 | *
|
---|
25 | * Code change notes:
|
---|
26 | *
|
---|
27 | * Author Change Date
|
---|
28 | * ******************************************************************************
|
---|
29 | * Eyal Seagull Conditional Formatting Adaption 2012-04-17
|
---|
30 | *******************************************************************************/
|
---|
31 | using System;
|
---|
32 | using System.Collections.Generic;
|
---|
33 | using System.Linq;
|
---|
34 | using System.Text;
|
---|
35 | using System.Xml;
|
---|
36 |
|
---|
37 | namespace OfficeOpenXml.ConditionalFormatting
|
---|
38 | {
|
---|
39 | /// <summary>
|
---|
40 | /// Functions related to the <see cref="ExcelConditionalFormattingOperatorType"/>
|
---|
41 | /// </summary>
|
---|
42 | internal static class ExcelConditionalFormattingOperatorType
|
---|
43 | {
|
---|
44 | /// <summary>
|
---|
45 | ///
|
---|
46 | /// </summary>
|
---|
47 | /// <param name="type"></param>
|
---|
48 | /// <returns></returns>
|
---|
49 | internal static string GetAttributeByType(
|
---|
50 | eExcelConditionalFormattingOperatorType type)
|
---|
51 | {
|
---|
52 | switch (type)
|
---|
53 | {
|
---|
54 | case eExcelConditionalFormattingOperatorType.BeginsWith:
|
---|
55 | return ExcelConditionalFormattingConstants.Operators.BeginsWith;
|
---|
56 |
|
---|
57 | case eExcelConditionalFormattingOperatorType.Between:
|
---|
58 | return ExcelConditionalFormattingConstants.Operators.Between;
|
---|
59 |
|
---|
60 | case eExcelConditionalFormattingOperatorType.ContainsText:
|
---|
61 | return ExcelConditionalFormattingConstants.Operators.ContainsText;
|
---|
62 |
|
---|
63 | case eExcelConditionalFormattingOperatorType.EndsWith:
|
---|
64 | return ExcelConditionalFormattingConstants.Operators.EndsWith;
|
---|
65 |
|
---|
66 | case eExcelConditionalFormattingOperatorType.Equal:
|
---|
67 | return ExcelConditionalFormattingConstants.Operators.Equal;
|
---|
68 |
|
---|
69 | case eExcelConditionalFormattingOperatorType.GreaterThan:
|
---|
70 | return ExcelConditionalFormattingConstants.Operators.GreaterThan;
|
---|
71 |
|
---|
72 | case eExcelConditionalFormattingOperatorType.GreaterThanOrEqual:
|
---|
73 | return ExcelConditionalFormattingConstants.Operators.GreaterThanOrEqual;
|
---|
74 |
|
---|
75 | case eExcelConditionalFormattingOperatorType.LessThan:
|
---|
76 | return ExcelConditionalFormattingConstants.Operators.LessThan;
|
---|
77 |
|
---|
78 | case eExcelConditionalFormattingOperatorType.LessThanOrEqual:
|
---|
79 | return ExcelConditionalFormattingConstants.Operators.LessThanOrEqual;
|
---|
80 |
|
---|
81 | case eExcelConditionalFormattingOperatorType.NotBetween:
|
---|
82 | return ExcelConditionalFormattingConstants.Operators.NotBetween;
|
---|
83 |
|
---|
84 | case eExcelConditionalFormattingOperatorType.NotContains:
|
---|
85 | return ExcelConditionalFormattingConstants.Operators.NotContains;
|
---|
86 |
|
---|
87 | case eExcelConditionalFormattingOperatorType.NotEqual:
|
---|
88 | return ExcelConditionalFormattingConstants.Operators.NotEqual;
|
---|
89 | }
|
---|
90 |
|
---|
91 | return string.Empty;
|
---|
92 | }
|
---|
93 |
|
---|
94 | /// <summary>
|
---|
95 | ///
|
---|
96 | /// </summary>
|
---|
97 | /// param name="attribute"
|
---|
98 | /// <returns></returns>
|
---|
99 | internal static eExcelConditionalFormattingOperatorType GetTypeByAttribute(
|
---|
100 | string attribute)
|
---|
101 | {
|
---|
102 | switch (attribute)
|
---|
103 | {
|
---|
104 | case ExcelConditionalFormattingConstants.Operators.BeginsWith:
|
---|
105 | return eExcelConditionalFormattingOperatorType.BeginsWith;
|
---|
106 |
|
---|
107 | case ExcelConditionalFormattingConstants.Operators.Between:
|
---|
108 | return eExcelConditionalFormattingOperatorType.Between;
|
---|
109 |
|
---|
110 | case ExcelConditionalFormattingConstants.Operators.ContainsText:
|
---|
111 | return eExcelConditionalFormattingOperatorType.ContainsText;
|
---|
112 |
|
---|
113 | case ExcelConditionalFormattingConstants.Operators.EndsWith:
|
---|
114 | return eExcelConditionalFormattingOperatorType.EndsWith;
|
---|
115 |
|
---|
116 | case ExcelConditionalFormattingConstants.Operators.Equal:
|
---|
117 | return eExcelConditionalFormattingOperatorType.Equal;
|
---|
118 |
|
---|
119 | case ExcelConditionalFormattingConstants.Operators.GreaterThan:
|
---|
120 | return eExcelConditionalFormattingOperatorType.GreaterThan;
|
---|
121 |
|
---|
122 | case ExcelConditionalFormattingConstants.Operators.GreaterThanOrEqual:
|
---|
123 | return eExcelConditionalFormattingOperatorType.GreaterThanOrEqual;
|
---|
124 |
|
---|
125 | case ExcelConditionalFormattingConstants.Operators.LessThan:
|
---|
126 | return eExcelConditionalFormattingOperatorType.LessThan;
|
---|
127 |
|
---|
128 | case ExcelConditionalFormattingConstants.Operators.LessThanOrEqual:
|
---|
129 | return eExcelConditionalFormattingOperatorType.LessThanOrEqual;
|
---|
130 |
|
---|
131 | case ExcelConditionalFormattingConstants.Operators.NotBetween:
|
---|
132 | return eExcelConditionalFormattingOperatorType.NotBetween;
|
---|
133 |
|
---|
134 | case ExcelConditionalFormattingConstants.Operators.NotContains:
|
---|
135 | return eExcelConditionalFormattingOperatorType.NotContains;
|
---|
136 |
|
---|
137 | case ExcelConditionalFormattingConstants.Operators.NotEqual:
|
---|
138 | return eExcelConditionalFormattingOperatorType.NotEqual;
|
---|
139 | }
|
---|
140 |
|
---|
141 | throw new Exception(
|
---|
142 | ExcelConditionalFormattingConstants.Errors.UnexistentOperatorTypeAttribute);
|
---|
143 | }
|
---|
144 | }
|
---|
145 | } |
---|