An example of text selection "from" and "to" lines is seen, but "from" and "to the end" is required
W.ActiveDocument.Range(Start := 10, End := 40).Select; If "to the end" = "to the very end":
Procedure SelectFromPositionToEnd(startPosition: integer); begin W.Selection.Start := startPosition; W.Selection.End := W.ActiveDocument.Characters.Count; // последний символ в документе end; If "to the end" = "to the end of the sentence":
Procedure SelectFromPositionToEdnOfSentence(startPosition: integer); const WdSentence = 3; //значение для перехода к следующему предложению begin w.Selection.Start := startPosition; //поставили сюда курсор w.Selection.Move(WdSentence, 1); //передвинули до следующего предложения w.Selection.Start := startPosition; //растянули выделение до начального символа end; If "to the end" = "to the end of the line", then the same as in the second case, just replace the first parameter in Move with
WdSentence on
Wdline = 5 //значение для перехода к следующей линии (строке) Selection.EndKey Unit:=wdStory, Extend:=wdExtend Source: https://ru.stackoverflow.com/questions/602753/
All Articles