Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Breadcrumbs/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/3.1.3/EPPlus-3.1.3/ConditionalFormatting/RangeConditionalFormatting.cs @ 10041

Last change on this file since 10041 was 9580, checked in by sforsten, 12 years ago

#1730:

  • added SymbolicDataAnalysisExpressionExcelFormatter
  • changed modifiers in SymbolicExpressionTreeChart of methods SaveImageAsBitmap and SaveImageAsEmf to public
  • added menu item ExportSymbolicSolutionToExcelMenuItem to export a symbolic solution to an excel file
  • added EPPlus-3.1.3 to ExtLibs
File size: 16.3 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       Conditional Formatting    2012-04-03
30 *******************************************************************************/
31using System;
32using System.Collections.Generic;
33using System.Linq;
34using System.Text;
35using OfficeOpenXml.Utils;
36using OfficeOpenXml.ConditionalFormatting.Contracts;
37
38namespace OfficeOpenXml.ConditionalFormatting
39{
40  internal class RangeConditionalFormatting
41    : IRangeConditionalFormatting
42  {
43    #region Public Properties
44    public ExcelWorksheet _worksheet;
45    public ExcelAddress _address;
46    #endregion Public Properties
47
48    #region Constructors
49    public RangeConditionalFormatting(
50      ExcelWorksheet worksheet,
51      ExcelAddress address)
52    {
53      Require.Argument(worksheet).IsNotNull("worksheet");
54      Require.Argument(address).IsNotNull("address");
55
56      _worksheet = worksheet;
57      _address = address;
58    }
59    #endregion Constructors
60
61    #region Conditional Formatting Rule Types
62    /// <summary>
63    /// Add AboveOrEqualAverage Conditional Formatting
64    /// </summary>
65    ///  <returns></returns>
66    public IExcelConditionalFormattingAverageGroup AddAboveAverage()
67    {
68      return _worksheet.ConditionalFormatting.AddAboveAverage(
69        _address);
70    }
71
72    /// <summary>
73    /// Add AboveOrEqualAverage Conditional Formatting
74    /// </summary>
75    ///  <returns></returns>
76    public IExcelConditionalFormattingAverageGroup AddAboveOrEqualAverage()
77    {
78      return _worksheet.ConditionalFormatting.AddAboveOrEqualAverage(
79        _address);
80    }
81
82    /// <summary>
83    /// Add BelowOrEqualAverage Conditional Formatting
84    /// </summary>
85    ///  <returns></returns>
86    public IExcelConditionalFormattingAverageGroup AddBelowAverage()
87    {
88      return _worksheet.ConditionalFormatting.AddBelowAverage(
89        _address);
90    }
91
92    /// <summary>
93    /// Add BelowOrEqualAverage Conditional Formatting
94    /// </summary>
95    ///  <returns></returns>
96    public IExcelConditionalFormattingAverageGroup AddBelowOrEqualAverage()
97    {
98      return _worksheet.ConditionalFormatting.AddBelowOrEqualAverage(
99        _address);
100    }
101
102    /// <summary>
103    /// Add AboveStdDev Conditional Formatting
104    /// </summary>
105    ///  <returns></returns>
106    public IExcelConditionalFormattingStdDevGroup AddAboveStdDev()
107    {
108      return _worksheet.ConditionalFormatting.AddAboveStdDev(
109        _address);
110    }
111
112    /// <summary>
113    /// Add BelowStdDev Conditional Formatting
114    /// </summary>
115    ///  <returns></returns>
116    public IExcelConditionalFormattingStdDevGroup AddBelowStdDev()
117    {
118      return _worksheet.ConditionalFormatting.AddBelowStdDev(
119        _address);
120    }
121
122    /// <summary>
123    /// Add Bottom Conditional Formatting
124    /// </summary>
125    ///  <returns></returns>
126    public IExcelConditionalFormattingTopBottomGroup AddBottom()
127    {
128      return _worksheet.ConditionalFormatting.AddBottom(
129        _address);
130    }
131
132    /// <summary>
133    /// Add BottomPercent Conditional Formatting
134    /// </summary>
135    ///  <returns></returns>
136    public IExcelConditionalFormattingTopBottomGroup AddBottomPercent()
137    {
138      return _worksheet.ConditionalFormatting.AddBottomPercent(
139        _address);
140    }
141
142    /// <summary>
143    /// Add Top Conditional Formatting
144    /// </summary>
145    ///  <returns></returns>
146    public IExcelConditionalFormattingTopBottomGroup AddTop()
147    {
148      return _worksheet.ConditionalFormatting.AddTop(
149        _address);
150    }
151
152    /// <summary>
153    /// Add TopPercent Conditional Formatting
154    /// </summary>
155    ///  <returns></returns>
156    public IExcelConditionalFormattingTopBottomGroup AddTopPercent()
157    {
158      return _worksheet.ConditionalFormatting.AddTopPercent(
159        _address);
160    }
161
162    /// <summary>
163    /// Add Last7Days Conditional Formatting
164    /// </summary>
165    ///  <returns></returns>
166    public IExcelConditionalFormattingTimePeriodGroup AddLast7Days()
167    {
168      return _worksheet.ConditionalFormatting.AddLast7Days(
169        _address);
170    }
171
172    /// <summary>
173    /// Add LastMonth Conditional Formatting
174    /// </summary>
175    ///  <returns></returns>
176    public IExcelConditionalFormattingTimePeriodGroup AddLastMonth()
177    {
178      return _worksheet.ConditionalFormatting.AddLastMonth(
179        _address);
180    }
181
182    /// <summary>
183    /// Add LastWeek Conditional Formatting
184    /// </summary>
185    ///  <returns></returns>
186    public IExcelConditionalFormattingTimePeriodGroup AddLastWeek()
187    {
188      return _worksheet.ConditionalFormatting.AddLastWeek(
189        _address);
190    }
191
192    /// <summary>
193    /// Add NextMonth Conditional Formatting
194    /// </summary>
195    ///  <returns></returns>
196    public IExcelConditionalFormattingTimePeriodGroup AddNextMonth()
197    {
198      return _worksheet.ConditionalFormatting.AddNextMonth(
199        _address);
200    }
201
202    /// <summary>
203    /// Add NextWeek Conditional Formatting
204    /// </summary>
205    ///  <returns></returns>
206    public IExcelConditionalFormattingTimePeriodGroup AddNextWeek()
207    {
208      return _worksheet.ConditionalFormatting.AddNextWeek(
209        _address);
210    }
211
212    /// <summary>
213    /// Add ThisMonth Conditional Formatting
214    /// </summary>
215    ///  <returns></returns>
216    public IExcelConditionalFormattingTimePeriodGroup AddThisMonth()
217    {
218      return _worksheet.ConditionalFormatting.AddThisMonth(
219        _address);
220    }
221
222    /// <summary>
223    /// Add ThisWeek Conditional Formatting
224    /// </summary>
225    ///  <returns></returns>
226    public IExcelConditionalFormattingTimePeriodGroup AddThisWeek()
227    {
228      return _worksheet.ConditionalFormatting.AddThisWeek(
229        _address);
230    }
231
232    /// <summary>
233    /// Add Today Conditional Formatting
234    /// </summary>
235    ///  <returns></returns>
236    public IExcelConditionalFormattingTimePeriodGroup AddToday()
237    {
238      return _worksheet.ConditionalFormatting.AddToday(
239        _address);
240    }
241
242    /// <summary>
243    /// Add Tomorrow Conditional Formatting
244    /// </summary>
245    ///  <returns></returns>
246    public IExcelConditionalFormattingTimePeriodGroup AddTomorrow()
247    {
248      return _worksheet.ConditionalFormatting.AddTomorrow(
249        _address);
250    }
251
252    /// <summary>
253    /// Add Yesterday Conditional Formatting
254    /// </summary>
255    ///  <returns></returns>
256    public IExcelConditionalFormattingTimePeriodGroup AddYesterday()
257    {
258      return _worksheet.ConditionalFormatting.AddYesterday(
259        _address);
260    }
261
262    /// <summary>
263    /// Add BeginsWith Conditional Formatting
264    /// </summary>
265    ///  <returns></returns>
266    public IExcelConditionalFormattingBeginsWith AddBeginsWith()
267    {
268      return _worksheet.ConditionalFormatting.AddBeginsWith(
269        _address);
270    }
271
272    /// <summary>
273    /// Add Between Conditional Formatting
274    /// </summary>
275    ///  <returns></returns>
276    public IExcelConditionalFormattingBetween AddBetween()
277    {
278      return _worksheet.ConditionalFormatting.AddBetween(
279        _address);
280    }
281
282    /// <summary>
283    /// Add ContainsBlanks Conditional Formatting
284    /// </summary>
285    ///  <returns></returns>
286    public IExcelConditionalFormattingContainsBlanks AddContainsBlanks()
287    {
288      return _worksheet.ConditionalFormatting.AddContainsBlanks(
289        _address);
290    }
291
292    /// <summary>
293    /// Add ContainsErrors Conditional Formatting
294    /// </summary>
295    ///  <returns></returns>
296    public IExcelConditionalFormattingContainsErrors AddContainsErrors()
297    {
298      return _worksheet.ConditionalFormatting.AddContainsErrors(
299        _address);
300    }
301
302    /// <summary>
303    /// Add ContainsText Conditional Formatting
304    /// </summary>
305    ///  <returns></returns>
306    public IExcelConditionalFormattingContainsText AddContainsText()
307    {
308      return _worksheet.ConditionalFormatting.AddContainsText(
309        _address);
310    }
311
312    /// <summary>
313    /// Add DuplicateValues Conditional Formatting
314    /// </summary>
315    ///  <returns></returns>
316    public IExcelConditionalFormattingDuplicateValues AddDuplicateValues()
317    {
318      return _worksheet.ConditionalFormatting.AddDuplicateValues(
319        _address);
320    }
321
322    /// <summary>
323    /// Add EndsWith Conditional Formatting
324    /// </summary>
325    ///  <returns></returns>
326    public IExcelConditionalFormattingEndsWith AddEndsWith()
327    {
328      return _worksheet.ConditionalFormatting.AddEndsWith(
329        _address);
330    }
331
332    /// <summary>
333    /// Add Equal Conditional Formatting
334    /// </summary>
335    ///  <returns></returns>
336    public IExcelConditionalFormattingEqual AddEqual()
337    {
338      return _worksheet.ConditionalFormatting.AddEqual(
339        _address);
340    }
341
342    /// <summary>
343    /// Add Expression Conditional Formatting
344    /// </summary>
345    ///  <returns></returns>
346    public IExcelConditionalFormattingExpression AddExpression()
347    {
348      return _worksheet.ConditionalFormatting.AddExpression(
349        _address);
350    }
351
352    /// <summary>
353    /// Add GreaterThan Conditional Formatting
354    /// </summary>
355    ///  <returns></returns>
356    public IExcelConditionalFormattingGreaterThan AddGreaterThan()
357    {
358      return _worksheet.ConditionalFormatting.AddGreaterThan(
359        _address);
360    }
361
362    /// <summary>
363    /// Add GreaterThanOrEqual Conditional Formatting
364    /// </summary>
365    ///  <returns></returns>
366    public IExcelConditionalFormattingGreaterThanOrEqual AddGreaterThanOrEqual()
367    {
368      return _worksheet.ConditionalFormatting.AddGreaterThanOrEqual(
369        _address);
370    }
371
372    /// <summary>
373    /// Add LessThan Conditional Formatting
374    /// </summary>
375    ///  <returns></returns>
376    public IExcelConditionalFormattingLessThan AddLessThan()
377    {
378      return _worksheet.ConditionalFormatting.AddLessThan(
379        _address);
380    }
381
382    /// <summary>
383    /// Add LessThanOrEqual Conditional Formatting
384    /// </summary>
385    ///  <returns></returns>
386    public IExcelConditionalFormattingLessThanOrEqual AddLessThanOrEqual()
387    {
388      return _worksheet.ConditionalFormatting.AddLessThanOrEqual(
389        _address);
390    }
391
392    /// <summary>
393    /// Add NotBetween Conditional Formatting
394    /// </summary>
395    ///  <returns></returns>
396    public IExcelConditionalFormattingNotBetween AddNotBetween()
397    {
398      return _worksheet.ConditionalFormatting.AddNotBetween(
399        _address);
400    }
401
402    /// <summary>
403    /// Add NotContainsBlanks Conditional Formatting
404    /// </summary>
405    ///  <returns></returns>
406    public IExcelConditionalFormattingNotContainsBlanks AddNotContainsBlanks()
407    {
408      return _worksheet.ConditionalFormatting.AddNotContainsBlanks(
409        _address);
410    }
411
412    /// <summary>
413    /// Add NotContainsErrors Conditional Formatting
414    /// </summary>
415    ///  <returns></returns>
416    public IExcelConditionalFormattingNotContainsErrors AddNotContainsErrors()
417    {
418      return _worksheet.ConditionalFormatting.AddNotContainsErrors(
419        _address);
420    }
421
422    /// <summary>
423    /// Add NotContainsText Conditional Formatting
424    /// </summary>
425    ///  <returns></returns>
426    public IExcelConditionalFormattingNotContainsText AddNotContainsText()
427    {
428      return _worksheet.ConditionalFormatting.AddNotContainsText(
429        _address);
430    }
431
432    /// <summary>
433    /// Add NotEqual Conditional Formatting
434    /// </summary>
435    ///  <returns></returns>
436    public IExcelConditionalFormattingNotEqual AddNotEqual()
437    {
438      return _worksheet.ConditionalFormatting.AddNotEqual(
439        _address);
440    }
441
442    /// <summary>
443    /// Add UniqueValues Conditional Formatting
444    /// </summary>
445    ///  <returns></returns>
446    public IExcelConditionalFormattingUniqueValues AddUniqueValues()
447    {
448      return _worksheet.ConditionalFormatting.AddUniqueValues(
449        _address);
450    }
451
452    /// <summary>
453    /// Add ThreeColorScale Conditional Formatting
454    /// </summary>
455    ///  <returns></returns>
456    public IExcelConditionalFormattingThreeColorScale AddThreeColorScale()
457    {
458      return (IExcelConditionalFormattingThreeColorScale)(_worksheet.ConditionalFormatting.AddRule(
459        eExcelConditionalFormattingRuleType.ThreeColorScale,
460        _address));
461    }
462
463    /// <summary>
464    /// Add TwoColorScale Conditional Formatting
465    /// </summary>
466    ///  <returns></returns>
467    public IExcelConditionalFormattingTwoColorScale AddTwoColorScale()
468    {
469      return (IExcelConditionalFormattingTwoColorScale)(_worksheet.ConditionalFormatting.AddRule(
470        eExcelConditionalFormattingRuleType.TwoColorScale,
471        _address));
472    }
473
474    /// <summary>
475    /// Adds a ThreeIconSet rule
476    /// </summary>
477    /// <param name="IconSet"></param>
478    /// <returns></returns>
479    public IExcelConditionalFormattingThreeIconSet<eExcelconditionalFormatting3IconsSetType> AddThreeIconSet(eExcelconditionalFormatting3IconsSetType IconSet)
480    {
481        var rule = (IExcelConditionalFormattingThreeIconSet<eExcelconditionalFormatting3IconsSetType>)(_worksheet.ConditionalFormatting.AddRule(
482          eExcelConditionalFormattingRuleType.ThreeIconSet,
483          _address));
484        rule.IconSet = IconSet;
485        return rule;
486    }
487
488    /// <summary>
489    /// Adds a FourIconSet rule
490    /// </summary>
491    /// <param name="IconSet"></param>
492    /// <returns></returns>
493    public IExcelConditionalFormattingFourIconSet<eExcelconditionalFormatting4IconsSetType> AddFourIconSet(eExcelconditionalFormatting4IconsSetType IconSet)
494    {
495        var rule = (IExcelConditionalFormattingFourIconSet<eExcelconditionalFormatting4IconsSetType>)(_worksheet.ConditionalFormatting.AddRule(
496          eExcelConditionalFormattingRuleType.FourIconSet,
497          _address));
498        rule.IconSet = IconSet;
499        return rule;
500    }
501
502    /// <summary>
503    /// Adds a FiveIconSet rule
504    /// </summary>
505    /// <param name="IconSet"></param>
506    /// <returns></returns>
507    public IExcelConditionalFormattingFiveIconSet AddFiveIconSet(eExcelconditionalFormatting5IconsSetType IconSet)
508    {
509        var rule = (IExcelConditionalFormattingFiveIconSet)(_worksheet.ConditionalFormatting.AddRule(
510          eExcelConditionalFormattingRuleType.FiveIconSet,
511          _address));
512        rule.IconSet = IconSet;
513        return rule;
514    }
515
516    /// <summary>
517    /// Adds a Databar rule
518    /// </summary>
519    /// <param name="Color">The color of the databar</param>
520    /// <returns></returns>
521    public IExcelConditionalFormattingDataBarGroup AddDatabar(System.Drawing.Color Color)
522    {
523        var rule = (IExcelConditionalFormattingDataBarGroup)(_worksheet.ConditionalFormatting.AddRule(
524          eExcelConditionalFormattingRuleType.DataBar,
525          _address));
526        rule.Color = Color;
527        return rule;
528    }
529    #endregion Conditional Formatting Rule Types
530  }
531}
Note: See TracBrowser for help on using the repository browser.