【问题标题】:How to chage absolute position of an onenote elemente with microsoft graph如何使用 microsoft graph 更改 onenote elemente 的绝对位置
【发布时间】:2021-07-15 05:16:11
【问题描述】:

我正在尝试更改 OneNote div 的绝对位置,但没有成功。 我可以使用绝对定位的 div 创建全身:

这是我的要求:

[
   {
    'target':'body',
    'action':'replace',
    'content':'<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>'
  }
]

这是输出的html(没关系):

<html>

<head>
    <title>x2222x</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="created" content="2021-04-18T09:13:00.0000000" />
</head>

<body data-absolute-enabled="true" style="font-family:Calibri;font-size:11pt">
    <div id="div:{f3e8317f-4b34-00f5-3826-a7b41de83075}{18}" style="position:absolute;left:48px;top:91px;width:624px">
        <p id="p:{ef5cb98c-74e7-4c65-b51a-0adbc66d9c97}{225}" lang="en-US" style="margin-top:5.5pt;margin-bottom:5.5pt">
            This content will appear in the _default div.</p>
        <p id="p:{ef5cb98c-74e7-4c65-b51a-0adbc66d9c97}{228}" lang="en-US" style="margin-top:5.5pt;margin-bottom:5.5pt">
            This content will also appear in the _default div.</p>
    </div>
    <div id="div:{ef5cb98c-74e7-4c65-b51a-0adbc66d9c97}{229}" data-id="div1"
        style="position:absolute;left:99px;top:174px;width:624px">
        <p id="p:{ef5cb98c-74e7-4c65-b51a-0adbc66d9c97}{233}" lang="en-US" style="margin-top:5.5pt;margin-bottom:5.5pt">
            This content will appear in an absolute positioned div.</p>
    </div>
</body>

</html>

OneNote Page

但是,我不能改变这个位置,我需要“移动” div1。如何将绝对位置更改为特定的 div?

这是我“移动” div1(按 id)的请求,但它不起作用:

PACH https://graph.microsoft.com/v1.0/me/onenote/pages/{my_page_id}/content
[
   {
    'target':'div:{ef5cb98c-74e7-4c65-b51a-0adbc66d9c97}{229}',
    'action':'replace',
    'content':'<div style="position:absolute;top:350px;left:200px" data-id="div1">
      <p>This content will appear in an absolute positioned div (updated).</p>
    </div>'
  }
]

谢谢!!!

【问题讨论】:

  • 您是否要移动 div 及其内容?你得到什么结果? Replace 将在指定的位置参数上创建一个新的过时 div。这是你所期望的吗?
  • 是的,我需要将其移动到包含内容的特定位置。

标签: microsoft-graph-api onenote-api microsoft-graph-onenote


【解决方案1】:

查看relevant documents page 绝对定位的 div 不能简单替换,它们必须是 body 元素的直接子元素。
因此,实现您正在寻找的结果的唯一方法是更换整个身体。

【讨论】:

    猜你喜欢
    • 2021-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-15
    相关资源
    最近更新 更多