Ms word 拖动MS Word中的文本项,并使用Office JavaScript API创建鼠标向上移动事件的内容控件

Ms word 拖动MS Word中的文本项,并使用Office JavaScript API创建鼠标向上移动事件的内容控件,ms-word,office-js,office-addins,Ms Word,Office Js,Office Addins,我正在开发文档自动化解决方案,通过该解决方案,用户可以将项目从自定义文本列表(任务窗格)拖到Word文档中。我想使用Office.js创建外接程序 在VSTO中,我们将获得按钮关闭事件,在该事件中,我们将处理DragDrop: if (MouseButtons == MouseButtons.Left) { strValue = (sender as Button).Text; ThisAddIn.objWordApplication.Selection.SetRange(Cu

我正在开发文档自动化解决方案,通过该解决方案,用户可以将项目从自定义文本列表(任务窗格)拖到Word文档中。我想使用Office.js创建外接程序

在VSTO中,我们将获得按钮关闭事件,在该事件中,我们将处理DragDrop:

if (MouseButtons == MouseButtons.Left)
{
    strValue = (sender as Button).Text;

    ThisAddIn.objWordApplication.Selection.SetRange(Cursor.Position.X, Cursor.Position.Y);
    (sender as Button).DoDragDrop(" ", DragDropEffects.All);
    oCC1 = ThisAddIn.objWordApplication.ActiveDocument.ContentControls.Add(Word.WdContentControlType.wdContentControlText);
    oCC1.Range.Text = strValue;
}
使用Office.js,从html容器(任务窗格)到Word文档,是否可以实现相同的功能


谢谢

您无法在Office JS中处理按钮事件,但这是个好主意。请至少提出这个建议