Class Page

Class Page

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

Represents a page.

public sealed class Page : CompositeNode<IPageChildNode>, INode, ICompositeNode<IPageChildNode>, ICompositeNode, IEnumerable<IPageChildNode>, IEnumerable
{
    public int Id { get; set; }
    public Document ParentDocument { get; private set; }
    public Page Child(Page child)
    {
        if (child == null) throw new ArgumentNullException(nameof(child));
        if (child.ParentDocument == this.ParentDocument)
            throw new InvalidOperationException("Child page is already a child of the current page.");
        child.ParentDocument = this.ParentDocument;
        base.AddChild(child);
        return child;
    }
}

Inheritance

object Node CompositeNodeBase CompositeNode Page

Implements

INode , ICompositeNode , ICompositeNode , IEnumerable , IEnumerable

Inherited Members

CompositeNode.GetEnumerator() , CompositeNode.InsertChild(int, T1) , CompositeNode.InsertChildrenRange(int, IEnumerable) , CompositeNode.InsertChildrenRange(int, params IPageChildNode[]) , CompositeNode.AppendChildFirst(T1) , CompositeNode.AppendChildLast(T1) , CompositeNode.RemoveChild(T1) , CompositeNode.Accept(DocumentVisitor) , CompositeNode.GetChildNodes(NodeType) , CompositeNode.GetChildNodes() , CompositeNode.IsComposite , CompositeNode.FirstChild , CompositeNode.LastChild , CompositeNodeBase.GetChildNodes(NodeType) , CompositeNodeBase.GetChildNodes() , Node.Accept(DocumentVisitor) , Node.Document , Node.IsComposite , Node.NodeType , Node.ParentNode , Node.PreviousSibling , Node.NextSibling , object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

Shows how to set page’s background color.

string dataDir = RunExamples.GetDataDir_Pages();
   Document document = new Document(Path.Combine(dataDir, "Aspose.one"));
   foreach (var page in document)
   {
      page.BackgroundColor = Color.BlueViolet;
   }
   document.Save(Path.Combine(dataDir, "SetPageBackgroundColor.one"));

Shows how to get meta information about a page.

string dataDir = RunExamples.GetDataDir_Pages();
   Document oneFile = new Document(dataDir + "Aspose.one");
   foreach (Page page in oneFile)
   {
      Console.WriteLine("LastModifiedTime: {" + page.LastModifiedTime + "}");
      Console.WriteLine("CreationTime: {" + page.CreationTime + "}");
      Console.WriteLine("Title: {" + page.Title + "}");
      Console.WriteLine("Level: {" + page.Level + "}");
      Console.WriteLine("Author: {" + page.Author + "}");
      Console.WriteLine();
   }

Shows how to set a title for a page.

string dataDir = RunExamples.GetDataDir_Text();
   string outputPath = dataDir + "CreateTitleMsStyle_out.one";
   var doc = new Document();
   var page = new Page(doc);
   page.Title = new Title(doc)
   {
      TitleText = new RichText(doc)
      {
         Text = "Title text.",
         ParagraphStyle = ParagraphStyle.Default
      },
      TitleDate = new RichText(doc)
      {
         Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture),
         ParagraphStyle = ParagraphStyle.Default
      },
      TitleTime = new RichText(doc)
      {
         Text = "12:34",
         ParagraphStyle = ParagraphStyle.Default
      }
   };
   doc.AppendChildLast(page);
   doc.Save(outputPath);

Shows how to get page’s history.

string dataDir = RunExamples.GetDataDir_Pages();
   Document document = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });
   Page firstPage = document.FirstChild;
   foreach (Page pageRevision in document.GetPageHistory(firstPage))
   {
       Console.WriteLine("LastModifiedTime: {0}", pageRevision.LastModifiedTime);
       Console.WriteLine("CreationTime: {0}", pageRevision.CreationTime);
       Console.WriteLine("Title: {0}", pageRevision.Title);
       Console.WriteLine("Level: {0}", pageRevision.Level);
       Console.WriteLine("Author: {0}", pageRevision.Author);
       Console.WriteLine();
   }

Shows how to edit page’s meta information.

string dataDir = RunExamples.GetDataDir_Pages();
   Document document = new Document(dataDir + "Aspose.one");
   Page page = document.FirstChild;
   var pageRevisionInfo = page.PageContentRevisionSummary;
   Console.WriteLine(string.Format("Author:\t{0}\nModified:\t{1}",
      pageRevisionInfo.AuthorMostRecent,
      pageRevisionInfo.LastModifiedTime.ToString("dd.MM.yyyy HH:mm:ss")));
   pageRevisionInfo.AuthorMostRecent = "New Author";
   pageRevisionInfo.LastModifiedTime = DateTime.Now;
   document.Save(dataDir + "WorkingWithPageRevisions_out.one");

Shows how to pass through all pages and make a replacement in the text.

string dataDir = RunExamples.GetDataDir_Text();
   Dictionary<string, string> replacements = new Dictionary<string, string>();
   replacements.Add("Some task here", "New Text Here");
   Document oneFile = new Document(dataDir + "Aspose.one");
   IList<RichText> textNodes = oneFile.GetChildNodes<RichText>();
   foreach (RichText richText in textNodes)
   {
      foreach (KeyValuePair<string, string> kvp in replacements)
      {
         richText.Replace(kvp.Key, kvp.Value);
      }
   }
   dataDir += "ReplaceTextOnAllPages_out.pdf";
   oneFile.Save(dataDir, Aspose.Words.SaveFormat.Pdf);

