Print Page | Close Window

Filling the blank spaces with dots

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=10364
Printed Date: 29 Apr 2024 at 7:00pm


Topic: Filling the blank spaces with dots
Posted By: Mellison
Subject: Filling the blank spaces with dots
Date Posted: 27 Jun 2010 at 8:28pm
Hi,
    i have a text object in my report which is used to display the String that is retrieved from the DB.Now my problem is that at the end of the String i will have to fill it with dots for the last line alone.For example
    
Patient alcohol history...................

                             "Patient alcohol History" is the string that i got from the DB.The string can be more than one line also in that case i will have to fill the last line empty spaces with dots.How can i do that



Replies:
Posted By: Emir_W
Date Posted: 27 Jun 2010 at 8:58pm
you can add the dots after the field.
{tbl.patientstatusfield}+"......"
 
 
or you can try this:
(assume length of patient_status field is 30 characters)
1. create a variable that contains 30 dots, same as length of patient_status
xdots="....." 
 
2. create a variable for patient status
pxstatus={tbl.patientstatus}+left(xdots,len(xdots)-len({tbl.patientstatus})
--> this will print the dots flexible based on length of patient_status.
 
and put 'pxstatus' variable on the report.
1. right click this variable
2. choose 'Format field'
3. click on 'Common' tab
4. check on 'Can Grow' and put the max line as you need.
 
 
 
hope it help.
 
 


-------------
Emir W


Posted By: Mellison
Date Posted: 27 Jun 2010 at 11:19pm

Thanks for the Reply Emir,

                        I have tried the second idea earlier but that wouldn’t work since the space consumed by alphabets are not same in the report for example space consumed by alphabet “i” is much lesser than the space consumed “w”. so literally calculating the no of dots might give a result like this

 

 

Patient alcoholic History………

……….

 

Patient condition 24 hours

After surgery……………………….

……………

 

                                    But where as the dot should end on the last line itself like this

 

Patient alcoholic History………

 

Patient condition 24 hours

After surgery……………………….

 

                                    First suggestion also has the same issue.Is there any other solution for this problem.

 


Posted By: Emir_W
Date Posted: 28 Jun 2010 at 12:21am

absolutely, when you print the field it will give you different width for each character except if you using Courier font.

using my first option it will print some dots (as you type in the formula) at the end of line.
but if you using the 2nd option then the dots will print only to replace the rest of the line replacing the spaces.

my point on second option is if the len for patient status is less then 30 characters, let say only 23 characters, then the rest 7 characters will printed as dot.
let say the field for patient status is 100 characters.
then, variable xdots will contains 100 dots.
and data for patient status contains only 40 characters (regardless 'i', 'w', etc.)
then when you print variable pxstatus it will print the patient status it self and followed with 60 dots.

or.. can you put your formula here so we can see if there's something need to change?
 

thx.
 


-------------
Emir W


Posted By: Ygnacio
Date Posted: 30 Jul 2010 at 9:37am
Hi,

I have the same problem: I need to print some contracts directly to PDF in crystal.

The report has a big paragraph (it may fill several pages) in a textbox with fixed text, database fields, formulas, some words are in bold, etc.

In the last line of the paragraph, it must be filled to the end with hyphens while there are spaces in the line, for example:

   XXXXXXXXXX
   XXXXXXXXXX
   XX-------------



I can not use a fixed font like Courier, the report must be printed with Arial size 11 font, all the text must be full justify and the size of the paper is Folio (8.5 x 13")

Any solution?

I'm using Crystal Report Ver 10.0.0.533


Thanks
 



Print Page | Close Window