【问题标题】:VSTO get left and top coordinates of pointer postionVSTO获取指针位置的左上坐标
【发布时间】:2013-06-29 18:58:33
【问题描述】:

我想在 Excel 中获取 活动单元格 的左上坐标和上坐标,并在 Word 中获取相同的指针位置,以便我可以在用户指定的位置插入图像。 p>

【问题讨论】:

    标签: vsto office-addins


    【解决方案1】:

    Excel 中的 ActiveSheet.Pictures.Insert() 和 Word 中的 Application.Selection.InlineShapes.AddPicture 将在选择和活动单元格处插入图片。

    但是要获取 x,y 信息,您可以使用以下 api

    单词

    wordAppliaction.Selection.get_Information(WdInformation.wdVerticalPositionRelativeToPage)
    
    wordAppliaction.Selection.get_Information(WdInformation.wdHorizontalPositionRelativeToPage)
    

    在 Excel 中 精确获取坐标可能很棘手,您可以尝试使用

    Range.Top and Range.Left
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-05-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-28
      相关资源
      最近更新 更多