문제

I'm using c#.net and word 2007 lib's

I want to be able to grab a portion of the Word.Range.Text and change it without affecting the formatting, text or anything else in the Range.

How would I go about getting a portion of the Word.Range.Text so I can change the text or even just delete that portion of the text?

example:

I want this text edited/delete But this portion to be left alone

Solution: Ok, Turns out you need to have a "clone" of the paragraph and then by setting the start and end of the range within the cloned variable you are able to set where in the paragraph you want to edit. As follows:

Word.Range clonedRange = parag.Range;
cloneRange.Start = 0;
cloneRange.End = 15;

cloneRange.Text = "";
도움이 되었습니까?

해결책

Ok, Turns out you need to have a "clone" of the paragraph and then by setting the start and end of the range within the cloned variable you are able to set where in the paragraph you want to edit. As follows:

Word.Range clonedRange = parag.Range;
cloneRange.Start = 0;
cloneRange.End = 15;

cloneRange.Text = "";

Also Thank you to varocarbas :)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top