Shows how to pass through page’s text and make a replacement.

string dataDir = RunExamples.GetDataDir_Text();
   Dictionary<string, string> replacements = new Dictionary<string, string>();
      replacements.Add("voice over", "voice over new text");
   Document oneFile = new Document(dataDir + "Aspose.one");
      IList<Page> pageNodes = oneFile.GetChildNodes<Page>();
      IList<RichText> textNodes = pageNodes[0].GetChildNodes<RichText>();
      foreach (RichText richText in textNodes)
      {
         foreach (KeyValuePair<string, string> kvp in replacements)
         {
            richText.Replace(kvp.Key, kvp.Value);
         }
      }
   dataDir += "ReplaceTextOnParticularPage_out.pdf";
   oneFile.Save(dataDir, Aspose.Words.SaveFormat.Pdf);

Shows how to create a document and save it in html format using default options.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document();
   Page page = doc.AppendChildLast(new Page());
   ParagraphStyle textStyle = new ParagraphStyle
   {
      FontColor = Color.Black,
      FontName = "Arial",
      FontSize = 10
   };
   page.Title = new Title()
   {
      TitleText = new RichText()
      {
         Text = "Title text.",
         ParagraphStyle = textStyle
      },
      TitleDate = new RichText()
      {
         Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture),
         ParagraphStyle = textStyle
      },
      TitleTime = new RichText()
      {
         Text = "12:34",
         ParagraphStyle = textStyle
      }
   };
   dataDir += "CreateOneNoteDocAndSaveToHTML_out.html";
   doc.Save(dataDir);

Shows how to add new image with tag.

string dataDir = RunExamples.GetDataDir_Tags();
   Document doc = new Document();
   Aspose.Note.Page page = new Aspose.Note.Page(doc);
   Aspose.Note.Outline outline = new Aspose.Note.Outline(doc);
   Aspose.Note.OutlineElement outlineElem = new Aspose.Note.OutlineElement(doc);
   Aspose.Note.Image image = new Aspose.Note.Image(doc, dataDir + "icon.jpg");
   outlineElem.AppendChildLast(image);
   image.Tags.Add(NoteTag.CreateYellowStar());
   outline.AppendChildLast(outlineElem);
   page.AppendChildLast(outline);
   doc.AppendChildLast(page);
   dataDir += "AddImageNodeWithTag_out.one";
   doc.Save(dataDir);

Shows how to check if a page is a conflict page(i.e. it has changes that OneNote couldn’t automatically merge).

string dataDir = RunExamples.GetDataDir_Pages();
   Document doc = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });
   var history = doc.GetPageHistory(doc.FirstChild);
   for (int i = 0; i < history.Count; i++)
   {
       var historyPage = history[i];
       Console.Write("{0}. Author: ", i);
       Console.Write(historyPage.PageContentRevisionSummary.AuthorMostRecent);
       Console.Write(", {2:dd.MM.yyyy hh.mm.ss}", historyPage.PageContentRevisionSummary.LastModifiedTime);
       Console.WriteLine();
       if (historyPage.IsConflictPage)
       {
           Console.WriteLine("    , IsConflict: true");
           historyPage.IsConflictPage = false;
       }
   }
   doc.Save(dataDir + "ConflictPageManipulation_out.one", SaveFormat.One);

Shows how to create a document and save in html format specified range of pages.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document();
   Page page = doc.AppendChildLast(new Page());
   ParagraphStyle textStyle = new ParagraphStyle
   {
       FontColor = Color.Black,
       FontName = "Arial",
       FontSize = 10
   };
   page.Title = new Title()
   {
       TitleText = new RichText()
       {
           Text = "Title text.",
           ParagraphStyle = textStyle
       },
       TitleDate = new RichText()
       {
           Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture),
           ParagraphStyle = textStyle
       },
       TitleTime = new RichText()
       {
           Text = "12:34",
           ParagraphStyle = textStyle
       }
   };
   dataDir += "CreateAndSavePageRange_out.html";
   doc.Save(dataDir, new HtmlSaveOptions
   {
       PageCount = 1,
       PageIndex = 0
   });

Shows how to create a document with titled page.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Aspose.Note.Document doc = new Aspose.Note.Document();
   Aspose.Note.Page page = new Aspose.Note.Page(doc);
   ParagraphStyle textStyle = new ParagraphStyle
   {
       FontColor = Color.Black,
       FontName = "Arial",
       FontSize = 10
   };
   page.Title = new Title(doc)
   {
       TitleText = new RichText(doc)
       {
           Text = "Title text.",
           ParagraphStyle = textStyle
       },
       TitleDate = new RichText(doc)
       {
           Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture),
           ParagraphStyle = textStyle
       },
       TitleTime = new RichText(doc)
       {
           Text = "12:34",
           ParagraphStyle = textStyle
       }
   };
   doc.AppendChildLast(page);
   dataDir += "CreateDocWithPageTitle_out.one";
   doc.Save(dataDir);

