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
2
votes
3 answers

createTextRange - strange behavior in IE8

I have the following problem. In text input filed which work as an auto-completer some of suggestions it returns are wither than it. The problem comes when you leave the field. In IE the text cursor is positioned on the end of the suggested string,…
2
votes
3 answers

put span on selected text

how to make selected text stay surrounded by a span without breaking any Tag-element (javascript) one exaple: original text:

a foo

another bar

selected: a foo another bar I do not want break the html nesting structure:

a…

Martin
  • 1,282
  • 1
  • 15
  • 43
2
votes
1 answer

TextRange constructor performance in RichTextBox

I am currently working on syntax highlighting and code completion project, and making user control based on RichTextBox. I've had some problems adapting to the way RTB works and everything, but I have managed to make simple syntax…
Dejan Maksimovic
  • 507
  • 1
  • 5
  • 23
1
vote
1 answer

Highlighting strings in different colors in a textarea

I am working on making a textarea editable by multiple people - using mobwrite. mobwrite uses diff-match-patch in its working. It does the job well of synchronizing the textarea between various people. Now, what I wanted was to highlight the patches…
Prasanth
  • 5,230
  • 2
  • 29
  • 61
1
vote
1 answer

VBA, setting a range in a Word document to edit a specific section of text

I am working with VBA in an xlsx document, and I am attempting to alter a separate rtf document to replace the words in a specific range between two tags on the document. I have managed to replace all the instances of any word across the entire…
BJennin4
  • 11
  • 4
1
vote
0 answers

Changing parts of the text font and color in PowerPoint Add-In in C#

I have the following original string: "This is the original sentence in Text Box". I make changes to the this text replacing "original sentence" by "new text" and adding the word "shape after the "Text Box". Now I have to markup and display all as…
Leon
  • 165
  • 12
1
vote
1 answer

TextRange Find string c#

Im looking for a function that will enable me to find a certain string in a textRange and gives me back its textPointers(beginning and end) whats the best approach or is there any textRange method that can help me ? Thanks. I have a problem in my…
raym0nd
  • 3,172
  • 7
  • 36
  • 73
1
vote
1 answer

How do i use TextRange in Silverlight?

I am using the following code i found online, http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/750a654e-b002-4742-8f46-609e93f6ec81 where i can save RichTextBox content to SQL DB but i am unable to use TextRange in my Sliverlight file how…
user677607
1
vote
2 answers

Powerpoint VBA foreach skipping some valid shapes

I do presentations with background wipes that are flowchart process shapes with the text "wipey" for yellow wipes and "wipeb" for blue wipes. When working out the animations for training slides, I place the wipes in front with 0.75 transparency.…
Cliff Cummings
  • 929
  • 1
  • 7
  • 9
1
vote
1 answer

Move cursor to placeholder element in a contentEditable DIV

I have a contentEditable DIV and, when the user presses a key, the underlying code is processed and replaced by updated code. Alas, this causes the cursor position to be lost. However, in order to preserve the cursor position, I am successfully…
claviska
  • 12,410
  • 2
  • 27
  • 50
1
vote
1 answer

WPF: get TextRange from ListItem content

I am trying to get a TextRange from a WPF FlowDocument ListItem: var doc = new FlowDocument(); doc.Blocks.Add(new List(new ListItem(new Paragraph(new Run("first bullet"))))); If I now try to get a TextRange with var range1 = new…
plainionist
  • 2,950
  • 1
  • 15
  • 27
1
vote
2 answers

Internet Explorer equivalent range.startOffset

How can I get functionality equivalent to that of range.startOffset in Internet Explorer 8 and below? I.e., I'd like a function I can call on a range that will tell me how many characters into its container the range starts.
Tom Lehman
  • 85,973
  • 71
  • 200
  • 272
1
vote
0 answers

TextRange constructor expands the desired range

Today is the day before tomorrow. Today is the day before tomorrow. Today is the day before tomorrow. Today is the day before tomorrow. Today is the day before tomorrow.…
Pollitzer
  • 1,580
  • 3
  • 18
  • 28
1
vote
1 answer

Convert TEXTRANGE structure's lpstrtext member to MultiByteCharacterSet

I have two different projects in C++, one compiles to a static library and uses Unicode character encoding as it has to support multiple languages (Spell Checker), the other is a legacy MFC project that uses a MultiByteCharacterSet encoding. The…
Ashahmali
  • 113
  • 7
1
vote
2 answers

How to return the exact range of a specific word in RichTextBox

Trying to select and color a specific word in WPF Richtextbox but my method selects just first 5 letters of the word. Indexes 0,1 and 2 seems to be empty string although the first word in my rtb is "private" and there is no empty string before…
ilcognito
  • 37
  • 7