Class CheckBox

Class CheckBox

Namespace: Aspose.Note
Assembly: Aspose.Note.dll (24.12.0)

The base class for tags that can toggle their state between complete and incomplete.

public abstract class CheckBox : ITag

Inheritance

objectCheckBox

Derived

NoteCheckBox, NoteTask

Implements

ITag

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Examples

Shows how to generate a pdf containing all pages related to ‘Project A’.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Tags();

                                                                               // Load the document into Aspose.Note.
                                                                               var oneFile = new Document(Path.Combine(dataDir, "ProjectNotes.one"));

                                                                               var report = new Document();
                                                                               foreach (var page in oneFile)
                                                                               {
                                                                                   if (page.GetChildNodes<itaggable>().Any(e =&gt; e.Tags.Any(x =&gt; x.Label.Contains("Project A"))))
                                                                                   {
                                                                                       report.AppendChildLast(page.Clone());
                                                                                   }
                                                                               }

                                                                               report.Save(Path.Combine(dataDir, "ProjectA_Report.pdf"));</itaggable>

Shows how to make completed all checkbox items related to 'Project C'.```csharp
// The path to the documents directory.
                                                                                 string dataDir = RunExamples.GetDataDir_Tags();

                                                                                 // Load the document into Aspose.Note.
                                                                                 var oneFile = new Document(Path.Combine(dataDir, "ProjectNotes.one"));

                                                                                 foreach (var node in oneFile.GetChildNodes<itaggable>())
                                                                                 {
                                                                                     foreach (var checkBox in node.Tags.OfType<checkbox>())
                                                                                     {
                                                                                         if (checkBox.Label.Contains("Project C") &amp;&amp; !checkBox.Checked)
                                                                                         {
                                                                                             checkBox.SetCompleted();
                                                                                         }
                                                                                     }
                                                                                 }

                                                                                 oneFile.Save(Path.Combine(dataDir, ClosedProjectCNotesFileName));</checkbox></itaggable>

Shows how to make open all checkbox items related to ‘Project C’.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Tags();

                                                                        // Load the document into Aspose.Note.
                                                                        var oneFile = new Document(Path.Combine(dataDir, ClosedProjectCNotesFileName));

                                                                        foreach (var node in oneFile.GetChildNodes<itaggable>())
                                                                        {
                                                                            foreach (var checkBox in node.Tags.OfType<checkbox>())
                                                                            {
                                                                                if (checkBox.Label.Contains("Project C") &amp;&amp; checkBox.Checked)
                                                                                {
                                                                                    checkBox.SetOpen();
                                                                                }
                                                                            }
                                                                        }

                                                                        oneFile.Save(Path.Combine(dataDir, "ProjectNoteWithOpenProjectC.one"));</checkbox></itaggable>

Shows how to generate a pdf containing pages with items marked by incomplete checkboxes and created during last week.```csharp
// The path to the documents directory.
                                                                                                                                string dataDir = RunExamples.GetDataDir_Tags();

                                                                                                                                // Load the document into Aspose.Note.
                                                                                                                                var oneFile = new Document(Path.Combine(dataDir, "TagFile.one"));

                                                                                                                                var report = new Document();
                                                                                                                                foreach (var page in oneFile)
                                                                                                                                {
                                                                                                                                    if (page.GetChildNodes<itaggable>().Any(e =&gt; e.Tags.OfType<checkbox>().Any(x =&gt; !x.Checked &amp;&amp; DateTime.UtcNow.Subtract(TimeSpan.FromDays(7)) &lt;= x.CreationTime)))
                                                                                                                                    {
                                                                                                                                        report.AppendChildLast(page.Clone());
                                                                                                                                    }
                                                                                                                                }

                                                                                                                                report.Save(Path.Combine(dataDir, "IncompleteLastWeekReport.pdf"));</checkbox></itaggable>