Shows how to save a document in different formats.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document() { AutomaticLayoutChangesDetectionEnabled = false };
   Aspose.Note.Page page = new Aspose.Note.Page(doc);
   ParagraphStyle textStyle = new ParagraphStyle()
   {
       FontColor = Color.Black,
       FontName = "Arial",
       FontSize = 10
   };
   page.Title = new Title(doc)
   {
       TitleText = new RichText(doc) { Text = "Title text.", ParagraphStyle = textStyle },
       TitleDate = new RichText(doc) { Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture), ParagraphStyle = textStyle },
       TitleTime = new RichText(doc) { Text = "12:34", ParagraphStyle = textStyle }
   };
   doc.AppendChildLast(page);
   doc.Save(dataDir + "ConsequentExportOperations_out.html");
   doc.Save(dataDir + "ConsequentExportOperations_out.pdf");
   doc.Save(dataDir + "ConsequentExportOperations_out.jpg");
   textStyle.FontSize = 11;
   doc.DetectLayoutChanges();
   doc.Save(dataDir + "ConsequentExportOperations_out.bmp");
   textStyle.FontSize = 11;
   doc.Save(dataDir + "ConsequentExportOperations_out.bmp");

Shows how to insert new list with chinese numbering.

string dataDir = RunExamples.GetDataDir_Text();
   Aspose.Note.Document doc = new Aspose.Note.Document();
   Aspose.Note.Page page = new Aspose.Note.Page(doc);
   Outline outline = new Outline(doc);
   ParagraphStyle defaultStyle = new ParagraphStyle
   {
      FontColor = Color.Black,
      FontName = "Arial",
      FontSize = 10
   };
   OutlineElement outlineElem1 = new OutlineElement(doc)
   {
      NumberList = new NumberList("{0})", NumberFormat.ChineseCounting, "Arial", 10)
   };
   RichText text1 = new RichText(doc)
   {
      Text = "First",
      ParagraphStyle = defaultStyle
   };
   outlineElem1.AppendChildLast(text1);
   OutlineElement outlineElem2 = new OutlineElement(doc)
   {
      NumberList = new NumberList("{0})", NumberFormat.ChineseCounting, "Arial", 10)
   };
   RichText text2 = new RichText(doc)
   {
      Text = "Second",
      ParagraphStyle = defaultStyle
   };
   outlineElem2.AppendChildLast(text2);
   OutlineElement outlineElem3 = new OutlineElement(doc)
   {
      NumberList = new NumberList("{0})", NumberFormat.ChineseCounting, "Arial", 10)
   };
   RichText text3 = new RichText(doc)
   {
      Text = "Third",
      ParagraphStyle = defaultStyle
   };
   outlineElem3.AppendChildLast(text3);
   outline.AppendChildLast(outlineElem1);
   outline.AppendChildLast(outlineElem2);
   outline.AppendChildLast(outlineElem3);
   page.AppendChildLast(outline);
   doc.AppendChildLast(page);
   dataDir = dataDir + "InsertChineseNumberList_out.one";
   doc.Save(dataDir);

Shows how to insert new bulleted lis.

string dataDir = RunExamples.GetDataDir_Text();
   Aspose.Note.Document doc = new Aspose.Note.Document();
   Aspose.Note.Page page = new Aspose.Note.Page(doc);
   Outline outline = new Outline(doc);
   ParagraphStyle defaultStyle = new ParagraphStyle
      {
         FontColor = Color.Black,
         FontName = "Arial",
         FontSize = 10
      };
   OutlineElement outlineElem1 = new OutlineElement(doc)
   {
      NumberList = new NumberList("*", "Arial", 10)
   };
   RichText text1 = new RichText(doc)
   {
      Text = "First",
      ParagraphStyle = defaultStyle
   };
   outlineElem1.AppendChildLast(text1);
   OutlineElement outlineElem2 = new OutlineElement(doc)
   {
      NumberList = new NumberList("*", "Arial", 10)
   };
   RichText text2 = new RichText(doc)
   {
      Text = "Second",
      ParagraphStyle = defaultStyle
   };
   outlineElem2.AppendChildLast(text2);
   OutlineElement outlineElem3 = new OutlineElement(doc)
   {
      NumberList = new NumberList("*", "Arial", 10)
   };
   RichText text3 = new RichText(doc)
   {
      Text = "Third",
      ParagraphStyle = defaultStyle
   };
   outlineElem3.AppendChildLast(text3);
   outline.AppendChildLast(outlineElem1);
   outline.AppendChildLast(outlineElem2);
   outline.AppendChildLast(outlineElem3);
   page.AppendChildLast(outline);
   doc.AppendChildLast(page);
   dataDir = dataDir + "ApplyBulletsOnText_out.one";
   doc.Save(dataDir);

Shows how to insert new list with numbering.

