Class Page

Class Page

Nama dari : Aspose.Note Perhitungan: Aspose.Note.dll (25.4.0)

Menampilkan sebuah halaman.

public sealed class Page : CompositeNode<ipagechildnode>, INode, ICompositeNode<ipagechildnode>, ICompositeNode, IEnumerable<ipagechildnode>, IEnumerable

Inheritance

object Node CompositeNodeBase CompositeNode Page

Implements

INode , ICompositeNode , ICompositeNode , IEnumerable , IEnumerable

anggota yang diwarisi

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

Menunjukkan cara mengatur warna latar belakang halaman.

// The path to the documents directory.
                                                    string dataDir = RunExamples.GetDataDir_Pages();

                                                    // Load OneNote document and get first child           
                                                    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"));

Menunjukkan cara mendapatkan meta informasi tentang halaman.

// The path to the documents directory.
                                                          string dataDir = RunExamples.GetDataDir_Pages();

                                                          // Load the document into Aspose.Note.
                                                          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();
                                                          }

Menunjukkan cara mengatur judul untuk halaman.

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);

Menunjukkan bagaimana untuk mendapatkan sejarah halaman.

// The path to the documents directory.
                                           string dataDir = RunExamples.GetDataDir_Pages();

                                           // Load OneNote document
                                           Document document = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });

                                           // Get first page
                                           Page firstPage = document.FirstChild;
                                           foreach (Page pageRevision in document.GetPageHistory(firstPage))
                                           {
                                               /*Use pageRevision like a regular page.*/
                                               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();
                                           }

Menunjukkan cara mengedit informasi meta halaman.

// The path to the documents directory.
                                                     string dataDir = RunExamples.GetDataDir_Pages();

                                                     // Load OneNote document and get first child           
                                                     Document document = new Document(dataDir + "Aspose.one");
                                                     Page page = document.FirstChild;

                                                     // Reading Content Revision Summary for this page
                                                     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")));

                                                     // Update Page Revision Summary for this page
                                                     pageRevisionInfo.AuthorMostRecent = "New Author";
                                                     pageRevisionInfo.LastModifiedTime = DateTime.Now;

                                                     document.Save(dataDir + "WorkingWithPageRevisions_out.one");

Menunjukkan bagaimana untuk melewati semua halaman dan membuat penggantian dalam teks.

// The path to the documents directory.
                                                                                  string dataDir = RunExamples.GetDataDir_Text();

                                                                                  Dictionary<string, string=""> replacements = new Dictionary<string, string="">();
                                                                                  replacements.Add("Some task here", "New Text Here");

                                                                                  // Load the document into Aspose.Note.
                                                                                  Document oneFile = new Document(dataDir + "Aspose.one");

                                                                                  // Get all RichText nodes
                                                                                  IList<richtext> textNodes = oneFile.GetChildNodes<richtext>();

                                                                                  foreach (RichText richText in textNodes)
                                                                                  {
                                                                                      foreach (KeyValuePair<string, string=""> kvp in replacements)
                                                                                      {
                                                                                          // Replace text of a shape
                                                                                          richText.Replace(kvp.Key, kvp.Value);
                                                                                      }
                                                                                  }

                                                                                  dataDir = dataDir + "ReplaceTextOnAllPages_out.pdf";

                                                                                  // Save to any supported file format
                                                                                  oneFile.Save(dataDir, SaveFormat.Pdf);</string,></richtext></richtext></string,></string,>

Menunjukkan bagaimana untuk melewati teks halaman dan membuat penggantian.

// The path to the documents directory.
                                                                        string dataDir = RunExamples.GetDataDir_Text();

                                                                        Dictionary<string, string=""> replacements = new Dictionary<string, string="">();
                                                                        replacements.Add("voice over", "voice over new text");

                                                                        // Load the document into Aspose.Note.
                                                                        Document oneFile = new Document(dataDir + "Aspose.one");

                                                                        IList<page> pageNodes = oneFile.GetChildNodes<page>();

                                                                        // Get all RichText nodes
                                                                        IList<richtext> textNodes = pageNodes[0].GetChildNodes<richtext>();

                                                                        foreach (RichText richText in textNodes)
                                                                        {
                                                                            foreach (KeyValuePair<string, string=""> kvp in replacements)
                                                                            {
                                                                                // Replace text of a shape
                                                                                richText.Replace(kvp.Key, kvp.Value);
                                                                            }
                                                                        }

                                                                        // Save to any supported file format
                                                                        dataDir = dataDir + "ReplaceTextOnParticularPage_out.pdf";
                                                                        oneFile.Save(dataDir, SaveFormat.Pdf);</string,></richtext></richtext></page></page></string,></string,>

