日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > HTML >内容正文

HTML

onenote导入html文件,OneNote加入:获取HTML内容

發布時間:2023/12/9 HTML 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 onenote导入html文件,OneNote加入:获取HTML内容 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

在example中,提供了用于獲取RichText的代碼。它能夠獲得頁面的文本內容,但我似乎無法得到它返回頁面格式化內容的HTML。OneNote加入:獲取HTML內容

例如:

Header:

A

B

應該是:

Header:

  • A
  • B

然而,示例代碼使用richText/text和只返回Header:。是否有可能做類似richText/HTML并獲得上面顯示的HTML? (注意:我只想使用加載項而不是OneNote REST API。)

謝謝!從文檔

代碼片段:

OneNote.run(function (context) {

// Get the collection of pageContent items from the page.

var pageContents = context.application.getActivePage().contents;

// Get the first PageContent on the page, and then get its outline's paragraphs.

var outlinePageContents = [];

var paragraphs = [];

var richTextParagraphs = [];

// Queue a command to load the id and type of each page content in the outline.

pageContents.load("id,type");

// Run the queued commands, and return a promise to indicate task completion.

return context.sync()

.then(function() {

// Load all page contents of type Outline

$.each(pageContents.items, function(index, pageContent) {

if(pageContent.type == 'Outline')

{

pageContent.load('outline,outline/paragraphs,outline/paragraphs/type');

outlinePageContents.push(pageContent);

}

});

return context.sync();

})

.then(function() {

// Load all rich text paragraphs across outlines

$.each(outlinePageContents, function(index, outlinePageContent) {

var outline = outlinePageContent.outline;

paragraphs = paragraphs.concat(outline.paragraphs.items);

});

$.each(paragraphs, function(index, paragraph) {

if(paragraph.type == 'RichText')

{

richTextParagraphs.push(paragraph);

paragraph.load("id,richText/text");

}

});

return context.sync();

})

.then(function() {

// Display all rich text paragraphs to the console

$.each(richTextParagraphs, function(index, richTextParagraph) {

var richText = richTextParagraph.richText;

console.log("Paragraph found with richtext content : " + richText.text + " and richtext id : " + richText.id);

});

return context.sync();

});

})

.catch(function(error) {

console.log("Error: " + error);

if (error instanceof OfficeExtension.Error) {

console.log("Debug info: " + JSON.stringify(error.debugInfo));

}

});

+0

richTextParagraph.richText對象有哪些屬性?其中有一個html嗎?如果是這樣,它的返回類型是什么? –

+0

屬性只有'id'和'text'(都是'String'類型)。根據https://dev.office.com/reference/add-ins/onenote/richtext –

總結

以上是生活随笔為你收集整理的onenote导入html文件,OneNote加入:获取HTML内容的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。