如何在水晶报表中有条件地更改字体样式 [英] How to change the font style conditionally in crystal report

查看:304
本文介绍了如何在水晶报表中有条件地更改字体样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在水晶报表中有条件地更改字体样式



我首先要检查字段值是否为数字。如果字段值是数字,则

根据条件更改字体样式





例如:

// student_Proc是程序的名称

如果(isNumeric({student_proc; 1.FieldValue}))那么



if({student_proc; 1.FieldValue}< 40)then

crbold



else

crregular







在此代码中,isnumeric无法正常工作,它总是返回false如果字段值是数字

解决方案

要根据值动态更改字体样式,请在表达式中使用此表达式



 =格式(First(Fields!arn.Value,opdDataSet_qph),BOLD)


更改水晶报告中的字体样式 -

步骤1:右键单击要有条件格式化的字段

步骤2:选择格式对象

步骤3:选择字体选项卡(在水平选项卡中)

步骤4:您可以在每个字体属性附近看到图像按钮。

单击必填项。(例如样式)

步骤5:Formula Workshop将为您打开。框架公式。

步骤6:按Alt + C检查错误。

第7步:保存并关闭。





例如公式:



如果NumericText({student_proc1.FieldValue})则crBold else crRegular;



**您可以从第一帧获得DB字段Formaula Workshop

** NumericText函数(字符串)和字体选项(字体样式包含)来自Formula Workshop的第二帧。

**来自第三帧的控制结构

您的公式应如下所示。

  if (IsNumeric({ Student.Mark}))然后
如果({Student.Mark} > = < span class =code-digit> 40 )然后
crbold // 如果mark是40或40以上使字体变粗 - 通过
其他
crregular / / 如果标记低于40,则使字体成为常规 - 失败
否则
crregular // 如果标记为非数字/空/ NULL使字体定期 - 失败


How to change the font style conditionally in crystal report

i first want to check the field value is numeric or not . if the field value is numeric then
change the font style according to condition


For eg:
//student_Proc is the name of the procedure
If (isNumeric({student_proc;1.FieldValue})) then

if({student_proc;1.FieldValue}<40) then
crbold

else
crregular



In this code the isnumeric is not working properly, it always returns false even if the field value is numeric

解决方案

To change the font style dynamically according to value use this expression in your expression

=Format(First(Fields!arn.Value, "opdDataSet_qph"),"BOLD")


To Change the Font Style Conditionally in Crystal Report-
Step 1 : Right Click the Field which you want to format conditionally
Step 2 : Select Format Object
Step 3 : Select Font Tab (in Horizontal Tabs)
Step 4 : You can see an image button near to each font attribute.
Click the Required one.(eg Style)
Step 5 : Formula Workshop will open for you. Frame the formula .
Step 6 : Press Alt+C to check errors.
Step 7 : Save and Close.


Eg of Formula :

if NumericText ({student_proc1.FieldValue}) then crBold else crRegular;

** You can get DB field from first frame in Formaula Workshop
** NumericText Function (strings) and Font Options (font style contants) from second frame of Formula Workshop .
** Control Structures from third frame


Your formula should be like below.

if (IsNumeric({Student.Mark})) Then 
 if({Student.Mark} >= 40) then 
  crbold //if mark is 40 or more than 40 make the font bold - PASS
 else
  crregular //if mark is below 40 make the font regular - FAIL
else
 crregular //if mark is non-numeric/empty/NULL make the font regular - FAIL


这篇关于如何在水晶报表中有条件地更改字体样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