cancel
Showing results for 
Search instead for 
Did you mean: 

Vertical Alignment in Fields

Former Member
0 Kudos

Using Crystal Reports 2008 to design a report:

I would like to VERTICALLY align text in a field. (Centred vertically).

I know you can format fields and set horizontal alignment, either by selecting from a drop down or using a conditional format.

Why is there no option to set vertical alignment?? Doesn't anyone ever need to do this? (Searching through dozens of internet forums, it seems yes, but no conclusive answers to this problem have been offered).

What is the alignment constant (mentioned in help section: "Alignment Constants") "crCenteredVertically" for?? How and where is it used?

For that matter, why does the Object Size & Position dialogue box offer to place a condition on the X (horizontal) position but not on the Y (vertical) position. This would have been a good workaround.

ANY SUGGESTIONS? Thanks in advance!

NB: I have do NOT require the field to grow. But I would like the text to move within the boundaries of the field (using a formula to generate a text string which contains between 5 and 7 lines of text)

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I know it has been a while but I think I found a suitable fix.

Add a top border to your text and make it the same color as the background.  It will shift your text down slightly helping it align better to surrounding objects.  Worked for me, and I hope it works for everyone else as well.

1)Right click the particular object

2)Click on "Format Editor"

3)Click on "BorderTab"

4)Add a single top line style.

5)Change the color to match the background of the text.

Former Member
0 Kudos

I'm using Crystal 2011 and as a user of MS Excel I was surprised to find there is no vertical alignment icon  similar to excel or even a tab feature in "Format Text"

I've concluded a Simple workaround to the solution is to add another line of text to the first line of text in the field and reduce or increase the font size of the first line of text. In the example below the first line contains the character x. Finally, change the font colour of "x" to match the background colour.

x

Title of Report

I'm interested to know if SAP have fixed this in the latest build of Crystal. As the above is merely a workaround

Former Member
0 Kudos

This is a really great easy fix. I'm using Crystal 2013 and there is still no change for this. Thank you for the workaround.

Former Member
0 Kudos

Hi Glenn

You can set the alignment as vertical would request you to follow the below steps.

1)Right click the particular object

2)Click on "Format Editor"

3)Click on "Common Tab"

4)Change the "Text Rotation" to 90 degree.

5)Click on OK.

6)In design tab increase the size of that particular object.

I hope this will work.

Regards

Asha Lund

Former Member
0 Kudos

Thank you for replying but that doesn't answer my question I'm afraid.

I don't want to rotate the text. I want the text to remain 0 degrees, but centred vertically inside the cell.

(Imagine the cell is 3 lines high and is displaying 1 line of text - I want the text to occupy line 2).

I have formulas which generate varying amounts of data, and I want the data always to be centred (vertically) inside the cells.

I can't think why this feature would not be available in Crystal Reports?

Can anyone think of a workaround?

Former Member
0 Kudos

Do you mean the text is cutting off if it exceeds the length of the cell instead of printing in the next line?

If so try using can grow option for that object by right clicking on the object formula go to format field>common>check the check box Can Grow

I hope this is what you mean!

Raghavendra

Former Member
0 Kudos

Glen,

Here is the only way to "vertically" align text in CR... that I know of anyway...

1) Place a text box where you want the field to go

2) Drag your field into the text box

3) Double click the text box to make it editable

4) Place the cursor in front of the field name

5) hit the Space bar and then the Enter key.

6) Highlight the space and adjust the font size (of the space only) until the field is centered.

Fun huh?

Jason

fritzfeltus
Product and Topic Expert
Product and Topic Expert
0 Kudos

You say that your formula returns between 5 and 7 lines of text... are these lines separated by carriage return (new line)?

If so, you could conditionally add more new lines at the beginning of your text depending on how many lines of text you have:

numbervar numOfLines := ubound(split({@formula},chr(10)));
if numOfLines = 5 then
    chr(10) + chr(10) + {@formula}
else if numOfLines = 6 then
    chr(10) + {@formula}
else if numOfLines = 7 then
    {@formula}

Cheers,

Fritz

Former Member
0 Kudos

Hi Fritz

Thanks, your answer is the closest to a solution I have seen in any forum so far!

Had thought of that. The only shortcoming is that using this method the text will be (exactly) centred for EITHER even number of lines OR odd number of lines (depending on what height I position the field).

There is another solution I am about to try:

Duplicate my field in three different sizes and position at three different heights (on top of each other). By suppressing each field (except one) conditional on the number of lines should help to display the text EXACTLY where I want it.

I'd still like to know what the allignment constant crCenteredVertically (Center vertically) is for. Anyone who can shed light on this, please let me know!

fritzfeltus
Product and Topic Expert
Product and Topic Expert
0 Kudos

>>The only shortcoming is that using this method the text will be (exactly) centred for EITHER even number of lines OR odd number of lines (depending on what height I position the field).

You could conditionally change the font sizes within your formula field, this could help you fine tune the amount of space you need at the top of your field... you would have to use something like HTML interpretation, as otherwise you wouldn't be able to set several font sizes within one field.

'<font size="5" face="Verdana">&nbsp</font>' +
'<br><font size="2" face="Verdana">This is a paragraph.</font>'

Edited by: Fritz Feltus on Aug 7, 2008 9:37 AM

By the way, I don't think the crCenteredVertically alignment constant has been implemented yet. I'll have a look if I can find any more information on that.

Former Member
0 Kudos

Thanks Fritz!

Former Member
0 Kudos

Has this been implemented? No update since 2008.