Menunjukkan cara membuat dokumen dan menyimpannya dalam format html menggunakan opsi default.

// The path to the documents directory.
                                                                                           string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                           // Initialize OneNote document
                                                                                           Document doc = new Document();
                                                                                           Page page = doc.AppendChildLast(new Page());

                                                                                           // Default style for all text in the document.
                                                                                           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 }
                                                                                                            };

                                                                                           // Save into HTML format
                                                                                           dataDir = dataDir + "CreateOneNoteDocAndSaveToHTML_out.html";
                                                                                           doc.Save(dataDir);

Menunjukkan cara menambahkan gambar baru dengan tag.

// The path to the documents directory.
                                               string dataDir = RunExamples.GetDataDir_Tags();

                                               // Create an object of the Document class
                                               Document doc = new Document();

                                               // Initialize Page class object
                                               Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                               // Initialize Outline class object
                                               Outline outline = new Outline(doc);

                                               // Initialize OutlineElement class object
                                               OutlineElement outlineElem = new OutlineElement(doc);

                                               // Load an image
                                               Aspose.Note.Image image = new Aspose.Note.Image(doc, dataDir + "icon.jpg");

                                               // Insert image in the document node
                                               outlineElem.AppendChildLast(image);
                                               image.Tags.Add(NoteTag.CreateYellowStar());

                                               // Add outline element node
                                               outline.AppendChildLast(outlineElem);

                                               // Add outline node
                                               page.AppendChildLast(outline);

                                               // Add page node
                                               doc.AppendChildLast(page);

                                               // Save OneNote document
                                               dataDir = dataDir + "AddImageNodeWithTag_out.one";
                                               doc.Save(dataDir);

Menunjukkan bagaimana untuk memeriksa apakah halaman adalah halaman konflik (iaitu memiliki perubahan yang OneNote tidak dapat secara otomatis bergabung).

string dataDir = RunExamples.GetDataDir_Pages();

                                                                                                                          // Load OneNote document
                                                                                                                          Document doc = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });

                                                                                                                          var history = doc.GetPageHistory(doc.FirstChild);
                                                                                                                          for (int i = 0; i &lt; history.Count; i++)
                                                                                                                          {
                                                                                                                              var historyPage = history[i];
                                                                                                                              Console.Write("    {0}. Author: {1}, {2:dd.MM.yyyy hh.mm.ss}",
                                                                                                                                              i,
                                                                                                                                              historyPage.PageContentRevisionSummary.AuthorMostRecent,
                                                                                                                                              historyPage.PageContentRevisionSummary.LastModifiedTime);
                                                                                                                              Console.WriteLine(historyPage.IsConflictPage ? ", IsConflict: true" : string.Empty);

                                                                                                                              // By default conflict pages are just skipped on saving.
                                                                                                                              // If mark it as non-conflict then it will be saved as usual one in the history.
                                                                                                                              if (historyPage.IsConflictPage)
                                                                                                                                  historyPage.IsConflictPage = false;
                                                                                                                          }

                                                                                                                          doc.Save(dataDir + "ConflictPageManipulation_out.one", SaveFormat.One);

Menunjukkan cara membuat dokumen dan menyimpan dalam format html berbagai halaman yang ditentukan.

// The path to the documents directory.
                                                                                           string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                           // Initialize OneNote document
                                                                                           Document doc = new Document();

                                                                                           Page page = doc.AppendChildLast(new Page());

                                                                                           // Default style for all text in the document.
                                                                                           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 }
                                                                                                        };

                                                                                           // Save into HTML format
                                                                                           dataDir = dataDir + "CreateAndSavePageRange_out.html";
                                                                                           doc.Save(dataDir, new HtmlSaveOptions
                                                                                                             {
                                                                                                                 PageCount = 1,
                                                                                                                 PageIndex = 0
                                                                                                             });

Menunjukkan cara membuat dokumen dengan halaman berjudul.

// The path to the documents directory.
                                                           string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                           // Create an object of the Document class
                                                           Document doc = new Aspose.Note.Document();

                                                           // Initialize Page class object
                                                           Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                                           // Default style for all text in the document.
                                                           ParagraphStyle textStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };

                                                           // Set page title properties
                                                           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 }
                                                                        };

                                                           // Append Page node in the document
                                                           doc.AppendChildLast(page);

                                                           // Save OneNote document
                                                           dataDir = dataDir + "CreateDocWithPageTitle_out.one";
                                                           doc.Save(dataDir);

