Reputation: 2403
I have a WPF app that uses a RichTextBox control. When I'm typing, I don't understand the RTF structure it appears to generate.
I'm typing a simple phrase (e.g. about 3 miles), and the result is:
{\rtf1\ansi\ansicpg1252\uc1\htmautsp\deff2{\fonttbl{\f0\fcharset0 Times New Roman;}{\f2\fcharset0 Segoe UI;}}{\colortbl\red0\green0\blue0;\red255\green255\blue255;}\loch\hich\dbch\pard\plain\ltrpar\itap0{\lang1033\fs18\f2\cf0 \cf0\ql{\fs24\f2 {\highlight1\ltrch about 3 }{\highlight1\ltrch miles }{\highlight1\ltrch }{\highlight1\ltrch less }\li0\ri0\sa0\sb0\fi0\ql\par} } }
The point I see here is that the 3 words (about, 3, miles) appear separately (well, 'about' and '3' appear together, but 'miles' does not).
But other times (I'm not sure is it's because I type whitespaces after that or not), the 3 words appear together.
Could you please explain?
Upvotes: 0
Views: 265
Reputation: 66
The control is creating unnecessarily long RTF by repeating the formatting information for different words, even though the words have the same format. Unless you are trying to modify the RTF, you don't have to worry about this, since any legitimate RTF reader will process it just fine. Yes, it's sub-optimal, because repeating the formatting controls is redundant, but it is valid RTF.
Upvotes: 2