[英]Not able to insert the base64 data into the Word with Office Word add-in
我正在嘗試使用insertFileFromBase64()
插入格式為Base64的文件,但出現此異常:
{
"name": "OfficeExtension.Error",
"code": "GeneralException",
"message": "ooxmlIsMalformated",
"traceMessages": [],
"innerError": null,
"debugInfo": {
"code": "GeneralException",
"message": "ooxmlIsMalformated",
"errorLocation": "Body.insertFileFromBase64"
}
}
我的代碼是:
// documentData - is a base64 string.
// Encoded base64 string = "V29yZCBEb2N1bWVudCBpcyBub3QgZ2V0IGluc2VydGVkIHVzaW5nIGluc2VydEZpbGVCYXNlNjQ="
body.insertFileFromBase64(documentData,window.Word.InsertLocation.replace);
我已經嘗試了其他適用於HTML和文本的方法,但是使用insertFileFromBase64
獲得異常。
如果我在這里遺漏任何東西,有人可以指導我嗎?
從文檔中 , base64File
參數采用“ .docx文件的base64編碼內容”。
您傳遞的字符串不是編碼的.docx
,而僅僅是編碼的字符串。 你得到的例外是正確的,你正在過OOXML 是 malformated(或者更確切地說,它不是OOXML在所有)。
您將需要傳遞經過Base64編碼的正確的OOXML文檔,此方法才能起作用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.