Menunjukkan cara menyimpan dokumen dalam format yang berbeda.

// The path to the documents directory.
                                                             string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                             // Initialize the new Document
                                                             Document doc = new Document() { AutomaticLayoutChangesDetectionEnabled = false };

                                                             // Initialize the new Page
                                                             Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                                             // Default style for all text in the document.
                                                             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 }
                                                                          };

                                                             // Append page node
                                                             doc.AppendChildLast(page);

                                                             // Save OneNote document in different formats, set text font size and detect layout changes manually.
                                                             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");

Menunjukkan cara memasukkan daftar baru dengan angka Cina.

string dataDir = RunExamples.GetDataDir_Text();

                                                               // Initialize OneNote document
                                                               Aspose.Note.Document doc = new Aspose.Note.Document();

                                                               // Initialize OneNote page
                                                               Aspose.Note.Page page = new Aspose.Note.Page(doc);
                                                               Outline outline = new Outline(doc);

                                                               // Apply text style settings
                                                               ParagraphStyle defaultStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };

                                                               // Numbers in the same outline are automatically incremented.
                                                               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);

                                                               // Save OneNote document
                                                               dataDir = dataDir + "InsertChineseNumberList_out.one"; 
                                                               doc.Save(dataDir);

Menunjukkan cara memasukkan lis bullet baru.

string dataDir = RunExamples.GetDataDir_Text();

                                                // Create an object of the Document class
                                                Aspose.Note.Document doc = new Aspose.Note.Document();

                                                // Initialize Page class object
                                                Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                                // Initialize Outline class object
                                                Outline outline = new Outline(doc);

                                                // Initialize TextStyle class object and set formatting properties
                                                ParagraphStyle defaultStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };

                                                // Initialize OutlineElement class objects and apply bullets
                                                OutlineElement outlineElem1 = new OutlineElement(doc) { NumberList = new NumberList("*", "Arial", 10) };

                                                // Initialize RichText class object and apply text style
                                                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);

                                                // Add outline elements
                                                outline.AppendChildLast(outlineElem1);
                                                outline.AppendChildLast(outlineElem2);
                                                outline.AppendChildLast(outlineElem3);

                                                // Add Outline node
                                                page.AppendChildLast(outline);
                                                // Add Page node
                                                doc.AppendChildLast(page);

                                                // Save OneNote document
                                                dataDir = dataDir + "ApplyBulletsOnText_out.one"; 
                                                doc.Save(dataDir);

Menunjukkan cara memasukkan daftar baru dengan nombor.

string dataDir = RunExamples.GetDataDir_Text();

                                                       // Create an object of the Document class
                                                       Document doc = new Document();

                                                       // Initialize Page class object
                                                       Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                                       // Initialize Outline class object
                                                       Outline outline = new Outline(doc);

                                                       // Initialize TextStyle class object and set formatting properties
                                                       ParagraphStyle defaultStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };

                                                       // Initialize OutlineElement class objects and apply numbering
                                                       // Numbers in the same outline are automatically incremented.
                                                       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);

                                                       // Add outline elements
                                                       outline.AppendChildLast(outlineElem1);
                                                       outline.AppendChildLast(outlineElem2);
                                                       outline.AppendChildLast(outlineElem3);

                                                       // Add Outline node
                                                       page.AppendChildLast(outline);

                                                       // Add Page node
                                                       doc.AppendChildLast(page);

                                                       // Save OneNote document
                                                       dataDir = dataDir + "ApplyNumberingOnText_out.one"; 
                                                       doc.Save(dataDir);

Menunjukkan cara menambahkan halaman dengan subpage.

