I have developed my own OneNote Add-in using Nodejs, but I am encountering two issues that I have been unable to resolve despite extensive research.
The add-in I created adds a new outline to a OneNote page, which includes an HTML table with one column and multiple rows. My goal is to set the background color of specific rows within the table. I have attempted various methods, such as:
- Using the bgcolor attribute for TR:
<tr bgcolor='red'>
- Applying the bgcolor attribute to TD:
<td bgcolor='red'>
- Setting the style attribute for TR:
<tr style='background-color:red'>
- Applying the style attribute to TD:
<td style='background-color:red'>
- Utilizing a separate CSS file
- Using the Hex value for the color (red) #FF0000
- Exporting a OneNote 2016 page as "Single File Web Page (*.mht)", inspecting the contents and trying to replicate them manually
- Attempting to view source on the OneNote web version of my page in order to inspect a table row with a background color setting (however, the content is deeply buried)
- Trying to programmatically add HTML content to the page, though Microsoft's OneNote API does not offer clear guidance on inserting a table
Despite all efforts, nothing seems to work. Additionally, I wish to use   in one of the table cells to preserve white space, but neither this nor the <pre>
tag function as expected. OneNote simply disregards my markup, except for specifying the thickness of the table border with <table border=1>
.
For reference, I adapted code from the following sample: Build your first OneNote task pane add-in
The above sample enabled me to develop the following: taskpane.js in my GitHub repository