Solved

Crystal RDC Resize Text Field

Posted on 2011-03-07
3
472 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows 10 start screen issues 9 51
to transfer string from C lanaguage to VBA 4 56
Error when passing an argument to a vb6 that contains  '/' 7 31
Crystal Reports 13 5 44
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

914 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now