Reputation: 41
I am getting the HTML of the OneNote page using GET pages REST API of OneNote. Here is the dummy code --
<html lang="nl-NL"> <head>
<title>Sales meeting III</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="created" content="2017-03-14T17:30:00.0000000" />
</head>
<body data-absolute-enabled="true" style="font-family:Calibri;font-size:11pt">
<div id="div:{e5d84e97-3676-4df2-9bc6-b9583ebae493}{50}" style="position:absolute;left:48px;top:115px;width:625px">
<p id="p:{e5d84e97-3676-4df2-9bc6-b9583ebae493}{34}" style="font-size:17pt;margin-top:0pt;margin-bottom:0pt">Sales Meeting</p>
<p id="p:{e5d84e97-3676-4df2-9bc6-b9583ebae493}{36}" style="font-size:10pt;color:gray;margin-top:0pt;margin-bottom:0pt">donderdag 9 maart 2017</p>
<p id="p:{e5d84e97-3676-4df2-9bc6-b9583ebae493}{38}" style="font-size:10pt;color:gray;margin-top:0pt;margin-bottom:0pt">20:00</p>
<p id="p:{d6174a59-03a8-4010-9ad9-e5a2e6f57bb3}{28}" lang="en-US" data-tag="to-do" data-id="p:{e5d84e97-3676-4df2-9bc6-b9583ebae493}{40}" style="margin-top:0pt;margin-bottom:0pt">Send draft press release to marketing team</p><br/><br/>
<p id="p:{d6174a59-03a8-4010-9ad9-e5a2e6f57bb3}{33}" lang="en-US" data-tag="to-do" data-id="p:{e5d84e97-3676-4df2-9bc6-b9583ebae493}{43}" style="margin-top:0pt;margin-bottom:0pt">Schedule briefing</p><br/><br/>
<p id="p:{d6174a59-03a8-4010-9ad9-e5a2e6f57bb3}{38}" lang="en-US" data-tag="to-do" data-id="p:{e5d84e97-3676-4df2-9bc6-b9583ebae493}{45}" style="margin-top:0pt;margin-bottom:0pt">Jack is the greatest</p>
<p id="p:{b1177410-4d6e-4ef7-b82c-32695a02218b}{13}" lang="en-US" style="margin-top:0pt;margin-bottom:0pt"></p> <br/><br/>
<br/><br/>
<p id="p:{b1177410-4d6e-4ef7-b82c-32695a02218b}{13}" lang="en-US" style="margin-top:0pt;margin-bottom:0pt">This is Testing</p> <br/><br/>
</div> </body> </html>
Now, I am updating only "p" (paragraph) tag using their unique id by "replace" method in PATCH API. This action is not at all related to rest of the HTML of the page as per my knowledge. Content is getting updated properly and I am getting successfull response from the API but it is removing br tags as well. Which disturbs the indentation of the page.
How can I maintain the indentation of page or how to avoid the removal of br tags or line breaks of the page, I want them as it is on the page.
Thanks in advance.
Upvotes: 1
Views: 293
Reputation: 151
Here are the answers to your 2 questions -
How to maintain line breaks
How to maintain indentation
Upvotes: 1
Reputation: 627
Hi Anupam
How are you creating your OneNote page?
I've just tried creating a page both programmatically and by direct editing in OneNote Online and the br tags are confined to paragraph tags and survive patching.
Upvotes: 1