?
Solved

Crystal RDC Resize Text Field

Posted on 2011-03-07
3
Medium Priority
?
485 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 101

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 101

Accepted Solution

by:
mlmcc earned 2000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
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…
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…
Suggested Courses

777 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