例如,我有一个名为 first.doc 的文档,其中包含两个 Hello World 的单词。我想获得 Hello World 的坐标。有没有办法获得这些坐标?
答案 0 :(得分:1)
Range.Find
和Window.GetPoint
可用于解决此问题:
Application application = new Application();
Document wordDoc = application.Documents.Open(@"C:\first.doc");
Range range = application.ActiveDocument.Content;
range.Find.Execute("hello world");
int left, top, width, height;
application.ActiveWindow.GetPoint(out left, out top, out width, out height, range);