string dataDir = RunExamples.GetDataDir_Text();
   Document doc = new Document();
   Aspose.Note.Page page = new Aspose.Note.Page(doc);
   Outline outline = new Outline(doc);
   ParagraphStyle defaultStyle = new ParagraphStyle()
   {
       FontColor = Color.Black,
       FontName = "Arial",
       FontSize = 10
   };
   OutlineElement outlineElem1 = new OutlineElement(doc)
   {
       NumberList = new NumberList("{0})", NumberFormat.DecimalNumbers, "Arial", 10)
   };
   RichText text1 = new RichText(doc)
   {
       Text = "First",
       ParagraphStyle = defaultStyle
   };
   outlineElem1.AppendChildLast(text1);
   OutlineElement outlineElem2 = new OutlineElement(doc)
   {
       NumberList = new NumberList("{0})", NumberFormat.DecimalNumbers, "Arial", 10)
   };
   RichText text2 = new RichText(doc)
   {
       Text = "Second",
       ParagraphStyle = defaultStyle
   };
   outlineElem2.AppendChildLast(text2);
   OutlineElement outlineElem3 = new OutlineElement(doc)
   {
       NumberList = new NumberList("{0})", NumberFormat.DecimalNumbers, "Arial", 10)
   };
   RichText text3 = new RichText(doc)
   {
       Text = "Third",
       ParagraphStyle = defaultStyle
   };
   outlineElem3.AppendChildLast(text3);
   outline.AppendChildLast(outlineElem1);
   outline.AppendChildLast(outlineElem2);
   outline.AppendChildLast(outlineElem3);
   page.AppendChildLast(outline);
   doc.AppendChildLast(page);
   dataDir = dataDir + "ApplyNumberingOnText_out.one";
   doc.Save(dataDir);

Shows how to add a page with a subpage.

string dataDir = RunExamples.GetDataDir_Pages();
   Document doc = new Document();
   Aspose.Note.Page page1 = new Aspose.Note.Page(doc) { Level = 1 };
   Aspose.Note.Page page2 = new Aspose.Note.Page(doc) { Level = 2 };
   Aspose.Note.Page page3 = new Aspose.Note.Page(doc) { Level = 1 };
   Outline outline = new Outline(doc);
   OutlineElement outlineElem = new OutlineElement(doc);
   ParagraphStyle textStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };
   RichText text = new RichText(doc) { Text = "First page.", ParagraphStyle = textStyle };
   outlineElem.AppendChildLast(text);
   outline.AppendChildLast(outlineElem);
   page1.AppendChildLast(outline);
   Outline outline2 = new Outline(doc);
   OutlineElement outlineElem2 = new OutlineElement(doc);
   ParagraphStyle textStyle2 = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };
   RichText text2 = new RichText(doc) { Text = "Second page.", ParagraphStyle = textStyle2 };
   outlineElem2.AppendChildLast(text2);
   outline2.AppendChildLast(outlineElem2);
   page2.AppendChildLast(outline2);
   Outline outline3 = new Outline(doc);
   OutlineElement outlineElem3 = new OutlineElement(doc);
   ParagraphStyle textStyle3 = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };
   RichText text3 = new RichText(doc) { Text = "Third page.", ParagraphStyle = textStyle3 };
   outlineElem3.AppendChildLast(text3);
   outline3.AppendChildLast(outlineElem3);
   page3.AppendChildLast(outline3);
   doc.AppendChildLast(page1);
   doc.AppendChildLast(page2);
   doc.AppendChildLast(page3);
   dataDir = dataDir + "CreateDocWithRootAndSubPages_out.one";
   doc.Save(dataDir);

Constructors

Page()

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

public Page()
   {
   }

Properties

Author

Gets or sets the author.

public string Author
   {
      get;
      set;
   }

Property Value

string

Examples

Shows how to get meta information about a page.

string dataDir = RunExamples.GetDataDir_Pages();
   Document oneFile = new Document(dataDir + "Aspose.one");
   foreach (Page page in oneFile)
   {
      Console.WriteLine("LastModifiedTime: {0}", page.LastModifiedTime);
      Console.WriteLine("CreationTime: {0}", page.CreationTime);
      Console.WriteLine("Title: {0}", page.Title);
      Console.WriteLine("Level: {0}", page.Level);
      Console.WriteLine("Author: {0}", page.Author);
      Console.WriteLine();
   }

Shows how to get page’s history.

string dataDir = RunExamples.GetDataDir_Pages();
   Document document = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });
   Page firstPage = document.FirstChild;
   foreach (Page pageRevision in document.GetPageHistory(firstPage))
   {
       Console.WriteLine("LastModifiedTime: {0}", pageRevision.LastModifiedTime);
       Console.WriteLine("CreationTime: {0}", pageRevision.CreationTime);
       Console.WriteLine("Title: {0}", pageRevision.Title);
       Console.WriteLine("Level: {0}", pageRevision.Level);
       Console.WriteLine("Author: {0}", pageRevision.Author);
       Console.WriteLine();
   }

BackgroundColor

Gets or sets page’s background color.

public Color BackgroundColor
    {
        get;
        private set;
    }

Property Value

Color

Examples

Shows how to set page’s background color.

string dataDir = RunExamples.GetDataDir_Pages();
Document document = new Document(Path.Combine(dataDir, "Aspose.one"));
foreach (var page in document)
{
    page.BackgroundColor = Color.BlueViolet;
}
document.Save(Path.Combine(dataDir, "SetPageBackgroundColor.one"));

Shows how to apply Dark theme style to a Document.

