Solved

Crystal RDC Resize Text Field

Posted on 2011-03-07
3
477 Views
Last Modified: 2012-05-11
Using VB6 and Crystal 11.5 RDC, is it possible to determine what the width for a text field would need to be to fully display whatever text is in it? The text may vary in content, font, & size from execution to execution of the report. This is desired so that a visible border encompassing just the actual text, can be displayed.
0
Comment
Question by:JVarco
  • 2
3 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 35059347
I don't think it can be done with just Crystal.

However if you can write a DLL that can take the text and determine the size then it may be possible as there is a formula button to the right of width on the SIZE and POSITION popup.

You could call the function you wrote and have it return a size in inches as the result for you formula.  Note it will not move other fields on the report so there needs to be sufficient room for the largest string or a max on the width that you control in the formula

Here is a link on how to create a Crystal User Function Library (UFL)
http://www.sdn.sap.com/irj/boc/go/portal/prtroot/docs/library/uuid/0024f60d-751e-2b10-dea0-b1b8f4a297cf?QuickLink=index&overridelayout=true

mlmcc
0
 

Author Comment

by:JVarco
ID: 35059422
Thanks for the suggestion.

Some additional info I should have shared, I will know what the text is, the font, and the font size before the report is created via RDC. I really just need to know how to programmatically determine the height and length of a text line so that I can adjust the text field size.
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 35059982
I don't know.  It depends on the printer driver

You can get a rough idea of the width since there are 120 pts in an inch.
A 12 pt font is basically 10 characters per inch and 10 point is 12 characters per inch.

With proportional fonts you may need a little more or less and that is where the printer driver impact comes.

There are algorithms and code available.  This may be helpful
http://www.daniweb.com/forums/thread31930.html

mlmcc
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question