【问题标题】:Drag text item in MS Word and create Content Control on mouse up event using Office JavaScript API在 MS Word 中拖动文本项并使用 Office JavaScript API 在鼠标向上事件上创建内容控件
【发布时间】:2018-07-21 12:05:46
【问题描述】:

我正在开发文档自动化解决方案,用户可以通过该解决方案将项目从自定义文本列表(任务窗格)拖到 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 文档的相同操作?

谢谢

【问题讨论】:

    标签: ms-word office-js office-addins


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-18
      • 2011-09-23
      • 1970-01-01
      • 2012-05-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多