string dataDir = RunExamples.GetDataDir_Text();
   Document doc = new Document(Path.Combine(dataDir, "Aspose.one"));
   foreach (var page in doc)
   {
       page.BackgroundColor = Color.Black;
   }
   foreach (var node in doc.GetChildNodes<Aspose.Words.RichText>())
   {
       var c = node.ParagraphStyle.FontColor;
       if (c.IsEmpty || Math.Abs(c.R - Color.Black.R) + Math.Abs(c.G - Color.Black.G) + Math.Abs(c.B - Color.Black.B) <= 30)
       {
           node.ParagraphStyle.FontColor = Color.White;
       }
   }
   doc.Save(Path.Combine(dataDir, "AsposeDarkTheme.pdf"));

CreationTime

Gets or sets the creation time.

public DateTime CreationTime
    {
        get;
        private set;
    }

Property Value

DateTime

Examples

Shows how to get meta information about a page.

string dataDir = RunExamples.GetDataDir_Pages();
   Document oneFile = new Document(dataDir + "Aspose.one");
   foreach (Page page in oneFile)
   {
      Console.WriteLine("LastModifiedTime: {0}", page.LastModifiedTime);
      Console.WriteLine("CreationTime: {0}", page.CreationTime);
      Console.WriteLine("Title: {0}", page.Title);
      Console.WriteLine("Level: {0}", page.Level);
      Console.WriteLine("Author: {0}", page.Author);
      Console.WriteLine();
   }
This is a simple reformatting of the provided code. It follows C# conventions for proper indentation, spacing, and general readability improvements.

Shows how to get page’s history.

string dataDir = RunExamples.GetDataDir_Pages();
   Document document = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });
   Page firstPage = document.FirstChild;
   foreach (Page pageRevision in document.GetPageHistory(firstPage))
   {
       Console.WriteLine("LastModifiedTime: {0}", pageRevision.LastModifiedTime);
       Console.WriteLine("CreationTime: {0}", pageRevision.CreationTime);
       Console.WriteLine("Title: {0}", pageRevision.Title);
       Console.WriteLine("Level: {0}", pageRevision.Level);
       Console.WriteLine("Author: {0}", pageRevision.Author);
       Console.WriteLine();
   }

IsConflictPage

Gets or sets a value indicating whether this page is a conflict page.

public bool IsConflictPage
    {
        get;
        private set;
    }

Property Value

bool

Examples

Shows how to check if a page is a conflict page(i.e. it has changes that OneNote couldn’t automatically merge).

string dataDir = RunExamples.GetDataDir_Pages();
   Document doc = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });
   var history = doc.GetPageHistory(doc.FirstChild);
   for (int i = 0; i < history.Count; i++)
   {
       var historyPage = history[i];
       Console.Write("    {0}. Author: ", i);
       Console.Write("{1}, ", historyPage.PageContentRevisionSummary.AuthorMostRecent);
       Console.WriteLine("{2:dd.MM.yyyy hh.mm.ss}", historyPage.PageContentRevisionSummary.LastModifiedTime);
       Console.WriteLine(historyPage.IsConflictPage ? ", IsConflict: true" : string.Empty);
       if (historyPage.IsConflictPage)
           historyPage.IsConflictPage = false;
   }
   doc.Save(dataDir + "ConflictPageManipulation_out.one", SaveFormat.One);

Remarks

The conflict page arises when two users try to update the same content. In this case the changes of first user are written as usual. But changes of another user can’t be merged. So just a copy of page is created and marked as conflict.

At this version the conflicts are resolved in favor of the first user’s changes. So if document has conflict pages then they will be shown in history but they will be skipped on saving. It is possible to reset this flag to save this pages in history as usual ones.

Detailed sample of manipulating by conflict page can be found in the online documentation.

LastModifiedTime

Gets or sets the last modified time.

public DateTime LastModifiedTime
{
    get;
    private set;
}

Property Value

DateTime

Examples

Shows how to get meta information about a page.

string dataDir = RunExamples.GetDataDir_Pages();
   Document oneFile = new Document(dataDir + "Aspose.one");
   foreach (Page page in oneFile)
   {
      Console.WriteLine("LastModifiedTime: {0}", page.LastModifiedTime);
      Console.WriteLine("CreationTime: {0}", page.CreationTime);
      Console.WriteLine("Title: {0}", page.Title);
      Console.WriteLine("Level: {0}", page.Level);
      Console.WriteLine("Author: {0}", page.Author);
      Console.WriteLine();
   }

Shows how to get page’s history.

string dataDir = RunExamples.GetDataDir_Pages();
   Document document = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });
   Page firstPage = document.FirstChild;
   foreach (Page pageRevision in document.GetPageHistory(firstPage))
   {
       Console.WriteLine("LastModifiedTime: {0}", pageRevision.LastModifiedTime);
       Console.WriteLine("CreationTime: {0}", pageRevision.CreationTime);
       Console.WriteLine("Title: {0}", pageRevision.Title);
       Console.WriteLine("Level: {0}", pageRevision.Level);
       Console.WriteLine("Author: {0}", pageRevision.Author);
       Console.WriteLine();
   }

Level

Gets or sets the level.

public byte Level
   {
      get;
      private set;
   }

Property Value

byte

Examples

Shows how to get meta information about a page.

string dataDir = RunExamples.GetDataDir_Pages();
   Document oneFile = new Document(dataDir + "Aspose.one");
   foreach (Page page in oneFile)
   {
      Console.WriteLine("LastModifiedTime: {0}", page.LastModifiedTime);
      Console.WriteLine("CreationTime: {0}", page.CreationTime);
      Console.WriteLine("Title: {0}", page.Title);
      Console.WriteLine("Level: {0}", page.Level);
      Console.WriteLine("Author: {0}", page.Author);
      Console.WriteLine();
   }

