按字符串选择范围
我如何更改此功能,以便选择 Word 文档中字符“E”和“F”之间的字符范围(如果有); xasdasdEcdscasdcFvfvsdfv 对我来说是下划线的范围 -> cdscasdc
private void Rango()
{
Word.Range rng;
Word.Document document = this.Application.ActiveDocument;
object startLocation = "E";
object endLocation = "F";
// Supply a Start and End value for the Range.
rng = document.Range(ref startLocation, ref endLocation);
// Select the Range.
rng.Select();
}
这个函数不会让我通过引用传递两个字符串类型的对象.......
谢谢
How I can change this feature so I select the range of characters in a word document between the characters "E" and "F", if I have; xasdasdEcdscasdcFvfvsdfv is underlined to me the range -> cdscasdc
private void Rango()
{
Word.Range rng;
Word.Document document = this.Application.ActiveDocument;
object startLocation = "E";
object endLocation = "F";
// Supply a Start and End value for the Range.
rng = document.Range(ref startLocation, ref endLocation);
// Select the Range.
rng.Select();
}
This function will not let me pass by reference two objects of string type.......
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要传递文档中您想要范围覆盖的位置,请参阅:
如何:定义和选择文档中的范围
我添加了一些示例代码如下:
不要忘记关闭文档和Word等。
You need to pass the position in the document you want the range to cover, see:
How to: Define and Select Ranges in Documents
I have added some example code below:
Do not forget to close the document and Word etc.