Checkbox in a Crystal Report

2019-08-28 19:02发布

What is the best way to display a checkbox in a Crystal Report?

Example: My report has a box for "Male" and "Female", and one should be checked.

My current workaround is to draw a small graphical square, and line it up with a formula which goes like this:

if {table.gender} = "M" then "X" else "  "

This is a poor solution, because changing the font misaligns my "X" and the box around it, and it is absurdly tedious to squint at the screen and get a pixel-perfect alignment for every box (there are dozens).

Does anyone have a better solution? I've thought about using the old-style terminal characters, but I'm not sure if they display properly in Crystal.

Edit: I'm using Crystal XI.

7条回答
老娘就宠你
2楼-- · 2019-08-28 19:05

I need to mention here which is font need's to select here "Wingdings"

If {Table.Field} = True Then

'Display the checkbox of your choice here

Formula = Chr(254)

Else

'Display empty checkbox

Formula = Chr(168)

End If
查看更多
Juvenile、少年°
3楼-- · 2019-08-28 19:07

An alternative to images could be to use the Wingdings font; Characters 0xFE (checked) and 0xA8 (unchecked).

查看更多
我命由我不由天
4楼-- · 2019-08-28 19:08
  1. Create a Formula Field and use the following formula

if {Your Field} = true then Chr(254) else Chr(168)

  1. Add the Formula field to the report where you want the checkbox to appear.

  2. Now change the font of the formula field to Wingdings.

查看更多
唯我独甜
5楼-- · 2019-08-28 19:15

I never use a box...I always use a textfield object with a full border, centered alignment and bold. Type an X inside to size it right. Erase the "X". Copy/paste as many as you need.

Then I create all the formulas that return either "X" or " " (the space is important, otherwise border will not display on the text object). Then simply plop the formula fields into the right boxes.

Also, if you want to align these bordered text objects you need to remove the border before aligning. That bug really annoys me!

查看更多
ら.Afraid
6楼-- · 2019-08-28 19:28

Try a pair of images with a conditional formula for visibility

查看更多
Lonely孤独者°
7楼-- · 2019-08-28 19:29
If {Table.Field} = True Then

'Display the checkbox of your choice here

Formula = Chr(254)

Else

'Display empty checkbox

Formula = Chr(168)

End If
查看更多
登录 后发表回答