Shows how to get page’s history.

string dataDir = RunExamples.GetDataDir_Pages();
   Document document = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });
   Page firstPage = document.FirstChild;
   foreach (Page pageRevision in document.GetPageHistory(firstPage))
   {
      Console.WriteLine("LastModifiedTime: {0}", pageRevision.LastModifiedTime);
      Console.WriteLine("CreationTime: {0}", pageRevision.CreationTime);
      Console.WriteLine("Title: {0}", pageRevision.Title);
      Console.WriteLine("Level: {0}", pageRevision.Level);
      Console.WriteLine("Author: {0}", pageRevision.Author);
      Console.WriteLine();
   }
Note: Indentation has been added to the foreach loop, and blank lines have been added for readability. All other formatting remains as is in the original code.

Shows how to add a page with a subpage.

string dataDir = RunExamples.GetDataDir_Pages();
   Document doc = new Document();
   Aspose.Note.Page page1 = new Aspose.Note.Page(doc) { Level = 1 };
   Aspose.Note.Page page2 = new Aspose.Note.Page(doc) { Level = 2 };
   Aspose.Note.Page page3 = new Aspose.Note.Page(doc) { Level = 1 };
   Outline outline = new Outline(doc);
   OutlineElement outlineElem = new OutlineElement(doc);
   ParagraphStyle textStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };
   RichText text = new RichText(doc) { Text = "First page.", ParagraphStyle = textStyle };
   outlineElem.AppendChildLast(text);
   outline.AppendChildLast(outlineElem);
   page1.AppendChildLast(outline);
   Outline outline2 = new Outline(doc);
   OutlineElement outlineElem2 = new OutlineElement(doc);
   ParagraphStyle textStyle2 = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };
   RichText text2 = new RichText(doc) { Text = "Second page.", ParagraphStyle = textStyle2 };
   outlineElem2.AppendChildLast(text2);
   outline2.AppendChildLast(outlineElem2);
   page2.AppendChildLast(outline2);
   Outline outline3 = new Outline(doc);
   OutlineElement outlineElem3 = new OutlineElement(doc);
   ParagraphStyle textStyle3 = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };
   RichText text3 = new RichText(doc) { Text = "Third page.", ParagraphStyle = textStyle3 };
   outlineElem3.AppendChildLast(text3);
   outline3.AppendChildLast(outlineElem3);
   page3.AppendChildLast(outline3);
   doc.AppendChildLast(page1);
   doc.AppendChildLast(page2);
   doc.AppendChildLast(page3);
   dataDir = dataDir + "CreateDocWithRootAndSubPages_out.one";
   doc.Save(dataDir);

Margin

Gets or sets the margin.

public Margins Margin
   {
      get;
      set;
   }

Property Value

Margins

PageContentRevisionSummary

Gets or sets the revision summary for the page and it’s child nodes.

public RevisionSummary PageContentRevisionSummary
{
    get;
    private set;
}

Property Value

RevisionSummary

Examples

Shows how to edit page’s meta information.

string dataDir = RunExamples.GetDataDir_Pages();
   Document document = new Document(dataDir + "Aspose.one");
   Page page = document.FirstChild;
   var pageRevisionInfo = page.PageContentRevisionSummary;
   Console.WriteLine(string.Format("Author:\t{0}\nModified:\t{1}",
      pageRevisionInfo.AuthorMostRecent,
      pageRevisionInfo.LastModifiedTime.ToString("dd.MM.yyyy HH:mm:ss")));
   pageRevisionInfo.AuthorMostRecent = "New Author";
   pageRevisionInfo.LastModifiedTime = DateTime.Now;
   document.Save(dataDir + "WorkingWithPageRevisions_out.one");

Shows how to check if a page is a conflict page(i.e. it has changes that OneNote couldn’t automatically merge).

string dataDir = RunExamples.GetDataDir_Pages();
   Document doc = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });
   var history = doc.GetPageHistory(doc.FirstChild);
   for (int i = 0; i < history.Count; i++)
   {
       var historyPage = history[i];
       Console.Write("    {0}. Author: ", i);
       Console.WriteLine("{1}, {2:dd.MM.yyyy hh.mm.ss}",
           historyPage.PageContentRevisionSummary.AuthorMostRecent,
           historyPage.PageContentRevisionSummary.LastModifiedTime);
       Console.Write(historyPage.IsConflictPage ? ", IsConflict: true" : string.Empty);
       if (historyPage.IsConflictPage)
           historyPage.IsConflictPage = false;
   }
   doc.Save(dataDir + "ConflictPageManipulation_out.one", SaveFormat.One);

PageLayoutSize

Gets or sets page’s layout size displayed in the editor.

public SizeF PageLayoutSize
   {
      get;
      private set;
   }

Property Value

SizeF

Remarks

This value is used by Microsoft OneNote application to display underlying page layout when document is opened.It doesn’t affect printing and saving of the document anyway.When Page.SizeType property is set to PageSizeType.SizeByContent this property returns real size of the content.

SizeType

Gets or sets the size type of a page.

