示例#1
0
        private ITextRangeProvider GetTextRange(int start, int end)
        {
            ITextRangeProvider textRange = textProvider.DocumentRange;

            if (start >= 0 && end > 0)
            {
                textRange.MoveEndpointByUnit(TextPatternRangeEndpoint.Start,
                                             TextUnit.Character, start);
                textRange.MoveEndpointByRange(TextPatternRangeEndpoint.End,
                                              textRange, TextPatternRangeEndpoint.Start);
                textRange.MoveEndpointByUnit(TextPatternRangeEndpoint.End,
                                             TextUnit.Character, end - start);
            }
            return(textRange);
        }
        public void MoveEndpointByRange(TextPatternRangeEndpoint endpoint, string targetRangePath, TextPatternRangeEndpoint targetEndpoint)
        {
            ITextRangeProvider target = parent.GetTextRangeFromPath(targetRangePath).Provider;

            provider.MoveEndpointByRange(endpoint, target, targetEndpoint);
        }