on 02-19-2010 1:50 AM
Hi
I need at runtime to change the font of text objects and/or Field objects. Any one can help me?
Moved to Legacy SDK support forum
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
Thanks for all your help.
I have got a solution here:
var MyFont: TFont;
crField : IFieldObject;
sec : TCRSection;
j : integer;
begin
sec := (Sender as TCRSection);
for j := 1 to sec.ReportObjects.Count do
begin
Sec.ReportObjects.Item[j].QueryInterface(IID_IFieldObject,crField);
if crField <> nil then
begin
MyFont.Size := StrToInt(Edit3.Text);
MyFont.Name :=Edit2.Text;
GetOleFont(MyFont, OleFont);
crField.Font := OleFont;
end;
end;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I know parameter is a way. But I did not try it. I will try to see if I could runtime create parameters and text boxes and associate the text boxes to the parameters.
But I think the best way is still assign the font from the codes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Thanks for the answaer. I did not ask my question clearly. The way you suggested is the way I am using now. What I really want is that I need control the font from my application codes through crystal report activeX. I am using delphi, I want to control this from my delphi code. I runtime create the text object, I can assign the text color, ie. textcontrol.textcolor := clRed; I want something like, Textcontrol.font.name := 'Arial'; but I can't. Because the font is type of IFontDispatch. I don't how to do it or maybe theere is no way to achieve it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Right click on the particular field --> Select Format Field --> Navigate to Font Menu --> Click on the formula button displayed as *x+2" next to Font --> Opens Formula Editor. Write the condition here
if ({db.value} = 'abc') then // If db value matches abc then change the font to Times New Roman else Arial
'Times New Roman'
else
'Arial'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.