Click here to Skip to main content
15,890,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.

C#
Word.Range range = currentDocument.Range(paragraphPosition1(I know), End ofdocument(?) );
range.Delete();
Posted
Updated 2-Jun-15 3:00am
v3

1 solution

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

You're probably looking for something like:
C#
EndOfDocument = doc.Content.End;
//or
EndOfDocument = doc.Paragraphs(doc.Paragraphs.Count).Range.End;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900