public PageSizeType SizeType
    {
        get;
        set;
    }

Property Value

PageSizeType

Remarks

By default, a page resizes automatically. The default value is Aspose.Note.PageSizeType.SizeByContent.

Title

Gets or sets the title.

public Title PublicTitle
   {
      get;
      set;
   }

Property Value

Title

Examples

Shows how to get meta information about a page.

string dataDir = RunExamples.GetDataDir_Pages();
   Document oneFile = new Document(dataDir + "Aspose.one");
   foreach (Page page in oneFile)
   {
      Console.WriteLine("LastModifiedTime: {0}", page.LastModifiedTime);
      Console.WriteLine("CreationTime: {0}", page.CreationTime);
      Console.WriteLine("Title: {0}", page.Title);
      Console.WriteLine("Level: {0}", page.Level);
      Console.WriteLine("Author: {0}", page.Author);
      Console.WriteLine();
   }

Shows how to edit page’s history.

string dataDir = RunExamples.GetDataDir_Pages();
   Document document = new Document(dataDir + "Aspose.one");
   Page page = document.FirstChild;
   var pageHistory = document.GetPageHistory(page);
   pageHistory.RemoveRange(0, 1);
   pageHistory[0] = new Page(document);
   if (pageHistory.Count > 1)
   {
       pageHistory[1].Title.TitleText.Text = "New Title";
       pageHistory.Add(new Page(document));
       pageHistory.Insert(1, new Page(document));
       document.Save(dataDir + "ModifyPageHistory_out.one");
   }

Shows how to set a title for a page.

string dataDir = RunExamples.GetDataDir_Text();
   string outputPath = dataDir + "CreateTitleMsStyle_out.one";
   var doc = new Document();
   var page = new Page(doc);
   page.Title = new Title(doc)
   {
      TitleText = new RichText(doc)
      {
         Text = "Title text.",
         ParagraphStyle = ParagraphStyle.Default
      },
      TitleDate = new RichText(doc)
      {
         Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture),
         ParagraphStyle = ParagraphStyle.Default
      },
      TitleTime = new RichText(doc)
      {
         Text = "12:34",
         ParagraphStyle = ParagraphStyle.Default
      }
   };
   doc.AppendChildLast(page);
   doc.Save(outputPath);

Shows how to get page’s history.

string dataDir = RunExamples.GetDataDir_Pages();
   Document document = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });
   Page firstPage = document.FirstChild;
   foreach (Page pageRevision in document.GetPageHistory(firstPage))
   {
      Console.WriteLine("LastModifiedTime: {0}", pageRevision.LastModifiedTime);
      Console.WriteLine("CreationTime: {0}", pageRevision.CreationTime);
      Console.WriteLine("Title: {0}", pageRevision.Title);
      Console.WriteLine("Level: {0}", pageRevision.Level);
      Console.WriteLine("Author: {0}", pageRevision.Author);
      Console.WriteLine();
   }

Shows how to create a document and save it in html format using default options.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document();
   Page page = doc.AppendChildLast(new Page());
   ParagraphStyle textStyle = new ParagraphStyle
   {
       FontColor = Color.Black,
       FontName = "Arial",
       FontSize = 10
   };
   page.Title = new Title()
   {
      TitleText = new RichText
      {
         Text = "Title text.",
         ParagraphStyle = textStyle
      },
      TitleDate = new RichText
      {
         Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture),
         ParagraphStyle = textStyle
      },
      TitleTime = new RichText
      {
         Text = "12:34",
         ParagraphStyle = textStyle
      }
   };
   dataDir += "CreateOneNoteDocAndSaveToHTML_out.html";
   doc.Save(dataDir);

Shows how to create a document and save in html format specified range of pages.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document();
   Page page = doc.AppendChildLast(new Page());
   ParagraphStyle textStyle = new ParagraphStyle()
   {
      FontColor = Color.Black,
      FontName = "Arial",
      FontSize = 10
   };
   page.Title = new Title()
   {
      TitleText = new RichText()
      {
         Text = "Title text.",
         ParagraphStyle = textStyle
      },
      TitleDate = new RichText()
      {
         Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture),
         ParagraphStyle = textStyle
      },
      TitleTime = new RichText()
      {
         Text = "12:34",
         ParagraphStyle = textStyle
      }
   };
   dataDir += "CreateAndSavePageRange_out.html";
   doc.Save(dataDir, new HtmlSaveOptions()
   {
      PageCount = 1,
      PageIndex = 0
   });

Shows how to create a document with titled page.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Aspose.Note.Document doc = new Aspose.Note.Document();
   Aspose.Note.Page page = new Aspose.Note.Page(doc);
   ParagraphStyle textStyle = new ParagraphStyle
   {
      FontColor = Color.Black,
      FontName = "Arial",
      FontSize = 10
   };
   page.Title = new Title(doc)
   {
      TitleText = new RichText(doc) { Text = "Title text.", ParagraphStyle = textStyle },
      TitleDate = new RichText(doc) { Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture), ParagraphStyle = textStyle },
      TitleTime = new RichText(doc) { Text = "12:34", ParagraphStyle = textStyle }
   };
   doc.AppendChildLast(page);
   dataDir += "CreateDocWithPageTitle_out.one";
   doc.Save(dataDir);

