public static void Run() { // ExStart:CreateDocWithPageTitle // 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. Aspose.Note.TextStyle textStyle = new TextStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 }; // Set page title properties page.Title = new Title(doc) { TitleText = new RichText(doc) { Text = "Title text.", DefaultStyle = textStyle }, TitleDate = new RichText(doc) { Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture), DefaultStyle = textStyle }, TitleTime = new RichText(doc) { Text = "12:34", DefaultStyle = textStyle } }; // Append Page node in the document doc.AppendChild(page); dataDir = dataDir + "CreateDocWithPageTitle_out.one"; // Save OneNote document doc.Save(dataDir); // ExEnd:CreateDocWithPageTitle Console.WriteLine("\nOneNote document created successfully with page title.\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:ApplyBulletsOnText 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 TextStyle defaultStyle = new TextStyle { 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", DefaultStyle = defaultStyle }; outlineElem1.AppendChild(text1); OutlineElement outlineElem2 = new OutlineElement(doc) { NumberList = new NumberList("*", "Arial", 10) }; RichText text2 = new RichText(doc) { Text = "Second", DefaultStyle = defaultStyle }; outlineElem2.AppendChild(text2); OutlineElement outlineElem3 = new OutlineElement(doc) { NumberList = new NumberList("*", "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 + "ApplyBulletsOnText_out.one"; // Save OneNote document doc.Save(dataDir); // ExEnd:ApplyBulletsOnText Console.WriteLine("\nBullets applied successfully on a text.\nFile saved at " + dataDir); }