<RichTextBox Name="rtb" Margin="20">
<FlowDocument>
<Paragraph>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. Today is the day before tomorrow. Today is the day before tomorrow.</Paragraph>
<Table CellSpacing="10"
Padding="0"
Background="Yellow"
FontFamily="Arial"
FontSize="12">
<Table.Columns>
<TableColumn Width="70" />
<TableColumn Width="120" />
<TableColumn Width="200" />
</Table.Columns>
<TableRowGroup Background="Gold">
<TableRow>
<TableCell ColumnSpan="3">
<Paragraph Foreground="Gold" Background="Black" TextAlignment="Center" FontSize="16">Table Header</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell BorderThickness="1" BorderBrush="Black">
<Paragraph>Cell 0,0</Paragraph>
</TableCell>
<TableCell BorderThickness="1" BorderBrush="Black">
<Paragraph>Cell 0,1</Paragraph>
</TableCell>
<TableCell BorderThickness="1" BorderBrush="Black">
<Paragraph>Cell 0,2</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell BorderThickness="1" BorderBrush="Black">
<Paragraph>Cell 1,0</Paragraph>
</TableCell>
<TableCell BorderThickness="1" BorderBrush="Black">
<Paragraph>Cell 1,1</Paragraph>
</TableCell>
<TableCell BorderThickness="1" BorderBrush="Black">
<Paragraph>Cell 1,2</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
<Paragraph>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. Today is the day before tomorrow. Today is the day before tomorrow.</Paragraph>
</FlowDocument>
</RichTextBox>
For FindAgain I need the TextRange
from selection end till the end of the document:
string rangeText = new TextRange(rtb.Selection.End, rtb.Document.ContentEnd).Text;
I expected rangeText to start with " 1,1", but it starts with "Cell 1,0". Seems weird to me, however, how can I get the desired range?