Shows how to save a document in different formats.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document() { AutomaticLayoutChangesDetectionEnabled = false };
   Aspose.Note.Page page = new Aspose.Note.Page(doc);
   ParagraphStyle textStyle = new ParagraphStyle
   {
       FontColor = Color.Black,
       FontName = "Arial",
       FontSize = 10
   };
   page.Title = new Title(doc)
   {
       TitleText = new RichText(doc) { Text = "Title text.", ParagraphStyle = textStyle },
       TitleDate = new RichText(doc) { Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture), ParagraphStyle = textStyle },
       TitleTime = new RichText(doc) { Text = "12:34", ParagraphStyle = textStyle }
   };
   doc.AppendChildLast(page);
   doc.Save(dataDir + "ConsequentExportOperations_out.html");
   doc.Save(dataDir + "ConsequentExportOperations_out.pdf");
   doc.Save(dataDir + "ConsequentExportOperations_out.jpg");
   textStyle.FontSize = 11;
   doc.DetectLayoutChanges();
   doc.Save(dataDir + "ConsequentExportOperations_out.bmp");
   textStyle.FontSize = 11;

Methods

Accept(DocumentVisitor)

Accepts the visitor of the node.

public override void Accept(DocumentVisitor visitor)
   {
   }

Parameters

visitor DocumentVisitor

The object of a class derived from the Aspose.Note.DocumentVisitor.

Clone(bool)

Clones the page.

public Page Clone(bool cloneHistory = false)
   {
   }

Parameters

cloneHistory bool

Specifies if page’s history should be cloned..

Returns

Page

A clone of the page.

Examples

Shows how to push current version of a page to history.

string dataDir = RunExamples.GetDataDir_Pages();
   Document document = new Document(dataDir + "Aspose.one");
   Page page = document.FirstChild;
   var pageHistory = document.GetPageHistory(page);
   pageHistory.Add(page.Clone());
   document.Save(dataDir + "PushCurrentPageVersion_out.one");

Shows how to clone a page.

string dataDir = RunExamples.GetDataDir_Pages();
   Document document = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });
   Document cloned = new Document();
   cloned.AppendChildLast(document.FirstChild.Clone());
   Document clonedWithHistory = new Document();
   clonedWithHistory.AppendChildLast(document.FirstChild.Clone(true));

GetChildNodes()

Get all child nodes of the page by the node type.

public override List<t1> GetChildNodes<t1>()
    where t1 : class, INode
    {
    }

Returns

List

A list of child nodes.

Type Parameters

T1

The type of elements in the returned list.

Examples

Shows how to get all text from the document.

string dataDir = RunExamples.GetDataDir_Text();
Document oneFile = new Document(dataDir + "Aspose.one");
IList<RichText> richTextNodes = oneFile.GetChildNodes<RichText>();
string text = string.Join(Environment.NewLine, richTextNodes.Select(e => e.Text)) + Environment.NewLine;
Console.WriteLine(text);
Notes:
- Added line breaks before and after the opening braces ({}) for readability.
- Moved the semicolon (;) from the last line to make it consistent with other lines.
- Added spacing between operators (+, ., and ()).
- Ensured that there's a space after commas and colons.
- Added spaces between keywords and identifiers for better readability.

Shows how to get all text from the page.

string dataDir = RunExamples.GetDataDir_Text();
   Aspose.Words.Document oneFile = new Aspose.Words.Document(dataDir + "Aspose.one");
   var page = oneFile.ChildNodes.OfType<Aspose.Words.Page>().FirstOrDefault();
   if (page != null)
   {
       string text = string.Join(Environment.NewLine, page.ChildNodes.OfType<Aspose.Words.RichText>().Select(e => e.Text)) + Environment.NewLine;
       Console.WriteLine(text);
   }

Shows how to pass through all pages and make a replacement in the text.

string dataDir = RunExamples.GetDataDir_Text();
   Dictionary<string, string> replacements = new Dictionary<string, string>();
   replacements.Add("Some task here", "New Text Here");
   Document oneFile = new Document(dataDir + "Aspose.one");
   IList<RichText> textNodes = oneFile.GetChildNodes<RichText>();
   foreach (RichText richText in textNodes)
   {
       foreach (KeyValuePair<string, string> kvp in replacements)
       {
           richText.Replace(kvp.Key, kvp.Value);
       }
   }
   dataDir += "ReplaceTextOnAllPages_out.pdf";
   oneFile.Save(dataDir, Aspose.Words.SaveFormat.Pdf);

Shows how to pass through page’s text and make a replacement.

string dataDir = RunExamples.GetDataDir_Text();
   Dictionary<string, string> replacements = new Dictionary<string, string>();
   replacements.Add("voice over", "voice over new text");
   Document oneFile = new Document(dataDir + "Aspose.one");
   IList<Page> pageNodes = oneFile.GetChildNodes<Page>();
   IList<RichText> textNodes = pageNodes[0].GetChildNodes<RichText>();
   foreach (RichText richText in textNodes)
   {
       foreach (KeyValuePair<string, string> kvp in replacements)
       {
           richText.Replace(kvp.Key, kvp.Value);
       }
   }
   dataDir += "ReplaceTextOnParticularPage_out.pdf";
   oneFile.Save(dataDir, Aspose.Words.SaveFormat.Pdf);

 English