Spread Windows Forms 13.0 Product Documentation
FarPoint.Win.Spread Assembly / FarPoint.Win.Spread Namespace / TimePeriod Enumeration
Example Example


In This Topic
    TimePeriod Enumeration
    In This Topic
    Represents a time period which is used in a date conditional formatting rule. These are dynamic time periods, which change based on the date when the conditional formatting rule is refreshed or applied.
    Syntax
    'Declaration
     
    Public Enum TimePeriod 
       Inherits System.Enum
    'Usage
     
    Dim instance As TimePeriod
    public enum TimePeriod : System.Enum 
    Members
    MemberDescription
    Last7Days Indicates a date in the last seven days.
    LastMonth Indicates a date that occurred in the last calendar month.
    LastWeek Indicates a date that occurred last week.
    NextMonth Indicates a date that occurs in the next calendar month.
    NextWeek Indicates a date that occurs next week.
    ThisMonth Indicates a date that occurs in this calendar month.
    ThisWeek Indicates a date that occurs this week.
    Today Indicates today's date.
    Tomorrow Indicates tomorrow's date.
    Yesterday Indicates yesterday's date.
    Example
    This example creates a conditional rule.
    private void Form1_Load(object sender, EventArgs e)
            {
                fpSpread1.Sheets[0].Cells[1, 1].Value = DateTime.Now;
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                //Date Occurs CF
                FarPoint.Win.Spread.TimePeriodConditionalFormattingRule time = new FarPoint.Win.Spread.TimePeriodConditionalFormattingRule(FarPoint.Win.Spread.TimePeriod.Last7Days);
                time.TimePeriod = FarPoint.Win.Spread.TimePeriod.Last7Days;
                time.ForeColor = Color.Magenta;
                fpSpread1.ActiveSheet.SetConditionalFormatting(1, 1, time);
            }
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 
            FpSpread1.Sheets(0).Cells(1, 1).Value = Date.Now
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            'Date Occurs CF
            Dim time As New FarPoint.Win.Spread.TimePeriodConditionalFormattingRule(FarPoint.Win.Spread.TimePeriod.Last7Days)
            time.TimePeriod = FarPoint.Win.Spread.TimePeriod.Last7Days
            time.ForeColor = Color.DarkMagenta
            FpSpread1.ActiveSheet.SetConditionalFormatting(1, 1, time)
        End Sub
    Inheritance Hierarchy

    System.Object
       System.ValueType
          System.Enum
             FarPoint.Win.Spread.TimePeriod

    See Also