// The path to the documents directory.
                                                  string dataDir = RunExamples.GetDataDir_Pages();

                                                  // Create an object of the Document class
                                                  Document doc = new Document();

                                                  // Initialize Page class object and set its level
                                                  Aspose.Note.Page page1 = new Aspose.Note.Page(doc) { Level = 1 };

                                                  // Initialize Page class object and set its level
                                                  Aspose.Note.Page page2 = new Aspose.Note.Page(doc) { Level = 2 };

                                                  // Initialize Page class object and set its level
                                                  Aspose.Note.Page page3 = new Aspose.Note.Page(doc) { Level = 1 };

                                                  /*---------- Adding nodes to first Page ----------*/
                                                  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);

                                                  /*---------- Adding nodes to second Page ----------*/
                                                  var outline2 = new Outline(doc);
                                                  var outlineElem2 = new OutlineElement(doc);
                                                  var textStyle2 = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };
                                                  var text2 = new RichText(doc) { Text = "Second page.", ParagraphStyle = textStyle2 };
                                                  outlineElem2.AppendChildLast(text2);
                                                  outline2.AppendChildLast(outlineElem2);
                                                  page2.AppendChildLast(outline2);

                                                  /*---------- Adding nodes to third Page ----------*/
                                                  var outline3 = new Outline(doc);
                                                  var outlineElem3 = new OutlineElement(doc);
                                                  var textStyle3 = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };
                                                  var text3 = new RichText(doc) { Text = "Third page.", ParagraphStyle = textStyle3 };
                                                  outlineElem3.AppendChildLast(text3);
                                                  outline3.AppendChildLast(outlineElem3);
                                                  page3.AppendChildLast(outline3);

                                                  /*---------- Add pages to the OneNote Document ----------*/
                                                  doc.AppendChildLast(page1);
                                                  doc.AppendChildLast(page2);
                                                  doc.AppendChildLast(page3);

                                                  // Save OneNote document
                                                  dataDir = dataDir + "CreateDocWithRootAndSubPages_out.one";
                                                  doc.Save(dataDir);

Constructors

Page()

Initifikasi instansi baru dari Aspose.Note.Kelas halaman.

public Page()

Properties

Author

Mendapatkan atau menetapkan penulis.

public string Author { get; set; }

Nilai Properti

string

Examples

Menunjukkan cara mendapatkan meta informasi tentang halaman.

// The path to the documents directory.
                                                          string dataDir = RunExamples.GetDataDir_Pages();

                                                          // Load the document into Aspose.Note.
                                                          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();
                                                          }

Menunjukkan bagaimana untuk mendapatkan sejarah halaman.

// The path to the documents directory.
                                           string dataDir = RunExamples.GetDataDir_Pages();

                                           // Load OneNote document
                                           Document document = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });

                                           // Get first page
                                           Page firstPage = document.FirstChild;
                                           foreach (Page pageRevision in document.GetPageHistory(firstPage))
                                           {
                                               /*Use pageRevision like a regular page.*/
                                               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

Dapatkan atau menetapkan warna latar belakang halaman.

public Color BackgroundColor { get; set; }

Nilai Properti

Color

Examples

Menunjukkan cara mengatur warna latar belakang halaman.

// The path to the documents directory.
                                                    string dataDir = RunExamples.GetDataDir_Pages();

                                                    // Load OneNote document and get first child           
                                                    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"));

Menunjukkan cara menerapkan Dark theme style ke dalam dokumen.

// The path to the documents directory.
                                                             string dataDir = RunExamples.GetDataDir_Text();

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

                                                             foreach (var page in doc)
                                                             {
                                                                 page.BackgroundColor = Color.Black;
                                                             }

                                                             foreach (var node in doc.GetChildNodes<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) &lt;= 30)
                                                                 {
                                                                     node.ParagraphStyle.FontColor = Color.White;
                                                                 }
                                                             }

                                                             doc.Save(Path.Combine(dataDir, "AsposeDarkTheme.pdf"));</richtext>

CreationTime

Dapatkan atau menetapkan waktu penciptaan.

public DateTime CreationTime { get; set; }

Nilai Properti

DateTime

Examples

Menunjukkan cara mendapatkan meta informasi tentang halaman.

// The path to the documents directory.
                                                          string dataDir = RunExamples.GetDataDir_Pages();

                                                          // Load the document into Aspose.Note.
                                                          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();
                                                          }

Menunjukkan bagaimana untuk mendapatkan sejarah halaman.

