Solved

Crystal RDC Resize Text Field

Posted on 2011-03-07
3
470 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

772 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

11 Experts available now in Live!

Get 1:1 Help Now