Questions tagged [textrange]

Represents a selection of content between two TextPointer positions.

The TextRange class introduces the following terminology.

Selection - A TextRange is a selection of content between two positions indicated by TextPointers. One of these positions a fixed anchor with respect to the selection, while the other position is movable. This is similar to how a selection made by a user using the mouse or keyboard behaves.

Current Selection - Because a TextRange always indicates a selection in content, it makes sense to simply refer to the selection indicated by a TextRange as the current selection.

Text Container - A text container is the element that forms the ultimate border for the flow content at hand; the selection indicated by a TextRange always falls within a text container. Currently, a text container must be either a FlowDocument or a TextBlock. Document - The content collectively contained within a text container is referred to as a document. For more information about other related terms like position, see TextPointer.

92 questions
1
vote
2 answers

Extract text form RichTextBox in Windows store metro app

I am developing Windows Store App. I used a RichTextBox but could not get text from it, I've searched in internet an tried with TextRange, FlowDocument etc. But none of its working. Any idea how to get text form RichTextBox on a submit button…
Rashad
  • 11,057
  • 4
  • 45
  • 73
1
vote
1 answer

Getting an error with TextRange method for unclear reason

Im trying to highlight a TextRange in a richtextbox in wpf, However I keep getting the error below about an invalid argument, even though I am quite confident the argument is infact correct. I understand how to stop the program from crashing but if…
Needham
  • 457
  • 1
  • 6
  • 15
1
vote
0 answers

Saving TextRange to RTF Stream creates wrong Hyperlinks

as we all know, creating RTF from a RichTextBox / FlowDocument is quite easy: [...] someTextRange.Save(stream, DataFormats.Rtf); [...] However, when using special characters in Hyperlink Targets, those characters are replaced by some (xml encoded?)…
Lumo
  • 627
  • 6
  • 21
1
vote
0 answers

Create TextRange between characters?

I'm working on code that turns html tags red and text between balck, but can't get it working. I've been messing with this code but it only works with the first instance of a open and closed tag. If I go to the next line my tags don't turn red and…
user2296112
  • 146
  • 1
  • 10
1
vote
0 answers

Javascript TextRange object findText method

My problem is that I want to search for a given text (eg a company name) in a selected area of a HTML page. So I used Textrange.findText for it (need IE compatibility). But it only finds a match, if the section doesn't contains
element. If the…
1
vote
1 answer

Set Border for selected text in FlowDocument

How can I change background style of selected text or a TextRange in FlowDocument and set Border with corner radius for it? Something like this:
Ali.M
  • 311
  • 6
  • 24
1
vote
1 answer

Get paragraph no where txt is found, and move text to end of paragraph using Word 2010 vba

I am trying to use VBA to move a rich text clause ("strText"), which appears at the beginning of various paragraphs, to the end of each paragraph where the clause appears, and thereafter to underline strText. I am a novice/hobbyist at vba…
Marc B. Hankin
  • 771
  • 3
  • 15
  • 31
1
vote
3 answers

How can I mirror text selection?

Say you have two inputs: and such that through some JavaScript magic, anything you type in input1 will also be put in input2. In this sense input2 "mirrors" input1. Is there a way…
ntownsend
  • 7,462
  • 9
  • 38
  • 35
1
vote
1 answer

Why is TextRange.parentElement returning the parent of the FINAL element in my range?

Here is my HTML:
  • Hi there 1
  • HI 2 2 2 2 2
    • hi 3
  • hi 4 hi there people 4 here now
(you can…
0
votes
1 answer

How to select 2 words in 2 different textareas using createTextRange

I need to select some words in 2 TextArea programmatically. I am using the following javascript to select the words. The problme is that the selection persists only on the 2nd TextArea. I am using IE 6(I know it is old, but project related…
0
votes
1 answer

How to count number of occurances of a text in a Page

var textRange = document.body.createTextRange(); textRange.collapse(true); if( textRange.findText(tex)) { textRange.execCommand("BackColor", false, "yellow"); } The above code is perfect to search for text and highlight it in IE but I want…
user817507
0
votes
1 answer

Implementing a javascript function to search in a div, getting textrange for the search

How do I get the textrange to do a search for a div (or a form)? Are there scripts already available, or jquery functions that search the text of a div? I append a form to a div with this code: $('#'+card_id).append('
0
votes
1 answer

Highlight string search string

I'm using the code below to search the text in a textarea for a string entered in a textinput. I'm trying to highlight the string in the textarea after it's been searched for. I assume the way to do this is selectRange(). I'm not sure how to find…
RapsFan1981
  • 1,177
  • 3
  • 21
  • 61
0
votes
0 answers

Get TextRange of the current word at caret

I am new to WPF and currently I am studying to create a Sublime Text that has syntax highlighting. I come to a challenge in figuring out the TextRange of word at current caret position (Not include symbols e.g: for( will return the whole word…
Hoang Thinh
  • 111
  • 1
  • 12
0
votes
1 answer

if else and while in M language

There are 165 Values here and they are Comma Separated. This step is called CommaSeperated workItemList is a function which takes in the value from CommaSeperated and Brings out the table here I want to split the 165 items in CommaSeparated into…