// The path to the documents directory.
                                           string dataDir = RunExamples.GetDataDir_Pages();

                                           // Load OneNote document
                                           Document document = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });

                                           // Get first page
                                           Page firstPage = document.FirstChild;
                                           foreach (Page pageRevision in document.GetPageHistory(firstPage))
                                           {
                                               /*Use pageRevision like a regular page.*/
                                               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

Dapatkan atau menetapkan nilai yang menunjukkan apakah halaman ini adalah halaman konflik.

public bool IsConflictPage { get; set; }

Nilai Properti

bool

Examples

Menunjukkan bagaimana untuk memeriksa apakah halaman adalah halaman konflik (iaitu memiliki perubahan yang OneNote tidak dapat secara otomatis bergabung).

string dataDir = RunExamples.GetDataDir_Pages();

                                                                                                                          // Load OneNote document
                                                                                                                          Document doc = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });

                                                                                                                          var history = doc.GetPageHistory(doc.FirstChild);
                                                                                                                          for (int i = 0; i &lt; history.Count; i++)
                                                                                                                          {
                                                                                                                              var historyPage = history[i];
                                                                                                                              Console.Write("    {0}. Author: {1}, {2:dd.MM.yyyy hh.mm.ss}",
                                                                                                                                              i,
                                                                                                                                              historyPage.PageContentRevisionSummary.AuthorMostRecent,
                                                                                                                                              historyPage.PageContentRevisionSummary.LastModifiedTime);
                                                                                                                              Console.WriteLine(historyPage.IsConflictPage ? ", IsConflict: true" : string.Empty);

                                                                                                                              // By default conflict pages are just skipped on saving.
                                                                                                                              // If mark it as non-conflict then it will be saved as usual one in the history.
                                                                                                                              if (historyPage.IsConflictPage)
                                                                                                                                  historyPage.IsConflictPage = false;
                                                                                                                          }

                                                                                                                          doc.Save(dataDir + "ConflictPageManipulation_out.one", SaveFormat.One);

Remarks

Halaman konflik muncul ketika dua pengguna mencoba untuk mengemas kini konten yang sama.Dalam hal ini perubahan pengguna pertama ditulis seperti biasa.Tetapi perubahan user lain tidak dapat digabungkan.

Pada versi ini konflik diselesaikan demi perubahan pengguna pertama.Jadi jika dokumen memiliki halaman konflik maka mereka akan dipaparkan dalam sejarah tetapi akan dialihkan pada penyimpanan.

Sampel terperinci dari manipulasi oleh halaman konflik dapat ditemukan dalam dokumentasi online.

LastModifiedTime

Dapatkan atau menetapkan waktu yang terakhir diubah.

public DateTime LastModifiedTime { get; set; }

Nilai Properti

DateTime

Examples

Menunjukkan cara mendapatkan meta informasi tentang halaman.

// The path to the documents directory.
                                                          string dataDir = RunExamples.GetDataDir_Pages();

                                                          // Load the document into Aspose.Note.
                                                          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();
                                                          }

Menunjukkan bagaimana untuk mendapatkan sejarah halaman.

// The path to the documents directory.
                                           string dataDir = RunExamples.GetDataDir_Pages();

                                           // Load OneNote document
                                           Document document = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });

                                           // Get first page
                                           Page firstPage = document.FirstChild;
                                           foreach (Page pageRevision in document.GetPageHistory(firstPage))
                                           {
                                               /*Use pageRevision like a regular page.*/
                                               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

Dapatkan atau menetapkan tingkat.

public byte Level { get; set; }

Nilai Properti

byte

Examples

Menunjukkan cara mendapatkan meta informasi tentang halaman.

// The path to the documents directory.
                                                          string dataDir = RunExamples.GetDataDir_Pages();

                                                          // Load the document into Aspose.Note.
                                                          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();
                                                          }

Menunjukkan bagaimana untuk mendapatkan sejarah halaman.

// The path to the documents directory.
                                           string dataDir = RunExamples.GetDataDir_Pages();

                                           // Load OneNote document
                                           Document document = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });

                                           // Get first page
                                           Page firstPage = document.FirstChild;
                                           foreach (Page pageRevision in document.GetPageHistory(firstPage))
                                           {
                                               /*Use pageRevision like a regular page.*/
                                               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();
                                           }

Menunjukkan cara menambahkan halaman dengan subpage.

