// 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(doc); // Initialize Outline class object Outline outline = new Outline(doc); // Initialize OutlineElement class object OutlineElement outlineElem = new OutlineElement(doc); // Initialize TextStyle class object and set formatting properties ParagraphStyle textStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 }; // Initialize RichText class object and apply text style RichText text = new RichText(doc) { Text = "Hello OneNote text!", ParagraphStyle = textStyle }; // Add RichText node outlineElem.AppendChildLast(text); // Add OutlineElement node outline.AppendChildLast(outlineElem); // Add Outline node page.AppendChildLast(outline); // Add Page node doc.AppendChildLast(page); dataDir = dataDir + "CreateDocWithSimpleRichText_out.one"; // Save OneNote document doc.Save(dataDir);