以编程方式 export/print 到 pdf
programmatically export/print to pdf
是否可以在 Word 网络应用程序中 export/print 以编程方式生成 pdf?
我的研究表明这目前是不可能的,但我想确保我没有遗漏任何东西
是的,你可以试试这个getFileAsync API:
这是获取 PDF 格式文档的示例代码。
// The following example gets the document in PDF format.
Office.context.document.getFileAsync(Office.FileType.Pdf,
function(result) {
if (result.status == "succeeded") {
var myFile = result.value;
var sliceCount = myFile.sliceCount;
app.showNotification("File size:" + myFile.size + " #Slices: " + sliceCount);
// Now, you can call getSliceAsync to download the files,
// as described in the previous code segment (compressed format).
myFile.closeAsync();
}
else {
app.showNotification("Error:", result.error.message);
}
}
是否可以在 Word 网络应用程序中 export/print 以编程方式生成 pdf?
我的研究表明这目前是不可能的,但我想确保我没有遗漏任何东西
是的,你可以试试这个getFileAsync API:
这是获取 PDF 格式文档的示例代码。
// The following example gets the document in PDF format.
Office.context.document.getFileAsync(Office.FileType.Pdf,
function(result) {
if (result.status == "succeeded") {
var myFile = result.value;
var sliceCount = myFile.sliceCount;
app.showNotification("File size:" + myFile.size + " #Slices: " + sliceCount);
// Now, you can call getSliceAsync to download the files,
// as described in the previous code segment (compressed format).
myFile.closeAsync();
}
else {
app.showNotification("Error:", result.error.message);
}
}