// The path to the documents directory.
                                                  string dataDir = RunExamples.GetDataDir_Pages();

                                                  // Create an object of the Document class
                                                  Document doc = new Document();

                                                  // Initialize Page class object and set its level
                                                  Aspose.Note.Page page1 = new Aspose.Note.Page(doc) { Level = 1 };

                                                  // Initialize Page class object and set its level
                                                  Aspose.Note.Page page2 = new Aspose.Note.Page(doc) { Level = 2 };

                                                  // Initialize Page class object and set its level
                                                  Aspose.Note.Page page3 = new Aspose.Note.Page(doc) { Level = 1 };

                                                  /*---------- Adding nodes to first Page ----------*/
                                                  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);

                                                  /*---------- Adding nodes to second Page ----------*/
                                                  var outline2 = new Outline(doc);
                                                  var outlineElem2 = new OutlineElement(doc);
                                                  var textStyle2 = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };
                                                  var text2 = new RichText(doc) { Text = "Second page.", ParagraphStyle = textStyle2 };
                                                  outlineElem2.AppendChildLast(text2);
                                                  outline2.AppendChildLast(outlineElem2);
                                                  page2.AppendChildLast(outline2);

                                                  /*---------- Adding nodes to third Page ----------*/
                                                  var outline3 = new Outline(doc);
                                                  var outlineElem3 = new OutlineElement(doc);
                                                  var textStyle3 = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };
                                                  var text3 = new RichText(doc) { Text = "Third page.", ParagraphStyle = textStyle3 };
                                                  outlineElem3.AppendChildLast(text3);
                                                  outline3.AppendChildLast(outlineElem3);
                                                  page3.AppendChildLast(outline3);

                                                  /*---------- Add pages to the OneNote Document ----------*/
                                                  doc.AppendChildLast(page1);
                                                  doc.AppendChildLast(page2);
                                                  doc.AppendChildLast(page3);

                                                  // Save OneNote document
                                                  dataDir = dataDir + "CreateDocWithRootAndSubPages_out.one";
                                                  doc.Save(dataDir);

Margin

Dapatkan atau menetapkan margin.

public Margins Margin { get; set; }

Nilai Properti

Margins

PageContentRevisionSummary

Dapatkan atau menetapkan resume revisi untuk halaman dan itu anak nodes.

public RevisionSummary PageContentRevisionSummary { get; set; }

Nilai Properti

RevisionSummary

Examples

Menunjukkan cara mengedit informasi meta halaman.

// The path to the documents directory.
                                                     string dataDir = RunExamples.GetDataDir_Pages();

                                                     // Load OneNote document and get first child           
                                                     Document document = new Document(dataDir + "Aspose.one");
                                                     Page page = document.FirstChild;

                                                     // Reading Content Revision Summary for this page
                                                     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")));

                                                     // Update Page Revision Summary for this page
                                                     pageRevisionInfo.AuthorMostRecent = "New Author";
                                                     pageRevisionInfo.LastModifiedTime = DateTime.Now;

                                                     document.Save(dataDir + "WorkingWithPageRevisions_out.one");

Menunjukkan bagaimana untuk memeriksa apakah halaman adalah halaman konflik (iaitu memiliki perubahan yang OneNote tidak dapat secara otomatis bergabung).

string dataDir = RunExamples.GetDataDir_Pages();

                                                                                                                          // Load OneNote document
                                                                                                                          Document doc = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });

                                                                                                                          var history = doc.GetPageHistory(doc.FirstChild);
                                                                                                                          for (int i = 0; i &lt; history.Count; i++)
                                                                                                                          {
                                                                                                                              var historyPage = history[i];
                                                                                                                              Console.Write("    {0}. Author: {1}, {2:dd.MM.yyyy hh.mm.ss}",
                                                                                                                                              i,
                                                                                                                                              historyPage.PageContentRevisionSummary.AuthorMostRecent,
                                                                                                                                              historyPage.PageContentRevisionSummary.LastModifiedTime);
                                                                                                                              Console.WriteLine(historyPage.IsConflictPage ? ", IsConflict: true" : string.Empty);

                                                                                                                              // By default conflict pages are just skipped on saving.
                                                                                                                              // If mark it as non-conflict then it will be saved as usual one in the history.
                                                                                                                              if (historyPage.IsConflictPage)
                                                                                                                                  historyPage.IsConflictPage = false;
                                                                                                                          }

                                                                                                                          doc.Save(dataDir + "ConflictPageManipulation_out.one", SaveFormat.One);

PageLayoutSize

Dapatkan atau menetapkan ukuran layout halaman yang ditampilkan dalam editor.

public SizeF PageLayoutSize { get; set; }

Nilai Properti

SizeF

Remarks

Nilai ini digunakan oleh aplikasi Microsoft OneNote untuk menampilkan tataletak halaman bawah ketika dokumen dibuka.Ini tidak mempengaruhi pencetakan dan penyimpanan dokumen bagaimanapun.Ketika Properti Page.SizeType ditetapkan pada PageSiceTYpe.sizeByContent properti ini mengembalikan ukuran nyata dari konten.

SizeType

Dapatkan atau menetapkan jenis ukuran halaman.

public PageSizeType SizeType { get; set; }

Nilai Properti

PageSizeType

Remarks