Shows how to generate a pdf containing pages with Outlook incomplete tasks to complete on this week.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Tags();

                                                                                                           // Load the document into Aspose.Note.
                                                                                                           var oneFile = new Document(Path.Combine(dataDir, "TagFile.one"));

                                                                                                           var report = new Document();
                                                                                                           var endOfWeek = DateTime.Today.AddDays(5 - (int)DateTime.Today.DayOfWeek);
                                                                                                           foreach (var page in oneFile)
                                                                                                           {
                                                                                                               if (page.GetChildNodes<itaggable>().Any(e =&gt; e.Tags.OfType<notetask>().Any(x =&gt; !x.Checked &amp;&amp; DateTime.UtcNow.Subtract(TimeSpan.FromDays(7)) &lt;= x.CreationTime &amp;&amp; x.DueDate &lt;= endOfWeek)))
                                                                                                               {
                                                                                                                   report.AppendChildLast(page.Clone());
                                                                                                               }
                                                                                                           }

                                                                                                           report.Save(Path.Combine(dataDir, "IncompleteTasksForThisWeekReport.pdf"));</notetask></itaggable>

## Constructors

### <a id="Aspose_Note_CheckBox__ctor_Aspose_Note_TagIcon_"></a> CheckBox\(TagIcon\)

Initializes a new instance of the Aspose.Note.CheckBox class.

```csharp
protected CheckBox(TagIcon icon)

Parameters

icon TagIcon

The icon of tag.

Properties

Checked

Gets a value indicating whether the CheckBox is in the checked state.

public bool Checked { get; }

Property Value

bool

Examples

Shows how to generate a pdf containing all pages related to ‘Project A’.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Tags();

                                                                               // Load the document into Aspose.Note.
                                                                               var oneFile = new Document(Path.Combine(dataDir, "ProjectNotes.one"));

                                                                               var report = new Document();
                                                                               foreach (var page in oneFile)
                                                                               {
                                                                                   if (page.GetChildNodes<itaggable>().Any(e =&gt; e.Tags.Any(x =&gt; x.Label.Contains("Project A"))))
                                                                                   {
                                                                                       report.AppendChildLast(page.Clone());
                                                                                   }
                                                                               }

                                                                               report.Save(Path.Combine(dataDir, "ProjectA_Report.pdf"));</itaggable>

Shows how to make completed all checkbox items related to 'Project C'.```csharp
// The path to the documents directory.
                                                                                 string dataDir = RunExamples.GetDataDir_Tags();

                                                                                 // Load the document into Aspose.Note.
                                                                                 var oneFile = new Document(Path.Combine(dataDir, "ProjectNotes.one"));

                                                                                 foreach (var node in oneFile.GetChildNodes<itaggable>())
                                                                                 {
                                                                                     foreach (var checkBox in node.Tags.OfType<checkbox>())
                                                                                     {
                                                                                         if (checkBox.Label.Contains("Project C") &amp;&amp; !checkBox.Checked)
                                                                                         {
                                                                                             checkBox.SetCompleted();
                                                                                         }
                                                                                     }
                                                                                 }

                                                                                 oneFile.Save(Path.Combine(dataDir, ClosedProjectCNotesFileName));</checkbox></itaggable>

Shows how to make open all checkbox items related to ‘Project C’.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Tags();

                                                                        // Load the document into Aspose.Note.
                                                                        var oneFile = new Document(Path.Combine(dataDir, ClosedProjectCNotesFileName));

                                                                        foreach (var node in oneFile.GetChildNodes<itaggable>())
                                                                        {
                                                                            foreach (var checkBox in node.Tags.OfType<checkbox>())
                                                                            {
                                                                                if (checkBox.Label.Contains("Project C") &amp;&amp; checkBox.Checked)
                                                                                {
                                                                                    checkBox.SetOpen();
                                                                                }
                                                                            }
                                                                        }

                                                                        oneFile.Save(Path.Combine(dataDir, "ProjectNoteWithOpenProjectC.one"));</checkbox></itaggable>

