/*******************************************************************************
* You may amend and distribute as you like, but don't remove this header!
*
* EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
* See http://www.codeplex.com/EPPlus for details.
*
* Copyright (C) 2011 Jan Källman
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
* If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
*
* All code and executables are provided "as is" with no warranty either express or implied.
* The author accepts no liability for any damage or loss of business that this product may cause.
*
* Code change notes:
*
* Author Change Date
* ******************************************************************************
* Eyal Seagull Conditional Formatting 2012-04-03
*******************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OfficeOpenXml.Utils;
using OfficeOpenXml.ConditionalFormatting.Contracts;
namespace OfficeOpenXml.ConditionalFormatting
{
internal class RangeConditionalFormatting
: IRangeConditionalFormatting
{
#region Public Properties
public ExcelWorksheet _worksheet;
public ExcelAddress _address;
#endregion Public Properties
#region Constructors
public RangeConditionalFormatting(
ExcelWorksheet worksheet,
ExcelAddress address)
{
Require.Argument(worksheet).IsNotNull("worksheet");
Require.Argument(address).IsNotNull("address");
_worksheet = worksheet;
_address = address;
}
#endregion Constructors
#region Conditional Formatting Rule Types
///
/// Add AboveOrEqualAverage Conditional Formatting
///
///
public IExcelConditionalFormattingAverageGroup AddAboveAverage()
{
return _worksheet.ConditionalFormatting.AddAboveAverage(
_address);
}
///
/// Add AboveOrEqualAverage Conditional Formatting
///
///
public IExcelConditionalFormattingAverageGroup AddAboveOrEqualAverage()
{
return _worksheet.ConditionalFormatting.AddAboveOrEqualAverage(
_address);
}
///
/// Add BelowOrEqualAverage Conditional Formatting
///
///
public IExcelConditionalFormattingAverageGroup AddBelowAverage()
{
return _worksheet.ConditionalFormatting.AddBelowAverage(
_address);
}
///
/// Add BelowOrEqualAverage Conditional Formatting
///
///
public IExcelConditionalFormattingAverageGroup AddBelowOrEqualAverage()
{
return _worksheet.ConditionalFormatting.AddBelowOrEqualAverage(
_address);
}
///
/// Add AboveStdDev Conditional Formatting
///
///
public IExcelConditionalFormattingStdDevGroup AddAboveStdDev()
{
return _worksheet.ConditionalFormatting.AddAboveStdDev(
_address);
}
///
/// Add BelowStdDev Conditional Formatting
///
///
public IExcelConditionalFormattingStdDevGroup AddBelowStdDev()
{
return _worksheet.ConditionalFormatting.AddBelowStdDev(
_address);
}
///
/// Add Bottom Conditional Formatting
///
///
public IExcelConditionalFormattingTopBottomGroup AddBottom()
{
return _worksheet.ConditionalFormatting.AddBottom(
_address);
}
///
/// Add BottomPercent Conditional Formatting
///
///
public IExcelConditionalFormattingTopBottomGroup AddBottomPercent()
{
return _worksheet.ConditionalFormatting.AddBottomPercent(
_address);
}
///
/// Add Top Conditional Formatting
///
///
public IExcelConditionalFormattingTopBottomGroup AddTop()
{
return _worksheet.ConditionalFormatting.AddTop(
_address);
}
///
/// Add TopPercent Conditional Formatting
///
///
public IExcelConditionalFormattingTopBottomGroup AddTopPercent()
{
return _worksheet.ConditionalFormatting.AddTopPercent(
_address);
}
///
/// Add Last7Days Conditional Formatting
///
///
public IExcelConditionalFormattingTimePeriodGroup AddLast7Days()
{
return _worksheet.ConditionalFormatting.AddLast7Days(
_address);
}
///
/// Add LastMonth Conditional Formatting
///
///
public IExcelConditionalFormattingTimePeriodGroup AddLastMonth()
{
return _worksheet.ConditionalFormatting.AddLastMonth(
_address);
}
///
/// Add LastWeek Conditional Formatting
///
///
public IExcelConditionalFormattingTimePeriodGroup AddLastWeek()
{
return _worksheet.ConditionalFormatting.AddLastWeek(
_address);
}
///
/// Add NextMonth Conditional Formatting
///
///
public IExcelConditionalFormattingTimePeriodGroup AddNextMonth()
{
return _worksheet.ConditionalFormatting.AddNextMonth(
_address);
}
///
/// Add NextWeek Conditional Formatting
///
///
public IExcelConditionalFormattingTimePeriodGroup AddNextWeek()
{
return _worksheet.ConditionalFormatting.AddNextWeek(
_address);
}
///
/// Add ThisMonth Conditional Formatting
///
///
public IExcelConditionalFormattingTimePeriodGroup AddThisMonth()
{
return _worksheet.ConditionalFormatting.AddThisMonth(
_address);
}
///
/// Add ThisWeek Conditional Formatting
///
///
public IExcelConditionalFormattingTimePeriodGroup AddThisWeek()
{
return _worksheet.ConditionalFormatting.AddThisWeek(
_address);
}
///
/// Add Today Conditional Formatting
///
///
public IExcelConditionalFormattingTimePeriodGroup AddToday()
{
return _worksheet.ConditionalFormatting.AddToday(
_address);
}
///
/// Add Tomorrow Conditional Formatting
///
///
public IExcelConditionalFormattingTimePeriodGroup AddTomorrow()
{
return _worksheet.ConditionalFormatting.AddTomorrow(
_address);
}
///
/// Add Yesterday Conditional Formatting
///
///
public IExcelConditionalFormattingTimePeriodGroup AddYesterday()
{
return _worksheet.ConditionalFormatting.AddYesterday(
_address);
}
///
/// Add BeginsWith Conditional Formatting
///
///
public IExcelConditionalFormattingBeginsWith AddBeginsWith()
{
return _worksheet.ConditionalFormatting.AddBeginsWith(
_address);
}
///
/// Add Between Conditional Formatting
///
///
public IExcelConditionalFormattingBetween AddBetween()
{
return _worksheet.ConditionalFormatting.AddBetween(
_address);
}
///
/// Add ContainsBlanks Conditional Formatting
///
///
public IExcelConditionalFormattingContainsBlanks AddContainsBlanks()
{
return _worksheet.ConditionalFormatting.AddContainsBlanks(
_address);
}
///
/// Add ContainsErrors Conditional Formatting
///
///
public IExcelConditionalFormattingContainsErrors AddContainsErrors()
{
return _worksheet.ConditionalFormatting.AddContainsErrors(
_address);
}
///
/// Add ContainsText Conditional Formatting
///
///
public IExcelConditionalFormattingContainsText AddContainsText()
{
return _worksheet.ConditionalFormatting.AddContainsText(
_address);
}
///
/// Add DuplicateValues Conditional Formatting
///
///
public IExcelConditionalFormattingDuplicateValues AddDuplicateValues()
{
return _worksheet.ConditionalFormatting.AddDuplicateValues(
_address);
}
///
/// Add EndsWith Conditional Formatting
///
///
public IExcelConditionalFormattingEndsWith AddEndsWith()
{
return _worksheet.ConditionalFormatting.AddEndsWith(
_address);
}
///
/// Add Equal Conditional Formatting
///
///
public IExcelConditionalFormattingEqual AddEqual()
{
return _worksheet.ConditionalFormatting.AddEqual(
_address);
}
///
/// Add Expression Conditional Formatting
///
///
public IExcelConditionalFormattingExpression AddExpression()
{
return _worksheet.ConditionalFormatting.AddExpression(
_address);
}
///
/// Add GreaterThan Conditional Formatting
///
///
public IExcelConditionalFormattingGreaterThan AddGreaterThan()
{
return _worksheet.ConditionalFormatting.AddGreaterThan(
_address);
}
///
/// Add GreaterThanOrEqual Conditional Formatting
///
///
public IExcelConditionalFormattingGreaterThanOrEqual AddGreaterThanOrEqual()
{
return _worksheet.ConditionalFormatting.AddGreaterThanOrEqual(
_address);
}
///
/// Add LessThan Conditional Formatting
///
///
public IExcelConditionalFormattingLessThan AddLessThan()
{
return _worksheet.ConditionalFormatting.AddLessThan(
_address);
}
///
/// Add LessThanOrEqual Conditional Formatting
///
///
public IExcelConditionalFormattingLessThanOrEqual AddLessThanOrEqual()
{
return _worksheet.ConditionalFormatting.AddLessThanOrEqual(
_address);
}
///
/// Add NotBetween Conditional Formatting
///
///
public IExcelConditionalFormattingNotBetween AddNotBetween()
{
return _worksheet.ConditionalFormatting.AddNotBetween(
_address);
}
///
/// Add NotContainsBlanks Conditional Formatting
///
///
public IExcelConditionalFormattingNotContainsBlanks AddNotContainsBlanks()
{
return _worksheet.ConditionalFormatting.AddNotContainsBlanks(
_address);
}
///
/// Add NotContainsErrors Conditional Formatting
///
///
public IExcelConditionalFormattingNotContainsErrors AddNotContainsErrors()
{
return _worksheet.ConditionalFormatting.AddNotContainsErrors(
_address);
}
///
/// Add NotContainsText Conditional Formatting
///
///
public IExcelConditionalFormattingNotContainsText AddNotContainsText()
{
return _worksheet.ConditionalFormatting.AddNotContainsText(
_address);
}
///
/// Add NotEqual Conditional Formatting
///
///
public IExcelConditionalFormattingNotEqual AddNotEqual()
{
return _worksheet.ConditionalFormatting.AddNotEqual(
_address);
}
///
/// Add UniqueValues Conditional Formatting
///
///
public IExcelConditionalFormattingUniqueValues AddUniqueValues()
{
return _worksheet.ConditionalFormatting.AddUniqueValues(
_address);
}
///
/// Add ThreeColorScale Conditional Formatting
///
///
public IExcelConditionalFormattingThreeColorScale AddThreeColorScale()
{
return (IExcelConditionalFormattingThreeColorScale)(_worksheet.ConditionalFormatting.AddRule(
eExcelConditionalFormattingRuleType.ThreeColorScale,
_address));
}
///
/// Add TwoColorScale Conditional Formatting
///
///
public IExcelConditionalFormattingTwoColorScale AddTwoColorScale()
{
return (IExcelConditionalFormattingTwoColorScale)(_worksheet.ConditionalFormatting.AddRule(
eExcelConditionalFormattingRuleType.TwoColorScale,
_address));
}
///
/// Adds a ThreeIconSet rule
///
///
///
public IExcelConditionalFormattingThreeIconSet AddThreeIconSet(eExcelconditionalFormatting3IconsSetType IconSet)
{
var rule = (IExcelConditionalFormattingThreeIconSet)(_worksheet.ConditionalFormatting.AddRule(
eExcelConditionalFormattingRuleType.ThreeIconSet,
_address));
rule.IconSet = IconSet;
return rule;
}
///
/// Adds a FourIconSet rule
///
///
///
public IExcelConditionalFormattingFourIconSet AddFourIconSet(eExcelconditionalFormatting4IconsSetType IconSet)
{
var rule = (IExcelConditionalFormattingFourIconSet)(_worksheet.ConditionalFormatting.AddRule(
eExcelConditionalFormattingRuleType.FourIconSet,
_address));
rule.IconSet = IconSet;
return rule;
}
///
/// Adds a FiveIconSet rule
///
///
///
public IExcelConditionalFormattingFiveIconSet AddFiveIconSet(eExcelconditionalFormatting5IconsSetType IconSet)
{
var rule = (IExcelConditionalFormattingFiveIconSet)(_worksheet.ConditionalFormatting.AddRule(
eExcelConditionalFormattingRuleType.FiveIconSet,
_address));
rule.IconSet = IconSet;
return rule;
}
///
/// Adds a Databar rule
///
/// The color of the databar
///
public IExcelConditionalFormattingDataBarGroup AddDatabar(System.Drawing.Color Color)
{
var rule = (IExcelConditionalFormattingDataBarGroup)(_worksheet.ConditionalFormatting.AddRule(
eExcelConditionalFormattingRuleType.DataBar,
_address));
rule.Color = Color;
return rule;
}
#endregion Conditional Formatting Rule Types
}
}