Secara default, halaman kembali secara otomatis. nilai lalai adalah Aspose.Note.PageSizeType.SiceByContent.

Title

Dapatkan atau menetapkan judul.

public Title Title { get; set; }

Nilai Properti

Title

Examples

Menunjukkan cara mendapatkan meta informasi tentang halaman.

// The path to the documents directory.
                                                          string dataDir = RunExamples.GetDataDir_Pages();

                                                          // Load the document into Aspose.Note.
                                                          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();
                                                          }

Menunjukkan cara mengedit sejarah halaman.

// The path to the documents directory.
                                            string dataDir = RunExamples.GetDataDir_Pages();

                                            // Load OneNote document and get first child           
                                            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 &gt; 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");
                                            }

Menunjukkan cara mengatur judul untuk halaman.

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);

Menunjukkan bagaimana untuk mendapatkan sejarah halaman.

// The path to the documents directory.
                                           string dataDir = RunExamples.GetDataDir_Pages();

                                           // Load OneNote document
                                           Document document = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });

                                           // Get first page
                                           Page firstPage = document.FirstChild;
                                           foreach (Page pageRevision in document.GetPageHistory(firstPage))
                                           {
                                               /*Use pageRevision like a regular page.*/
                                               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();
                                           }

Menunjukkan cara membuat dokumen dan menyimpannya dalam format html menggunakan opsi default.

// The path to the documents directory.
                                                                                           string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                           // Initialize OneNote document
                                                                                           Document doc = new Document();
                                                                                           Page page = doc.AppendChildLast(new Page());

                                                                                           // Default style for all text in the document.
                                                                                           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 }
                                                                                                            };

                                                                                           // Save into HTML format
                                                                                           dataDir = dataDir + "CreateOneNoteDocAndSaveToHTML_out.html";
                                                                                           doc.Save(dataDir);

Menunjukkan cara membuat dokumen dan menyimpan dalam format html berbagai halaman yang ditentukan.

// The path to the documents directory.
                                                                                           string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                           // Initialize OneNote document
                                                                                           Document doc = new Document();

                                                                                           Page page = doc.AppendChildLast(new Page());

                                                                                           // Default style for all text in the document.
                                                                                           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 }
                                                                                                        };

                                                                                           // Save into HTML format
                                                                                           dataDir = dataDir + "CreateAndSavePageRange_out.html";
                                                                                           doc.Save(dataDir, new HtmlSaveOptions
                                                                                                             {
                                                                                                                 PageCount = 1,
                                                                                                                 PageIndex = 0
                                                                                                             });

Menunjukkan cara membuat dokumen dengan halaman berjudul.

// The path to the documents directory.
                                                           string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                           // Create an object of the Document class
                                                           Document doc = new Aspose.Note.Document();

                                                           // Initialize Page class object
                                                           Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                                           // Default style for all text in the document.
                                                           ParagraphStyle textStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };

                                                           // Set page title properties
                                                           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 }
                                                                        };

                                                           // Append Page node in the document
                                                           doc.AppendChildLast(page);

                                                           // Save OneNote document
                                                           dataDir = dataDir + "CreateDocWithPageTitle_out.one";
                                                           doc.Save(dataDir);

Menunjukkan cara menyimpan dokumen dalam format yang berbeda.

// The path to the documents directory.
                                                             string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                             // Initialize the new Document
                                                             Document doc = new Document() { AutomaticLayoutChangesDetectionEnabled = false };

                                                             // Initialize the new Page
                                                             Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                                             // Default style for all text in the document.
                                                             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 }
                                                                          };

                                                             // Append page node
                                                             doc.AppendChildLast(page);

                                                             // Save OneNote document in different formats, set text font size and detect layout changes manually.
                                                             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");

Methods

Accept(DocumentVisitor)

Menerima pengunjung dari nod.

public override void Accept(DocumentVisitor visitor)

Parameters

visitor DocumentVisitor

Objek kelas yang berasal dari Aspose.Note.DocumentVisitor.

Clone(Bool)

mengkloning halaman tersebut.

public Page Clone(bool cloneHistory = false)

Parameters

cloneHistory bool

Menentukan apakah sejarah halaman harus kloning.

Returns

Page

Klon dari halaman ini.

Examples

Menunjukkan bagaimana untuk mendorong versi saat ini dari halaman ke sejarah.

// The path to the documents directory.
                                                                  string dataDir = RunExamples.GetDataDir_Pages();

                                                                  // Load OneNote document and get first child           
                                                                  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");

Menunjukkan cara untuk kloning halaman.

