public static void Run() { // ExStart:CreateDocWithRootAndSubPages // 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); TextStyle textStyle = new TextStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 }; RichText text = new RichText(doc) { Text = "First page.", DefaultStyle = textStyle }; outlineElem.AppendChild(text); outline.AppendChild(outlineElem); page1.AppendChild(outline); /*---------- Adding nodes to second Page ----------*/ var outline2 = new Outline(doc); var outlineElem2 = new OutlineElement(doc); var textStyle2 = new TextStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 }; var text2 = new RichText(doc) { Text = "Second page.", DefaultStyle = textStyle2 }; outlineElem2.AppendChild(text2); outline2.AppendChild(outlineElem2); page2.AppendChild(outline2); /*---------- Adding nodes to third Page ----------*/ var outline3 = new Outline(doc); var outlineElem3 = new OutlineElement(doc); var textStyle3 = new TextStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 }; var text3 = new RichText(doc) { Text = "Third page.", DefaultStyle = textStyle3 }; outlineElem3.AppendChild(text3); outline3.AppendChild(outlineElem3); page3.AppendChild(outline3); /*---------- Add pages to the OneNote Document ----------*/ doc.AppendChild(page1); doc.AppendChild(page2); doc.AppendChild(page3); dataDir = dataDir + "CreateDocWithRootAndSubPages_out.one"; // Save OneNote document doc.Save(dataDir); // ExEnd:CreateDocWithRootAndSubPages Console.WriteLine("\nOneNote document created successfully with root and sub level pages.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:InsertChineseNumberList 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 TextStyle defaultStyle = new TextStyle { 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", DefaultStyle = defaultStyle }; outlineElem1.AppendChild(text1); //------------------------ OutlineElement outlineElem2 = new OutlineElement(doc) { NumberList = new NumberList("{0})", NumberFormat.ChineseCounting, "Arial", 10) }; RichText text2 = new RichText(doc) { Text = "Second", DefaultStyle = defaultStyle }; outlineElem2.AppendChild(text2); //------------------------ OutlineElement outlineElem3 = new OutlineElement(doc) { NumberList = new NumberList("{0})", NumberFormat.ChineseCounting, "Arial", 10) }; RichText text3 = new RichText(doc) { Text = "Third", DefaultStyle = defaultStyle }; outlineElem3.AppendChild(text3); //------------------------ outline.AppendChild(outlineElem1); outline.AppendChild(outlineElem2); outline.AppendChild(outlineElem3); page.AppendChild(outline); doc.AppendChild(page); dataDir = dataDir + "InsertChineseNumberList_out.one"; // Save OneNote document doc.Save(dataDir); // ExEnd:InsertChineseNumberList Console.WriteLine("\nChinese number list inserted successfully.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:ApplyNumberingOnText 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 TextStyle defaultStyle = new TextStyle { 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", DefaultStyle = defaultStyle }; outlineElem1.AppendChild(text1); OutlineElement outlineElem2 = new OutlineElement(doc) { NumberList = new NumberList("{0})", NumberFormat.DecimalNumbers, "Arial", 10) }; RichText text2 = new RichText(doc) { Text = "Second", DefaultStyle = defaultStyle }; outlineElem2.AppendChild(text2); OutlineElement outlineElem3 = new OutlineElement(doc) { NumberList = new NumberList("{0})", NumberFormat.DecimalNumbers, "Arial", 10) }; RichText text3 = new RichText(doc) { Text = "Third", DefaultStyle = defaultStyle }; outlineElem3.AppendChild(text3); // Add outline elements outline.AppendChild(outlineElem1); outline.AppendChild(outlineElem2); outline.AppendChild(outlineElem3); // Add Outline node page.AppendChild(outline); // Add Page node doc.AppendChild(page); dataDir = dataDir + "ApplyNumberingOnText_out.one"; // Save OneNote document doc.Save(dataDir); // ExEnd:ApplyNumberingOnText Console.WriteLine("\nNumbering applied successfully on a text.\nFile saved at " + dataDir); }
public NavigateToOutlineEventArgs([CanBeNull] OutlineElement outlineElement) { OutlineElement = outlineElement; }
public static void Run() { // ExStart:CreateTableWithLockedColumns // ExFor:Table // ExFor:Table.Columns // ExFor:Table.IsBordersVisible // ExFor:TableColumn // ExFor:TableColumn.Width // ExFor:TableColumn.LockedWidth // ExFor:TableRow // ExFor:TableCell // ExSummary:Shows how to create a table with a locked column. // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Tables(); // 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 TableRow class object TableRow row1 = new TableRow(doc); // Initialize TableCell class object and set text content TableCell cell11 = new TableCell(doc); cell11.AppendChildLast(InsertTable.GetOutlineElementWithText(doc, "Small text")); row1.AppendChildLast(cell11); // Initialize TableRow class object TableRow row2 = new TableRow(doc); // Initialize TableCell class object and set text content TableCell cell21 = new TableCell(doc); cell21.AppendChildLast(InsertTable.GetOutlineElementWithText(doc, "Long text with several words and spaces.")); row2.AppendChildLast(cell21); // Initialize Table class object Table table = new Table(doc) { IsBordersVisible = true, Columns = { new TableColumn { Width = 70, LockedWidth = true } } }; // Add rows table.AppendChildLast(row1); table.AppendChildLast(row2); Outline outline = new Outline(doc); OutlineElement outlineElem = new OutlineElement(doc); // Add table node outlineElem.AppendChildLast(table); // Add outline element node outline.AppendChildLast(outlineElem); // Add outline node page.AppendChildLast(outline); // Add page node doc.AppendChildLast(page); dataDir = dataDir + "CreateTableWithLockedColumns_out.one"; doc.Save(dataDir); // ExEnd:CreateTableWithLockedColumns Console.WriteLine("\nTable with locked columns created successfully.\nFile saved at " + dataDir); }
/// <summary> /// Called when a OutlineElement node is encountered in the document. /// </summary> public override void VisitOutlineElementStart(OutlineElement outlineElement) { ++nodecount; }
public static void Run() { // ExStart:CreateDocWithFormattedRichText // The path to the documents directory. string dataDir = RunExamples.GetDataDir_LoadingAndSaving(); // 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 Title class object Title title = new Title(doc); // Initialize TextStyle class object and set formatting properties TextStyle defaultTextStyle = new TextStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 }; RichText titleText = new RichText(doc) { Text = "Title!", DefaultStyle = defaultTextStyle }; Outline outline = new Outline(doc) { VerticalOffset = 100, HorizontalOffset = 100 }; OutlineElement outlineElem = new OutlineElement(doc); // RunIndex = 5 means the style will be applied only to 0-4 characters. ("Hello") TextStyle textStyleForHelloWord = new TextStyle { FontColor = Color.Red, FontName = "Arial", FontSize = 10, RunIndex = 5, }; // RunIndex = 13 means the style will be applied only to 5-12 characters. (" OneNote") TextStyle textStyleForOneNoteWord = new TextStyle { FontColor = Color.Green, FontName = "Calibri", FontSize = 10, IsItalic = true, RunIndex = 13, }; // RunIndex = 18 means the style will be applied only to 13-17 characters. (" text"). // Other characters ("!") will have the default style. TextStyle textStyleForTextWord = new TextStyle { FontColor = Color.Blue, FontName = "Arial", FontSize = 15, IsBold = true, IsItalic = true, RunIndex = 18, }; RichText text = new RichText(doc) { Text = "Hello OneNote text!", DefaultStyle = defaultTextStyle, Styles = { textStyleForHelloWord, textStyleForOneNoteWord, textStyleForTextWord } }; title.TitleText = titleText; // Set page title page.Title = title; // Add RichText node outlineElem.AppendChild(text); // Add OutlineElement node outline.AppendChild(outlineElem); // Add Outline node page.AppendChild(outline); // Add Page node doc.AppendChild(page); dataDir = dataDir + "CreateDocWithFormattedRichText_out.one"; // Save OneNote document doc.Save(dataDir); // ExEnd:CreateDocWithFormattedRichText Console.WriteLine("\nOneNote document created successfully with formatted rich text.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:CreateDocWithFormattedRichText // ExFor:SaveOptions.PageIndex // ExFor:RichText.Append(System.String,TextStyle) // ExSummary:Shows how to create a document with formatted rich text. // The path to the documents directory. string dataDir = RunExamples.GetDataDir_LoadingAndSaving(); // Create an object of the Document class Document doc = new Document(); // Initialize Page class object Page page = new Page(); // Initialize Title class object Title title = new Title(); // Initialize TextStyle class object and set formatting properties ParagraphStyle defaultTextStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 }; RichText titleText = new RichText() { ParagraphStyle = defaultTextStyle }.Append("Title!"); Outline outline = new Outline() { VerticalOffset = 100, HorizontalOffset = 100 }; OutlineElement outlineElem = new OutlineElement(); TextStyle textStyleForHelloWord = new TextStyle { FontColor = Color.Red, FontName = "Arial", FontSize = 10, }; TextStyle textStyleForOneNoteWord = new TextStyle { FontColor = Color.Green, FontName = "Calibri", FontSize = 10, IsItalic = true, }; TextStyle textStyleForTextWord = new TextStyle { FontColor = Color.Blue, FontName = "Arial", FontSize = 15, IsBold = true, IsItalic = true, }; RichText text = new RichText() { ParagraphStyle = defaultTextStyle } .Append("Hello", textStyleForHelloWord) .Append(" OneNote", textStyleForOneNoteWord) .Append(" text", textStyleForTextWord) .Append("!", TextStyle.Default); title.TitleText = titleText; // Set page title page.Title = title; // Add RichText node outlineElem.AppendChildLast(text); // Add OutlineElement node outline.AppendChildLast(outlineElem); // Add Outline node page.AppendChildLast(outline); // Add Page node doc.AppendChildLast(page); // Save OneNote document dataDir = dataDir + "CreateDocWithFormattedRichText_out.one"; doc.Save(dataDir); // ExEnd:CreateDocWithFormattedRichText Console.WriteLine("\nOneNote document created successfully with formatted rich text.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:ApplyBulletsOnText // ExFor:ParagraphStyle // ExFor:ParagraphStyle.FontColor // ExFor:ParagraphStyle.FontName // ExFor:ParagraphStyle.FontSize // ExFor:Page // ExFor:Outline // ExFor:OutlineElement // ExFor:OutlineElement.NumberList // ExFor:RichText // ExFor:RichText.ParagraphStyle // ExFor:RichText.Text // ExSummary:Shows how to insert new bulleted 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); // ExEnd:ApplyBulletsOnText Console.WriteLine("\nBullets applied successfully on a text.\nFile saved at " + dataDir); }
public RequestNavigateToEventArgs(OutlineElement outlineElement) { OutlineElement = outlineElement; }
public static void Run() { // ExStart:AddHyperlink // ExFor:Document // ExFor:RichText // ExFor:RichText.ParagraphStyle // ExFor:RichText.Styles // ExFor:RichText.Text // ExFor:TextStyle // ExFor:TextStyle.FontColor // ExFor:TextStyle.FontName // ExFor:TextStyle.FontSize // ExFor:TextStyle.RunIndex // ExFor:TextStyle.IsHyperlink // ExFor:TextStyle.HyperlinkAddress // ExSummary:Shows how to bind a hyperlink to a text. // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Tasks(); // Create an object of the Document class Document doc = new Document(); RichText titleText = new RichText(doc) { Text = "Title!", ParagraphStyle = ParagraphStyle.Default }; Outline outline = new Outline(doc) { MaxWidth = 200, MaxHeight = 200, VerticalOffset = 100, HorizontalOffset = 100 }; TextStyle textStyleRed = new TextStyle { FontColor = Color.Red, FontName = "Arial", FontSize = 10, // This style will be applied to 0-7 characters. RunIndex = 8 }; TextStyle textStyleHyperlink = new TextStyle { // This style will be applied to 8-16 characters. RunIndex = 17, IsHyperlink = true, HyperlinkAddress = "www.google.com" }; RichText text = new RichText(doc) { Text = "This is hyperlink. This text is not a hyperlink.", ParagraphStyle = ParagraphStyle.Default, Styles = { textStyleRed, textStyleHyperlink } }; OutlineElement outlineElem = new OutlineElement(doc); outlineElem.AppendChildLast(text); // Add outline elements outline.AppendChildLast(outlineElem); // Initialize Title class object Title title = new Title(doc) { TitleText = titleText }; // Initialize Page class object Aspose.Note.Page page = new Aspose.Note.Page(doc) { Title = title }; // Add Outline node page.AppendChildLast(outline); // Add Page node doc.AppendChildLast(page); // Save OneNote document dataDir = dataDir + "AddHyperlink_out.one"; doc.Save(dataDir); // ExEnd:AddHyperlink Console.WriteLine("\nHyperlink added successfully.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:AddHyperlink // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Tasks(); // 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 Title class object Title title = new Title(doc); TextStyle defaultTextStyle = new TextStyle { FontName = "Arial", FontSize = 10, FontColor = SystemColors.WindowText }; RichText titleText = new RichText(doc) { Text = "Title!", DefaultStyle = defaultTextStyle }; Outline outline = new Outline(doc) { MaxWidth = 200, MaxHeight = 200, VerticalOffset = 100, HorizontalOffset = 100 }; OutlineElement outlineElem = new OutlineElement(doc); TextStyle textStyleRed = new TextStyle { FontColor = Color.Red, FontName = "Arial", FontSize = 10, RunIndex = 8//this style will be applied to 0-7 characters. }; TextStyle textStyleHyperlink = new TextStyle { RunIndex = 17,//this style will be applied to 8-16 characters. IsHyperlink = true, HyperlinkAddress = "www.google.com" }; RichText text = new RichText(doc) { Text = "This is hyperlink. This text is not a hyperlink.", DefaultStyle = defaultTextStyle, Styles = { textStyleRed, textStyleHyperlink } }; title.TitleText = titleText; page.Title = title; outlineElem.AppendChild(text); // Add outline elements outline.AppendChild(outlineElem); // Add Outline node page.AppendChild(outline); // Add Page node doc.AppendChild(page); dataDir = dataDir + "AddHyperlink_out_.one"; // Save OneNote document doc.Save(dataDir); // ExEnd:AddHyperlink Console.WriteLine("\nHyperlink added successfully.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:AddTableNodeWithTag // ExFor:Table // ExFor:Table.Columns // ExFor:Table.IsBordersVisible // ExFor:TableColumn // ExFor:TableColumn.Width // ExFor:TableRow // ExFor:TableCell // ExFor:NoteTag // ExSummary:Shows how to add new table with tag. // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Tags(); // Create an object of the Document class Document doc = new Document(); // Initialize Page class object Aspose.Note.Page page = new Aspose.Note.Page(doc); // Initialize TableRow class object TableRow row = new TableRow(doc); // Initialize TableCell class object TableCell cell = new TableCell(doc); // Insert cell content cell.AppendChildLast(InsertTable.GetOutlineElementWithText(doc, "Single cell.")); // Add cell to row node row.AppendChildLast(cell); // Initialize table node Table table = new Table(doc) { IsBordersVisible = true, Columns = { new TableColumn { Width = 70 } } }; // Insert row node in table table.AppendChildLast(row); // Add tag to this table node table.Tags.Add(NoteTag.CreateQuestionMark()); Outline outline = new Outline(doc); OutlineElement outlineElem = new OutlineElement(doc); // Add table node outlineElem.AppendChildLast(table); // Add outline elements outline.AppendChildLast(outlineElem); page.AppendChildLast(outline); doc.AppendChildLast(page); // Save OneNote document dataDir = dataDir + "AddTableNodeWithTag_out.one"; doc.Save(dataDir); // ExEnd:AddTableNodeWithTag Console.WriteLine("\nTable node with tag added successfully.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:InsertTable // ExFor:Table // ExFor:Table.Columns // ExFor:Table.IsBordersVisible // ExFor:TableColumn // ExFor:TableColumn.Width // ExFor:TableRow // ExFor:TableCell // ExSummary:Shows how to create a new table. // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Tables(); // 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 TableRow class object TableRow row1 = new TableRow(doc); // Initialize TableCell class objects TableCell cell11 = new TableCell(doc); TableCell cell12 = new TableCell(doc); TableCell cell13 = new TableCell(doc); // Append outline elements in the table cell cell11.AppendChildLast(GetOutlineElementWithText(doc, "cell_1.1")); cell12.AppendChildLast(GetOutlineElementWithText(doc, "cell_1.2")); cell13.AppendChildLast(GetOutlineElementWithText(doc, "cell_1.3")); // Table cells to rows row1.AppendChildLast(cell11); row1.AppendChildLast(cell12); row1.AppendChildLast(cell13); // Initialize TableRow class object TableRow row2 = new TableRow(doc); // initialize TableCell class objects TableCell cell21 = new TableCell(doc); TableCell cell22 = new TableCell(doc); TableCell cell23 = new TableCell(doc); // Append outline elements in the table cell cell21.AppendChildLast(GetOutlineElementWithText(doc, "cell_2.1")); cell22.AppendChildLast(GetOutlineElementWithText(doc, "cell_2.2")); cell23.AppendChildLast(GetOutlineElementWithText(doc, "cell_2.3")); // Append table cells to rows row2.AppendChildLast(cell21); row2.AppendChildLast(cell22); row2.AppendChildLast(cell23); // Initialize Table class object and set column widths Table table = new Table(doc) { IsBordersVisible = true, Columns = { new TableColumn { Width = 200 }, new TableColumn { Width = 200 }, new TableColumn { Width = 200 } } }; // Append table rows to table table.AppendChildLast(row1); table.AppendChildLast(row2); // Initialize Outline object Outline outline = new Outline(doc); // Initialize OutlineElement object OutlineElement outlineElem = new OutlineElement(doc); // Add table to outline element node outlineElem.AppendChildLast(table); // Add outline element to outline outline.AppendChildLast(outlineElem); // Add outline to page node page.AppendChildLast(outline); // Add page to document node doc.AppendChildLast(page); dataDir = dataDir + "InsertTable_out.one"; doc.Save(dataDir); // ExEnd:InsertTable Console.WriteLine("\nTable inserted successfully.\nFile saved at " + dataDir); }