I'm using a single TRVStyle for almost all of my instances of TRichViewEdit. However, I have one TRichViewEdit where I want to set all font sizes to a single size, independent of what they are in the document originally loaded into the rve WITHOUT changing these styles in the original TRVStyle.
My approach is to use a second TRVStyle and set it's contents to the main TRVStyle and then change the size of all its styles. I can't figure out how to make the contents of the second TRVStyle equal those of the first. Seems like it should be simple, but I can't find a way to do it.
"Assign" contents of one TRVStyle to another.
-
- Posts: 148
- Joined: Wed Dec 07, 2005 2:02 pm
- Contact:
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
If you need to assign styles, it's simple:
Code: Select all
RVStyle2.TextStyles := RVStyle1.TextStyles;
RVStyle2.ParaStyles := RVStyle1.ParaStyles;
RVStyle2.ListStyles := RVStyle1.ListStyles;
-
- Posts: 148
- Joined: Wed Dec 07, 2005 2:02 pm
- Contact:
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
"RVStyle2 := RVStyle1" simply assigns both RVStyle1 and RVStyle2 variables to the same TRVStyle object. Objects themselves remain unchanged.
As for my code
it actually produces the same actions as this code:
If you need to copy not only collections of styles, but also all other properties, use this code:
As for my code
Code: Select all
RVStyle2.TextStyles := RVStyle1.TextStyles;
RVStyle2.ParaStyles := RVStyle1.ParaStyles;
RVStyle2.ListStyles := RVStyle1.ListStyles;
Code: Select all
RVStyle2.TextStyles.Assign(RVStyle1.TextStyles);
RVStyle2.ParaStyles.Assign(RVStyle1.ParaStyles);
RVStyle2.ListStyles.Assign(RVStyle1.ListStyles);
Code: Select all
Stream := TMemoryStream.Create;
Stream.WriteComponent(RVStyle1);
Stream.Position := 0;
Stream.ReadComponent(RVStyle2);
Stream.Free;