// The path to the documents directory.
                                     string dataDir = RunExamples.GetDataDir_Pages();

                                     // Load OneNote document
                                     Document document = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });

                                     // Clone into new document without history
                                     var cloned = new Document();
                                     cloned.AppendChildLast(document.FirstChild.Clone());

                                     // Clone into new document with history
                                     cloned = new Document();
                                     cloned.AppendChildLast(document.FirstChild.Clone(true));

Keterangan()

Dapatkan semua nod anak dari halaman dengan jenis nod.

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

Returns

List

Daftar nodus anak.

Jenis Parameter

T1

Jenis elemen dalam daftar yang dikembalikan.

Examples

Menunjukkan bagaimana untuk mendapatkan semua teks dari dokumen.

// The path to the documents directory.
                                                       string dataDir = RunExamples.GetDataDir_Text();

                                                       // Load the document into Aspose.Note.
                                                       Document oneFile = new Document(dataDir + "Aspose.one");

                                                       // Retrieve text
                                                       string text = string.Join(Environment.NewLine, oneFile.GetChildNodes<richtext>().Select(e =&gt; e.Text)) + Environment.NewLine;

                                                       // Print text on the output screen
                                                       Console.WriteLine(text);</richtext>

Menunjukkan bagaimana untuk mendapatkan semua teks dari halaman.

// The path to the documents directory.
                                                   string dataDir = RunExamples.GetDataDir_Text();

                                                   // Load the document into Aspose.Note.
                                                   Document oneFile = new Document(dataDir + "Aspose.one");

                                                   // Get list of page nodes
                                                   var page = oneFile.GetChildNodes<page>().FirstOrDefault();

                                                   if (page != null)
                                                   {
                                                       // Retrieve text
                                                       string text = string.Join(Environment.NewLine, page.GetChildNodes<richtext>().Select(e =&gt; e.Text)) + Environment.NewLine;
                                                       // Print text on the output screen
                                                       Console.WriteLine(text);
                                                   }</richtext></page>

Menunjukkan bagaimana untuk melewati semua halaman dan membuat penggantian dalam teks.

// The path to the documents directory.
                                                                                  string dataDir = RunExamples.GetDataDir_Text();

                                                                                  Dictionary<string, string=""> replacements = new Dictionary<string, string="">();
                                                                                  replacements.Add("Some task here", "New Text Here");

                                                                                  // Load the document into Aspose.Note.
                                                                                  Document oneFile = new Document(dataDir + "Aspose.one");

                                                                                  // Get all RichText nodes
                                                                                  IList<richtext> textNodes = oneFile.GetChildNodes<richtext>();

                                                                                  foreach (RichText richText in textNodes)
                                                                                  {
                                                                                      foreach (KeyValuePair<string, string=""> kvp in replacements)
                                                                                      {
                                                                                          // Replace text of a shape
                                                                                          richText.Replace(kvp.Key, kvp.Value);
                                                                                      }
                                                                                  }

                                                                                  dataDir = dataDir + "ReplaceTextOnAllPages_out.pdf";

                                                                                  // Save to any supported file format
                                                                                  oneFile.Save(dataDir, SaveFormat.Pdf);</string,></richtext></richtext></string,></string,>

Menunjukkan bagaimana untuk melewati teks halaman dan membuat penggantian.

// The path to the documents directory.
                                                                        string dataDir = RunExamples.GetDataDir_Text();

                                                                        Dictionary<string, string=""> replacements = new Dictionary<string, string="">();
                                                                        replacements.Add("voice over", "voice over new text");

                                                                        // Load the document into Aspose.Note.
                                                                        Document oneFile = new Document(dataDir + "Aspose.one");

                                                                        IList<page> pageNodes = oneFile.GetChildNodes<page>();

                                                                        // Get all RichText nodes
                                                                        IList<richtext> textNodes = pageNodes[0].GetChildNodes<richtext>();

                                                                        foreach (RichText richText in textNodes)
                                                                        {
                                                                            foreach (KeyValuePair<string, string=""> kvp in replacements)
                                                                            {
                                                                                // Replace text of a shape
                                                                                richText.Replace(kvp.Key, kvp.Value);
                                                                            }
                                                                        }

                                                                        // Save to any supported file format
                                                                        dataDir = dataDir + "ReplaceTextOnParticularPage_out.pdf";
                                                                        oneFile.Save(dataDir, SaveFormat.Pdf);</string,></richtext></richtext></page></page></string,></string,>

 Indonesia