How To Write To A OneNote 2013 Page Using C# and The OneNote Interop

后端 未结 4 1689
独厮守ぢ
独厮守ぢ 2020-11-29 08:56

I have seen many articles about this but all of them are either incomplete or do not answer my question. Using C# and the OneNote Interop, I would like to simp

4条回答
  •  没有蜡笔的小新
    2020-11-29 09:11

    Given task can be easily solved using Aspose.Note. Following code creates a new Document and adds text to its title:

    var doc = new Document();
    var page = new Page(doc);
    page.Title = new Title(doc)
    {
        TitleText = new RichText(doc)
                        {
                            Text = "Title text.",
                            DefaultStyle = TextStyle.DefaultMsOneNoteTitleTextStyle
                        },
        TitleDate = new RichText(doc)
                        {
                            Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture),
                            DefaultStyle = TextStyle.DefaultMsOneNoteTitleDateStyle
                        },
        TitleTime = new RichText(doc)
                        {
                            Text = "12:34",
                            DefaultStyle = TextStyle.DefaultMsOneNoteTitleTimeStyle
                        }
    };
    page.AppendChild(outline);
    doc.AppendChild(page);
    doc.Save("output.one")
    

提交回复
热议问题