Sunday, March 11, 2012

Add spaces to a string value in a cell

Hi,

I am trying to add spaces to a string value in a cell but when I run the report the value is trimmed.
Any ideas?
Here is the expression I am using:
=Fields!strVal.Value & " "

Thanks,
Igor

Igor,

Try using a calculated field on your dataset, In the expression, use =" number of spaces wanted" save field name like Space5. You can then use this field in your expressions.

Ham

|||I tried and it still comes out trimmed.|||

Igor,

Can you wrap a LEN around your expression? I used this to verify that the spaces where actually there. If the spaces are there then you made have some other issue.

Ham

|||the Len function returns the correct number of characters (including the empty spaces) but the spaces just don't show up.|||

Igor,

What type of formatting are you trying to accomplish? Are you trying to align text, columns?

Ham

|||I am trying to move some of the values a little to the left but still keeping them right-justified.|||
Igor,
You can try a couple of different things (what you have should work, but if not I can only suggest these)....

=Cstr(Fields!strVal.Value) & Space(5)
or
=Cstr(Fields!strVal.Value) + Space(5)

In Data you could try Cast or Convert on the field to force it to a certain number of characters as well.|||

Igor,

Why not use your "Left-Alignment" properties on your textbox?

Ham

|||

Hello Igor,

Can you try something like this in your field's expression:

=Fields!FIELD1.Value & StrDup(5, " ")

Hope this helps.

Jarret

No comments:

Post a Comment