If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Wrap text on number of characters in report studio

Started by Samrat, 12 Aug 2015 05:56:20 AM

Previous topic - Next topic

Samrat

Dear friends,

In report studio,I have a requirement to wrap a string to next line after 25 characters for example I have a text ab10,bc20,cd30,ef40,gh50,ij60,kl70 in report it should show as
                                      ab10,bc20,cd30,ef40,gh50,
                                      ij60,kl70

Note: comma(,) will also needs to be considered as a character.

I tried giving wrap text option and setting width of column in pixels,this solutions works for few strings and few strings displayed  more than 25 characters in single line.



Thanks,
Samrat




                                       

MFGF

Quote from: Samrat on 12 Aug 2015 05:56:20 AM
Dear friends,

In report studio,I have a requirement to wrap a string to next line after 25 characters for example I have a text ab10,bc20,cd30,ef40,gh50,ij60,kl70 in report it should show as
                                      ab10,bc20,cd30,ef40,gh50,
                                      ij60,kl70

Note: comma(,) will also needs to be considered as a character.

I tried giving wrap text option and setting width of column in pixels,this solutions works for few strings and few strings displayed  more than 25 characters in single line.



Thanks,
Samrat




                                     

Hi,

I think you have the correct approach here - you just need to use a font that has the same width for each character (monospace font) eg Courier.

Cheers!

MF.
Meep!

bdbits

You could also try using 'em' instead of 'px' for width, if you don't want a monospaced font. But it still might not be exactly 25 characters, unless you go monospaced.

Samrat

Hi MF,

Sorry for late reply.

Thanks for your reply.
Your idea is really good and it works fine.

Our Business user was more specific about font,hence we came up with below idea

Insert a table(instead of line item) in the list with 1 column and 4 rows,in the first row of the table use substring(line item,1,25)
in the seocnd row use substring(line item,26,25) in the third row use substring(  line item,51,25) and so on.. depending on the no of line the text can grow.In our my scenario user asked us to restrict text for 4 line,hence I have taken to display 100 characters i.e 25 characters per line.

Thought of sharing the solution if it helps some one.

Cheers,
Samrat

bdbits

Only thing I don't like about it is that you'll break strings right in the middle. But finding an expression to handle proper breaks (e.g. consider comma placement) would be non-trivial to say the least. More importantly, it sounds like your users are happy enough. Which in the end is the important thing.

Thanks for sharing your solution. Too many people never do that.