Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Crystal RDC Resize Text Field

Posted on 2011-03-07
3
Medium Priority
?
486 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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

636 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