Interface ITaggable

Interface ITaggable

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

The interface for nodes that can be marked by tags.

public interface ITaggable : INode
   {
      void SetTag(string tag);
      string GetTag();
   }

Implements

INode

Examples

Shows how to generate a pdf containing all pages related to ‘Project A’.

var oneFile = new Document(Path.Combine(RunExamples.GetDataDir_Tags(), "ProjectNotes.one"));
   var report = new Document();
   foreach (var page in oneFile)
   {
       if (page.GetChildNodes<ITaggable>().Any(e => e.Tags.Any(x => x.Label.Contains("Project A"))))
       {
           report.AppendChildLast(page.Clone());
       }
   }
   report.Save(Path.Combine(RunExamples.GetDataDir_Tags(), "ProjectA_Report.pdf"));

Shows how to make completed all checkbox items related to ‘Project C’.

string dataDir = RunExamples.GetDataDir_Tags();
   var oneFile = new Document(Path.Combine(dataDir, "ProjectNotes.one"));
   foreach (var node in oneFile.GetChildNodes<Taggable>())
   {
       foreach (var checkBox in node.Tags.OfType<Checkbox>())
       {
           if (checkBox.Label.Contains("Project C") && !checkBox.Checked)
           {
               checkBox.SetCompleted();
           }
       }
   }
   oneFile.Save(Path.Combine(dataDir, ClosedProjectCNotesFileName));

Shows how to make open all checkbox items related to ‘Project C’.

string dataDir = RunExamples.GetDataDir_Tags();
   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") && checkBox.Checked)
         {
            checkBox.SetOpen();
         }
      }
   }
   oneFile.Save(Path.Combine(dataDir, "ProjectNoteWithOpenProjectC.one"));

Shows how to generate a pdf containing pages with items marked by incomplete checkboxes and created during last week.

string dataDir = RunExamples.GetDataDir_Tags();
   var oneFile = new Aspose.Words.Document(Path.Combine(dataDir, "TagFile.one"));
   var report = new Aspose.Words.Document();
   foreach (var page in oneFile.ChildNodes.OfType<Aspose.Words.ITaggable>())
   {
       if (page.Tags.OfType<Aspose.Words.Checkbox>()
           .Any(e => !e.Checked && DateTime.UtcNow.Subtract(TimeSpan.FromDays(7)) <= e.CreationTime))
       {
           report.AppendChildLast(page.Clone());
       }
   }
   report.Save(Path.Combine(dataDir, "IncompleteLastWeekReport.pdf"));

Shows how to generate a pdf containing pages with Outlook incomplete tasks to complete on this week.

string dataDir = RunExamples.GetDataDir_Tags();
    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<Taggable>().Any(e => e.Tags.OfType<NoteTask>().Any(x => !x.Checked && DateTime.UtcNow.Subtract(TimeSpan.FromDays(7)) <= x.CreationTime && x.DueDate <= endOfWeek)))
        {
            report.AppendChildLast(page.Clone());
        }
    }
    report.Save(Path.Combine(dataDir, "IncompleteTasksForThisWeekReport.pdf"));

Properties

Tags

Gets the list of all tags.

List<ITag> tags { get; }

Property Value

List < ITag >

 English