Shows how to generate a pdf containing pages with items marked by incomplete checkboxes and created during last week.```csharp
// The path to the documents directory.
                                                                                                                                string dataDir = RunExamples.GetDataDir_Tags();

                                                                                                                                // Load the document into Aspose.Note.
                                                                                                                                var oneFile = new Document(Path.Combine(dataDir, "TagFile.one"));

                                                                                                                                var report = new Document();
                                                                                                                                foreach (var page in oneFile)
                                                                                                                                {
                                                                                                                                    if (page.GetChildNodes<itaggable>().Any(e =&gt; e.Tags.OfType<checkbox>().Any(x =&gt; !x.Checked &amp;&amp; DateTime.UtcNow.Subtract(TimeSpan.FromDays(7)) &lt;= x.CreationTime)))
                                                                                                                                    {
                                                                                                                                        report.AppendChildLast(page.Clone());
                                                                                                                                    }
                                                                                                                                }

                                                                                                                                report.Save(Path.Combine(dataDir, "IncompleteLastWeekReport.pdf"));</checkbox></itaggable>

Shows how to generate a pdf containing pages with Outlook incomplete tasks to complete on this week.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Tags();

                                                                                                           // Load the document into Aspose.Note.
                                                                                                           var oneFile = new Document(Path.Combine(dataDir, "TagFile.one"));

                                                                                                           var report = new Document();
                                                                                                           var endOfWeek = DateTime.Today.AddDays(5 - (int)DateTime.Today.DayOfWeek);
                                                                                                           foreach (var page in oneFile)
                                                                                                           {
                                                                                                               if (page.GetChildNodes<itaggable>().Any(e =&gt; e.Tags.OfType<notetask>().Any(x =&gt; !x.Checked &amp;&amp; DateTime.UtcNow.Subtract(TimeSpan.FromDays(7)) &lt;= x.CreationTime &amp;&amp; x.DueDate &lt;= endOfWeek)))
                                                                                                               {
                                                                                                                   report.AppendChildLast(page.Clone());
                                                                                                               }
                                                                                                           }

                                                                                                           report.Save(Path.Combine(dataDir, "IncompleteTasksForThisWeekReport.pdf"));</notetask></itaggable>

### <a id="Aspose_Note_CheckBox_CompletedTime"></a> CompletedTime

Gets or sets the completed time.

```csharp
public DateTime? CompletedTime { get; }

Property Value

DateTime?

CreationTime

Gets or sets the creation time.

public DateTime CreationTime { get; set; }

Property Value

DateTime

Icon

Gets or sets the icon.

public abstract TagIcon Icon { get; }

Property Value

TagIcon

Label

Gets the label text.

public string Label { get; }

Property Value

string

Status

Gets or sets the status.

public TagStatus Status { get; }

Property Value

TagStatus

Methods

SetCompleted(DateTime)

Sets the tag to completed state.

public void SetCompleted(DateTime completedTime)

Parameters

completedTime DateTime

The completed time.

SetCompleted()

Sets the tag to completed state using current time as completed time.

public void SetCompleted()

Examples

Shows how to make completed all checkbox items related to ‘Project C’.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Tags();

                                                                             // Load the document into Aspose.Note.
                                                                             var oneFile = new Document(Path.Combine(dataDir, "ProjectNotes.one"));

                                                                             foreach (var node in oneFile.GetChildNodes<itaggable>())
                                                                             {
                                                                                 foreach (var checkBox in node.Tags.OfType<checkbox>())
                                                                                 {
                                                                                     if (checkBox.Label.Contains("Project C") &amp;&amp; !checkBox.Checked)
                                                                                     {
                                                                                         checkBox.SetCompleted();
                                                                                     }
                                                                                 }
                                                                             }

                                                                             oneFile.Save(Path.Combine(dataDir, ClosedProjectCNotesFileName));</checkbox></itaggable>

### <a id="Aspose_Note_CheckBox_SetOpen"></a> SetOpen\(\)

Sets the tag to open state.

```csharp
public virtual void SetOpen()

Examples

Shows how to make open all checkbox items related to ‘Project C’.```csharp // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Tags();

                                                                        // Load the document into Aspose.Note.
                                                                        var oneFile = new Document(Path.Combine(dataDir, ClosedProjectCNotesFileName));

                                                                        foreach (var node in oneFile.GetChildNodes<itaggable>())
                                                                        {
                                                                            foreach (var checkBox in node.Tags.OfType<checkbox>())
                                                                            {
                                                                                if (checkBox.Label.Contains("Project C") &amp;&amp; checkBox.Checked)
                                                                                {
                                                                                    checkBox.SetOpen();
                                                                                }
                                                                            }
                                                                        }

                                                                        oneFile.Save(Path.Combine(dataDir, "ProjectNoteWithOpenProjectC.one"));</checkbox></itaggable>