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="ExcelConditionalFormattingTimePeriodType"/>
|
---|
41 | /// </summary>
|
---|
42 | internal static class ExcelConditionalFormattingTimePeriodType
|
---|
43 | {
|
---|
44 | /// <summary>
|
---|
45 | ///
|
---|
46 | /// </summary>
|
---|
47 | /// <param name="type"></param>
|
---|
48 | /// <returns></returns>
|
---|
49 | public static string GetAttributeByType(
|
---|
50 | eExcelConditionalFormattingTimePeriodType type)
|
---|
51 | {
|
---|
52 | switch (type)
|
---|
53 | {
|
---|
54 | case eExcelConditionalFormattingTimePeriodType.Last7Days:
|
---|
55 | return ExcelConditionalFormattingConstants.TimePeriods.Last7Days;
|
---|
56 |
|
---|
57 | case eExcelConditionalFormattingTimePeriodType.LastMonth:
|
---|
58 | return ExcelConditionalFormattingConstants.TimePeriods.LastMonth;
|
---|
59 |
|
---|
60 | case eExcelConditionalFormattingTimePeriodType.LastWeek:
|
---|
61 | return ExcelConditionalFormattingConstants.TimePeriods.LastWeek;
|
---|
62 |
|
---|
63 | case eExcelConditionalFormattingTimePeriodType.NextMonth:
|
---|
64 | return ExcelConditionalFormattingConstants.TimePeriods.NextMonth;
|
---|
65 |
|
---|
66 | case eExcelConditionalFormattingTimePeriodType.NextWeek:
|
---|
67 | return ExcelConditionalFormattingConstants.TimePeriods.NextWeek;
|
---|
68 |
|
---|
69 | case eExcelConditionalFormattingTimePeriodType.ThisMonth:
|
---|
70 | return ExcelConditionalFormattingConstants.TimePeriods.ThisMonth;
|
---|
71 |
|
---|
72 | case eExcelConditionalFormattingTimePeriodType.ThisWeek:
|
---|
73 | return ExcelConditionalFormattingConstants.TimePeriods.ThisWeek;
|
---|
74 |
|
---|
75 | case eExcelConditionalFormattingTimePeriodType.Today:
|
---|
76 | return ExcelConditionalFormattingConstants.TimePeriods.Today;
|
---|
77 |
|
---|
78 | case eExcelConditionalFormattingTimePeriodType.Tomorrow:
|
---|
79 | return ExcelConditionalFormattingConstants.TimePeriods.Tomorrow;
|
---|
80 |
|
---|
81 | case eExcelConditionalFormattingTimePeriodType.Yesterday:
|
---|
82 | return ExcelConditionalFormattingConstants.TimePeriods.Yesterday;
|
---|
83 | }
|
---|
84 |
|
---|
85 | return string.Empty;
|
---|
86 | }
|
---|
87 |
|
---|
88 | /// <summary>
|
---|
89 | ///
|
---|
90 | /// </summary>
|
---|
91 | /// <param name="attribute"></param>
|
---|
92 | /// <returns></returns>
|
---|
93 | public static eExcelConditionalFormattingTimePeriodType GetTypeByAttribute(
|
---|
94 | string attribute)
|
---|
95 | {
|
---|
96 | switch (attribute)
|
---|
97 | {
|
---|
98 | case ExcelConditionalFormattingConstants.TimePeriods.Last7Days:
|
---|
99 | return eExcelConditionalFormattingTimePeriodType.Last7Days;
|
---|
100 |
|
---|
101 | case ExcelConditionalFormattingConstants.TimePeriods.LastMonth:
|
---|
102 | return eExcelConditionalFormattingTimePeriodType.LastMonth;
|
---|
103 |
|
---|
104 | case ExcelConditionalFormattingConstants.TimePeriods.LastWeek:
|
---|
105 | return eExcelConditionalFormattingTimePeriodType.LastWeek;
|
---|
106 |
|
---|
107 | case ExcelConditionalFormattingConstants.TimePeriods.NextMonth:
|
---|
108 | return eExcelConditionalFormattingTimePeriodType.NextMonth;
|
---|
109 |
|
---|
110 | case ExcelConditionalFormattingConstants.TimePeriods.NextWeek:
|
---|
111 | return eExcelConditionalFormattingTimePeriodType.NextWeek;
|
---|
112 |
|
---|
113 | case ExcelConditionalFormattingConstants.TimePeriods.ThisMonth:
|
---|
114 | return eExcelConditionalFormattingTimePeriodType.ThisMonth;
|
---|
115 |
|
---|
116 | case ExcelConditionalFormattingConstants.TimePeriods.ThisWeek:
|
---|
117 | return eExcelConditionalFormattingTimePeriodType.ThisWeek;
|
---|
118 |
|
---|
119 | case ExcelConditionalFormattingConstants.TimePeriods.Today:
|
---|
120 | return eExcelConditionalFormattingTimePeriodType.Today;
|
---|
121 |
|
---|
122 | case ExcelConditionalFormattingConstants.TimePeriods.Tomorrow:
|
---|
123 | return eExcelConditionalFormattingTimePeriodType.Tomorrow;
|
---|
124 |
|
---|
125 | case ExcelConditionalFormattingConstants.TimePeriods.Yesterday:
|
---|
126 | return eExcelConditionalFormattingTimePeriodType.Yesterday;
|
---|
127 | }
|
---|
128 |
|
---|
129 | throw new Exception(
|
---|
130 | ExcelConditionalFormattingConstants.Errors.UnexistentTimePeriodTypeAttribute);
|
---|
131 | }
|
---|
132 | }
|
---|
133 | } |
---|