如何删除Msword中从特定范围到文本结尾的文本。 [英] How Can I Delete The Text In Msword From Specific Range To End Of Text.

查看:74
本文介绍了如何删除Msword中从特定范围到文本结尾的文本。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在通过C#应用程序着色MSword Text的应用程序,因为我需要删除从特定范围到文档末尾的文本。我知道我想要删除startindex的范围,但是如何给出文档的结尾我没有结束索引。有没有办法从特定范围到文档结尾删除,而不是手动给出结束索引,如下所示。



 Word.Range range = currentDocument.Range(paragraphPosition1(我知道),End ofdocument(?)); 
range.Delete();

解决方案

看看这里:如何:以编程方式定义和选择文档中的范围 [ ^ ]



您可能正在寻找类似的东西:

 EndOfDocument = doc.Content.End; 
//
EndOfDocument = doc.Paragraphs(doc.Paragraphs.Count ).Range.End;


Hi,

I am working an application of coloring MSword Text through C# application as apart of requirement i have to Delete the text from specific range to end of document .I know the range from which i wanted to remove the startindex, but how to give end of the document i dont have end index.is there any way to delete from specific range to end of document with out giving end index manually like below.

Word.Range range = currentDocument.Range(paragraphPosition1(I know), End ofdocument(?) );
range.Delete();

解决方案

Have a look here: How to: Programmatically Define and Select Ranges in Documents[^]

You're probably looking for something like:

EndOfDocument = doc.Content.End;
//or
EndOfDocument = doc.Paragraphs(doc.Paragraphs.Count).Range.End;


这篇关于如何删除Msword中从特定范围到文本结尾的文本。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