【发布时间】:2015-04-29 16:15:41
【问题描述】:
我们正在开发一个 Office 任务窗格应用程序,用于搜索特定文本并将其替换为值。
例如,我们有一个word文档:
Total invoice of this year <<thisYear>> is <<totalInvoice>>
在任务窗格应用程序中,当用户单击按钮时,应用程序应搜索 > 周围的文本,并将其替换为来自互联网数据的真实值。结果应如下所示:
Total invoice of this year 2015 is $2,000,078.34
我是 Office 任务窗格应用程序的新手,我应该怎么做?
============== 更新=================
除了从 MS 运行演示之外,我什么也没做。该演示展示了如何从 word 文档中获取选定的文本。很容易理解。
function getDataFromSelection() {
Office.context.document.getSelectedDataAsync(Office.CoercionType.Text,
function (result) {
if (result.status === Office.AsyncResultStatus.Succeeded) {
app.showNotification('The selected text is:', '"' + result.value + '"');
} else {
app.showNotification('Error:', result.error.message);
}
}
);
}
但是,我没有找到任何 Find 或 Replace API,但是:
Document API
Document object
bindings property
customXmlParts property
mode property
settings property
url property
addHandlerAsync method
getActiveViewAsync method
getFileAsync method
getFilePropertiesAsync method
getSelectedDataAsync method
goToByIdAsync method
removeHandlerAsync method
setSelectedDataAsync method
ActiveViewChanged event
SelectionChanged event
【问题讨论】:
-
请告诉我们你做了什么?
-
我更新了问题,@DhruvJoshi,请看一下。
-
查看业务问题陈述,我相信您不需要为此使用应用程序,因为 Word 文档中的邮件合并完全可以满足您的需求。
标签: office365