Class Page

Class Page

Nazwa przestrzeń: Aspose.Note Zgromadzenie: Aspose.Note.dll (25.4.0)

Przedstawiamy stronę.

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

Dziedziczeni członkowie

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

Pokaż, jak ustawić kolor tła strony.

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

Pokaż, jak uzyskać meta informacje o stronie.

// 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();
                                                          }

Pokaż, jak ustawić tytuł dla strony.

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

Pokaż, jak uzyskać historię strony.

// 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();
                                           }

Pokaż, jak edytować informacje meta strony.

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

Pokaż, jak przejść przez wszystkie strony i dokonać zastąpienia w tekście.

// 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,>

Pokaż, jak przejść przez tekst strony i dokonać zastąpienia.

// 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,>

Pokaż, jak utworzyć dokument i zapisać go w formacie html za pomocą opcji domyślnych.

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

Pokaż, jak dodać nowy obraz z tagem.

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

Pokazuje, jak sprawdzić, czy strona jest stroną konfliktu (tj. ma zmiany, które OneNote nie mogło automatycznie połączyć).

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

Pokaż, jak utworzyć dokument i zapisać w formacie html określony zakres stron.

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

Pokaż, jak utworzyć dokument z tytułem strony.

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

Pokaż, jak zapisać dokument w różnych formach.

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

Pokaż, jak wprowadzić nową listę z chińskim numerowaniem.

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

Pokaż, jak wstawić nową butelkę lis.

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

Pokaż, jak wprowadzić nową listę z numerowaniem.

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

Pokaż, jak dodać stronę z podstroną.

// 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()

Inicjalizuje nową instancję klasy Aspose.Note.Strona.

public Page()

Properties

Author

Przyjmuje lub ustawia autora.

public string Author { get; set; }

Wartość nieruchomości

string

Examples

Pokaż, jak uzyskać meta informacje o stronie.

// 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();
                                                          }

Pokaż, jak uzyskać historię strony.

// 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

Uzyskuje lub ustawia kolor tła strony.

public Color BackgroundColor { get; set; }

Wartość nieruchomości

Color

Examples

Pokaż, jak ustawić kolor tła strony.

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

Pokaż, jak zastosować styl tematu ciemnego do dokumentu.

// 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

Otrzymuje lub ustala czas tworzenia.

public DateTime CreationTime { get; set; }

Wartość nieruchomości

DateTime

Examples

Pokaż, jak uzyskać meta informacje o stronie.

// 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();
                                                          }

Pokaż, jak uzyskać historię strony.

// 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

Otrzymuje lub ustawia wartość wskazującą, czy ta strona jest stroną konfliktu.

public bool IsConflictPage { get; set; }

Wartość nieruchomości

bool

Examples

Pokazuje, jak sprawdzić, czy strona jest stroną konfliktu (tj. ma zmiany, które OneNote nie mogło automatycznie połączyć).

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

Strona konfliktu pojawia się, gdy dwaj użytkownicy próbują zaktualizować ten sam treść.W tym przypadku zmiany pierwszego użytkownika są napisane jak zwykle.Ale zmiany innego użytkowników nie można połączyć.

W tej wersji konflikty są rozstrzygnięte na rzecz zmian pierwszego użytkownika.Tak więc, jeśli dokument ma strony konfliktu, to będą one wyświetlane w historii, ale zostaną przeniesione na oszczędności.

Szczegółowe próbki manipulacji przez stronę konfliktu można znaleźć w dokumentacji online.

LastModifiedTime

Otrzymuje lub ustawia ostatnią zmienioną godzinę.

public DateTime LastModifiedTime { get; set; }

Wartość nieruchomości

DateTime

Examples

Pokaż, jak uzyskać meta informacje o stronie.

// 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();
                                                          }

Pokaż, jak uzyskać historię strony.

// 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

Zostaw lub ustaw poziom.

public byte Level { get; set; }

Wartość nieruchomości

byte

Examples

Pokaż, jak uzyskać meta informacje o stronie.

// 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();
                                                          }

Pokaż, jak uzyskać historię strony.

// 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();
                                           }

Pokaż, jak dodać stronę z podstroną.

// 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

Zostaw lub ustaw marżę.

public Margins Margin { get; set; }

Wartość nieruchomości

Margins

PageContentRevisionSummary

Otrzymuje lub ustawia podsumowanie przeglądu dla strony i jest to węzły dziecięce.

public RevisionSummary PageContentRevisionSummary { get; set; }

Wartość nieruchomości

RevisionSummary

Examples

Pokaż, jak edytować informacje meta strony.

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

Pokazuje, jak sprawdzić, czy strona jest stroną konfliktu (tj. ma zmiany, które OneNote nie mogło automatycznie połączyć).

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

Otrzymuje lub ustawia rozmiar rozmiaru strony wyświetlany w edytorze.

public SizeF PageLayoutSize { get; set; }

Wartość nieruchomości

SizeF

Remarks

Wartość ta jest używana przez aplikację Microsoft OneNote do wyświetlania podstawowego układu strony, gdy dokument jest otwarty.Nie wpływa to jednak na drukowanie i przechowywanie dokumentu.Kiedy właściwość Page.SizeType jest ustawiona na PageSzepe.sizeByContent, ta nieruchomość zwraca rzeczywistą wielkość treści.

SizeType

Otrzymuje lub ustawia typ rozmiaru strony.

public PageSizeType SizeType { get; set; }

Wartość nieruchomości

PageSizeType

Remarks

Zgodnie ze standardem, strona automatycznie odtwarza. wartość domyślna to Aspose.Note.PageSizeType.SiceByContent.

Title

Otrzymuje lub ustanawia tytuł.

public Title Title { get; set; }

Wartość nieruchomości

Title

Examples

Pokaż, jak uzyskać meta informacje o stronie.

// 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();
                                                          }

Pokaż, jak edytować historię strony.

// 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");
                                            }

Pokaż, jak ustawić tytuł dla strony.

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

Pokaż, jak uzyskać historię strony.

// 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();
                                           }

Pokaż, jak utworzyć dokument i zapisać go w formacie html za pomocą opcji domyślnych.

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

Pokaż, jak utworzyć dokument i zapisać w formacie html określony zakres stron.

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

Pokaż, jak utworzyć dokument z tytułem strony.

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

Pokaż, jak zapisać dokument w różnych formach.

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

Przyjmuje odwiedzającego węzła.

public override void Accept(DocumentVisitor visitor)

Parameters

visitor DocumentVisitor

Obiekt klasy pochodzi z Aspose.Note.DocumentVisitor.

Clone(Bool)

Klonuj stronę.

public Page Clone(bool cloneHistory = false)

Parameters

cloneHistory bool

Wyjaśnij, czy historia strony powinna być klonowana.

Returns

Page

To jest klon strony.

Examples

Pokaż, jak przenieść aktualną wersję strony do historii.

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

Pokaż jak klonować stronę.

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

Zwiastun T1>()

Zdobądź wszystkie węzły dla dzieci na stronie według typu przycisku.

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

Returns

List

Lista węzłów dziecięcych.

Rodzaj parametrów

T1

Rodzaj elementów w zwróconej liście.

Examples

Pokaż, jak uzyskać cały tekst z dokumentu.

// 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>

Pokaż, jak uzyskać cały tekst z strony.

// 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>

Pokaż, jak przejść przez wszystkie strony i dokonać zastąpienia w tekście.

// 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,>

Pokaż, jak przejść przez tekst strony i dokonać zastąpienia.

// 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,>

 Polski