2

I'm trying to transfer information from a Word Document to a OneNote document. I got the html which made up the contents of a word document, but I want to take that html that was generated and store that into a OneNote file.

I have tried things like the OneNote API and the Microsoft Graph API, but is there a way to do this without using those API tools? Here is the code I have for generating the HTML from a word document.

    byte[] byteArray = File.ReadAllBytes("GreetingFile2.docx");
    using (MemoryStream memoryStream = new MemoryStream())
    {
        memoryStream.Write(byteArray, 0, byteArray.Length);
        using (WordprocessingDocument doc = WordprocessingDocument.Open(memoryStream, true))
        {
            HtmlConverterSettings settings = new HtmlConverterSettings()
            {
                PageTitle = "My Page Title"
            };
            XElement html = HtmlConverter.ConvertToHtml(doc, settings);

            File.WriteAllText("‪Something.html", html.ToStringNewLineOnAttributes());
        }
    }

Thanks!

  • https://stackoverflow.com/questions/27294510/how-to-write-to-a-onenote-2013-page-using-c-sharp-and-the-onenote-interop – Bender Bending Aug 18 '17 at 16:31
  • If I used the code from the post(with a few modifications to adhere to what I already have). Would the html I write to it translate into onenote as actual text and tables? –  Aug 18 '17 at 16:52

0 Answers0