Change Font FACE In Table Cell

General TRichView support forum. Please post your questions here
Post Reply
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Change Font FACE In Table Cell

Post by DickBryant »

This relates to the Change Font In Table Cell question - which had a relatively easy solution.

Now I would like to add the option to change the text in each table cell to the same BASE (typeface and any font effects - e.g. Arial, bold) but retain the rest of the 'font effects' relating to each text item in the cell. So if the item in the cell was Times New Roman, Underlined, red and 20 point, the resulting item would be Arial,bold,underlined,red and 20 point.

This would seem to require the creation of new styles as we step through the items. This was my approach to the previous question, but seemed to have problems whenever there was a mix of Unicode and non-unicode fonts and styles.

I know how to step through each item and check its style and how to check the base style. What I don't know is what steps to do to the item I'm processing so that for ARBITRARY styles and text I can achieve the desired result.

Dick
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Do you use RichViewActions?
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Post by DickBryant »

Yes - for many operations.
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You can use TrvActionFontEx.

This code applies 'Arial', bold to the selection:

Code: Select all

rvActionFontEx1.UserInterface := False;
rvActionFontEx1.Font.Name := 'Arial';
rvActionFontEx1.Font.Style := [fsBold];
rvActionFontEx1.ValidProperties := [rvfimFontName, rvfimBold];
rvActionFontEx1.ExecuteTarget(RichViewEdit1);
rvActionFontEx1.UserInterface := True;
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Post by DickBryant »

Perfect! Just the functionality I was looking for!

Thanks Very Much :-)
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Post by DickBryant »

Just a question to make sure I'm not doing something wrong. When I do the conversion on my test file to force its current 26 text styles to be one of three styles by using

FMain.RichViewEdit1.ApplyTextStyle([0,1 or 2]) on the selected columns the result seems fine and the number of styles after doing DeleteUnusedStyles does equal 3 - but the size of the file grows from 929,481 to 1,762,260.

Is this to be expected? I had rather thought the file size would decrease slightly because of the reduction in different text styles.
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

File size may be increased if text is converted from ANSI to Unicode.
If this is not the case, please send me a file sample (before applying) by email.
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Post by DickBryant »

Will send a 'before and after' set of two files via e-mail. Probably you're right about ANSI to Unicode being the cause of the growth, since the styles that 'remain' after the conversion are Unicode styles.
Post Reply