Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingThreeColorScale.cs @ 12074

Last change on this file since 12074 was 12074, checked in by sraggl, 9 years ago

#2341: Added EPPlus-4.0.3 to ExtLibs

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