Reputation: 2517
I've created my own OneNote Add-in using Nodejs. I am having two issues. I've searched high and low and haven't found a solution.
My add-in adds a new outline to a OneNote page. This outline contains an HTML table with one column and multiple rows. I want set the background of some of the HTML table rows. I have tried everything I could think of, including:
<tr bgcolor='red'>
<td bgcolor='red'>
<tr style='background-color:red'>
<td style='background-color:red'>
Noting works. Additionally, I want one of the cells in my table to use   and not strip out extra white space.   doesn't work. Neither <pre>
tag. OneNote just ignores my markup, except I was able to specify the thickness of the table border <table border=1>
.
For reference, I cannabalized this sample code: Build your first OneNote task pane add-in
I used the above sample code to create this: taskpane.js in my Github repo
Upvotes: 3
Views: 1924
Reputation: 21
Good morning,
I know that this is an old post relatively but I couldn't see many others asking the same question and I've just found a solution.
Essentially you can do normal inline styling but you need to use the backslash for the quotes inside the "var html =..." line.
For example.
var html = "<p style=\"color: blue;font-family:Courier;text-align:center;background-color:yellow;\"> This paragraph shows blue, Courier text</p><table><tr><td style=\"background-color: #D6EEEE;\">A light blue coloured table cell</td></tr></table>"
Hopefully I can now find a way to change the whole page colour programatically...
Chris
Upvotes: 2
Reputation: 2517
To answer my own question...
I found this after posting the question:
OneNote API HTML tag support
It doesn't appear that Microsoft supports bgcolor, background CSS on tables/tr/td, nor CSS in general with respect to the OneNote API. The <pre>
tag and   is not even listed.
Upvotes: 2