public static void Run()
        {
            // ExStart:CreateDocWithPageTitle
            // ExFor:Document
            // ExFor:Page
            // ExFor:Page.Title
            // ExFor:Title
            // ExFor:Title.TitleText
            // ExFor:Title.TitleDate
            // ExFor:Title.TitleTime
            // ExSummary:Shows how to create a document with titled page.

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

            // ExEnd:CreateDocWithPageTitle

            Console.WriteLine("\nOneNote document created successfully with page title.\nFile saved at " + dataDir);
        }
Esempio n. 2
0
        public static void Run()
        {
            // ExStart:InsertChineseNumberList
            // ExFor:NumberList
            // 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 list with chinese numbering.

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

            // ExEnd:InsertChineseNumberList

            Console.WriteLine("\nChinese number list inserted successfully.\nFile saved at " + dataDir);
        }
Esempio n. 3
0
        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);
        }