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 Added 2012-04-03
|
---|
30 | *******************************************************************************/
|
---|
31 | using System;
|
---|
32 | using System.Collections.Generic;
|
---|
33 | using System.Linq;
|
---|
34 | using System.Text;
|
---|
35 | using System.Drawing;
|
---|
36 | using System.Xml;
|
---|
37 | using OfficeOpenXml.ConditionalFormatting.Contracts;
|
---|
38 |
|
---|
39 | namespace OfficeOpenXml.ConditionalFormatting
|
---|
40 | {
|
---|
41 | /// <summary>
|
---|
42 | /// ExcelConditionalFormattingTwoColorScale
|
---|
43 | /// </summary>
|
---|
44 | public class ExcelConditionalFormattingTwoColorScale
|
---|
45 | : ExcelConditionalFormattingRule,
|
---|
46 | IExcelConditionalFormattingTwoColorScale
|
---|
47 | {
|
---|
48 | /****************************************************************************************/
|
---|
49 |
|
---|
50 | #region Private Properties
|
---|
51 | /// <summary>
|
---|
52 | /// Private Low Value
|
---|
53 | /// </summary>
|
---|
54 | private ExcelConditionalFormattingColorScaleValue _lowValue;
|
---|
55 |
|
---|
56 | /// <summary>
|
---|
57 | /// Private High Value
|
---|
58 | /// </summary>
|
---|
59 | private ExcelConditionalFormattingColorScaleValue _highValue;
|
---|
60 | #endregion Private Properties
|
---|
61 |
|
---|
62 | /****************************************************************************************/
|
---|
63 |
|
---|
64 | #region Constructors
|
---|
65 | /// <summary>
|
---|
66 | ///
|
---|
67 | /// </summary>
|
---|
68 | /// <param name="priority"></param>
|
---|
69 | /// <param name="address"></param>
|
---|
70 | /// <param name="worksheet"></param>
|
---|
71 | /// <param name="itemElementNode"></param>
|
---|
72 | /// <param name="namespaceManager"></param>
|
---|
73 | internal ExcelConditionalFormattingTwoColorScale(
|
---|
74 | ExcelAddress address,
|
---|
75 | int priority,
|
---|
76 | ExcelWorksheet worksheet,
|
---|
77 | XmlNode itemElementNode,
|
---|
78 | XmlNamespaceManager namespaceManager)
|
---|
79 | : base(
|
---|
80 | eExcelConditionalFormattingRuleType.TwoColorScale,
|
---|
81 | address,
|
---|
82 | priority,
|
---|
83 | worksheet,
|
---|
84 | itemElementNode,
|
---|
85 | (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
|
---|
86 | {
|
---|
87 | // Create the <colorScale> node inside the <cfRule> node
|
---|
88 | var colorScaleNode = CreateComplexNode(
|
---|
89 | Node,
|
---|
90 | ExcelConditionalFormattingConstants.Paths.ColorScale);
|
---|
91 |
|
---|
92 | // LowValue default
|
---|
93 | LowValue = new ExcelConditionalFormattingColorScaleValue(
|
---|
94 | eExcelConditionalFormattingValueObjectPosition.Low,
|
---|
95 | eExcelConditionalFormattingValueObjectType.Min,
|
---|
96 | ColorTranslator.FromHtml(ExcelConditionalFormattingConstants.Colors.CfvoLowValue),
|
---|
97 | eExcelConditionalFormattingRuleType.TwoColorScale,
|
---|
98 | address,
|
---|
99 | priority,
|
---|
100 | worksheet,
|
---|
101 | NameSpaceManager);
|
---|
102 |
|
---|
103 | // HighValue default
|
---|
104 | HighValue = new ExcelConditionalFormattingColorScaleValue(
|
---|
105 | eExcelConditionalFormattingValueObjectPosition.High,
|
---|
106 | eExcelConditionalFormattingValueObjectType.Max,
|
---|
107 | ColorTranslator.FromHtml(ExcelConditionalFormattingConstants.Colors.CfvoHighValue),
|
---|
108 | eExcelConditionalFormattingRuleType.TwoColorScale,
|
---|
109 | address,
|
---|
110 | priority,
|
---|
111 | worksheet,
|
---|
112 | NameSpaceManager);
|
---|
113 | }
|
---|
114 |
|
---|
115 | /// <summary>
|
---|
116 | ///
|
---|
117 | /// </summary>
|
---|
118 | /// <param name="priority"></param>
|
---|
119 | /// <param name="address"></param>
|
---|
120 | /// <param name="worksheet"></param>
|
---|
121 | /// <param name="itemElementNode"></param>
|
---|
122 | internal ExcelConditionalFormattingTwoColorScale(
|
---|
123 | ExcelAddress address,
|
---|
124 | int priority,
|
---|
125 | ExcelWorksheet worksheet,
|
---|
126 | XmlNode itemElementNode)
|
---|
127 | : this(
|
---|
128 | address,
|
---|
129 | priority,
|
---|
130 | worksheet,
|
---|
131 | itemElementNode,
|
---|
132 | null)
|
---|
133 | {
|
---|
134 | }
|
---|
135 |
|
---|
136 | /// <summary>
|
---|
137 | ///
|
---|
138 | /// </summary>
|
---|
139 | /// <param name="priority"></param>
|
---|
140 | /// <param name="address"></param>
|
---|
141 | /// <param name="worksheet"></param>
|
---|
142 | internal ExcelConditionalFormattingTwoColorScale(
|
---|
143 | ExcelAddress address,
|
---|
144 | int priority,
|
---|
145 | ExcelWorksheet worksheet)
|
---|
146 | : this(
|
---|
147 | address,
|
---|
148 | priority,
|
---|
149 | worksheet,
|
---|
150 | null,
|
---|
151 | null)
|
---|
152 | {
|
---|
153 | }
|
---|
154 | #endregion Constructors
|
---|
155 |
|
---|
156 | /****************************************************************************************/
|
---|
157 |
|
---|
158 | #region Public Properties
|
---|
159 | /// <summary>
|
---|
160 | /// Low Value for Two Color Scale Object Value
|
---|
161 | /// </summary>
|
---|
162 | public ExcelConditionalFormattingColorScaleValue LowValue
|
---|
163 | {
|
---|
164 | get { return _lowValue; }
|
---|
165 | set { _lowValue = value; }
|
---|
166 | }
|
---|
167 |
|
---|
168 | /// <summary>
|
---|
169 | /// High Value for Two Color Scale Object Value
|
---|
170 | /// </summary>
|
---|
171 | public ExcelConditionalFormattingColorScaleValue HighValue
|
---|
172 | {
|
---|
173 | get { return _highValue; }
|
---|
174 | set { _highValue = value; }
|
---|
175 | }
|
---|
176 | #endregion Public Properties
|
---|
177 |
|
---|
178 | /****************************************************************************************/
|
---|
179 | }
|
---|
180 | } |
---|