Search code examples
office-jsonenoteonenote-api

Adding \n characters inside outline.paragraphs.items[0].insertRichTextAsSibling('Before', code);


I'm trying to add text with \n line break characters inside OneNote's(Web) paragraph via

outline.paragraphs.items[0].insertRichTextAsSibling('Before', text);

the problem is that these newline characters aren't visible in one note. They are visible after page refresh though. Am I missing something?

Gif that shows behavior. http://giphy.com/gifs/l3q2C8LhETxg9KWtO


Solution

  • What you're looking for is insertHtmlAsSibling.

    outline.paragraphs.items[0].insertHtmlAsSibling('Before', "row1<br>row2<br>row3<br>row4<br>);
    

    With that function, you'd be able to create lists, tables, text with special fonts like bold, etc.