假设我想在身体中添加以下2 DIVs
。
<body data-absolute-enabled="true">
<div style="position:absolute;left:48px;top:115px;width:624px">
DIV 1
</div>
<div style="position:absolute;left:630px;top:108px;width:624px">
DIV 2
</div>
</body>
我能够update an existing Page content但我无法在身体中添加新的绝对定位DIV
部分。
它将DIV
元素添加到现有页面中的第一个DIV
,因此似乎没有任何意义。
MultipartFormDataContent form = new MultipartFormDataContent();
var strJson = "[{'target':'body','action':'append','content': '<div> ...... </div>'}]";
var streamcontent_html_update = new StringContent(strJson);
streamcontent_html_update.Headers.ContentType =
new MediaTypeHeaderValue("application/json");
form.Add(streamcontent_html_update, "Commands");
//...
var requestUrl = graphClient.Users[userPrincipalName]
.Onenote
.Pages[strpageid]
.Content
.Request()
.RequestUrl;
HttpRequestMessage hrm =
new HttpRequestMessage(new HttpMethod("PATCH"), requestUrl);
hrm.Content = form;
await graphClient.AuthenticationProvider.AuthenticateRequestAsync(hrm);
HttpResponseMessage response =
await graphClient.HttpProvider.SendAsync(hrm);
这样做的正确方法是什么?
基本上我想用我自己的新HTML数据替换整个页面内容。请注意,当我创建新页面时,位置数据会起作用。
答案 0 :(得分:0)
https://msdn.microsoft.com/en-us/office/office365/howto/onenote-abs-pos
您是否尝试添加绝对定位的div,如上面链接指南中所述?
<body data-absolute-enabled="true">
<p>This content will appear in the _default div.</p>
<div style="position:absolute;top:175px;left:100px" data-id="div1">
<p>This content will appear in an absolute positioned div.</p>
</div>
<div>
<p>This content will also appear in the _default div.</p>
</div>
</body>