Hi,
I simply want to change the font of all the text without selecting anything from a ComboBox, is this possible?
I have only 4 Styles that ever need changing as this is an ASCII Art Viewer.
I have tried using: rve.ApplyTextStyle(0); but this has no effect.
Could someone please tell me how I can do this without selecting any text so that all the documents text is changed like in Notepad?
An example would be very much appreciated.
Many thanks
jnap
Change all text without selecting?
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
ApplyTextStyle applies text to the selected text.
If you want an editing operation (undoable), this is the only way, to select and apply:
If not, you have the following options (working both in TRichViewEdit and in TRichView):
1) You can change properties of styles without modifying document.
For example, to make all text red:
2) Change all text styles. Assuming that all styles in document have the same value of Unicode property, and there are no tables in the document, the code is:
The code above changes only text items in the root document (not in table cells), it does not change font in tabulators and label items.
If you want an editing operation (undoable), this is the only way, to select and apply:
Code: Select all
RichViewEdit1.SelectAll;
RichViewEdit1.ApplyTextStyle(0);
1) You can change properties of styles without modifying document.
For example, to make all text red:
Code: Select all
for i := 0 to RVStyle1.TextStyles.Count-1 do
RVStyle1.TextStyles[i].Color := clRed;
RichViewEdit1.Format;
Code: Select all
for i := 0 RichViewEdit1.ItemCount-1 do
if RichViewEdit1.GetItemStyle(i)>0 then
RichViewEdit1.GetItem(i).StyleNo := 0;
RichViewEdit1.Format;