Jump to content

Help with syntax, copyfitline


Recommended Posts

I am repurposing some code that Eric created for me on this thread.


My intent here is to use the textMeasure code that Eric created to determine if both the employee name and designation fit on one line (just like in the previous instance), but now instead of breaking the line if the two do not fit, I want only the name to be copyfit so that both fit on the line together.


I think I am on the right track with the code below, but I am getting a syntax error on line 23 (highlighted in red) of "copyfit not defined". And I suspect if that line is incorrect, the one above it is too.

var name = Field("Name");

var designation = Field("Designation");

var result = "";


var frameWidth = 1.82; // width of your text frame in inches


var tmName = new FusionProTextMeasure;

tmName.pointSize = "11"; // point size of name

tmName.font = "Helvetica 55 Bold"; // font for name

tmName.useTags = true;


var tmDesig = new FusionProTextMeasure;

tmDesig.pointSize = "5"; // point size for designations

tmDesig.font = "Helvetica 55 Roman"; // font for designations

tmDesig.useTags = true;


if (designation != "") {

tmName.CalculateTextExtent(name + ", ");


if ((tmName.textWidth + tmDesig.textWidth) < frameWidth * 7200) {

result = copyfit("", Field("Name"), "Helvetica 55 Bold", 11, 131, 8, false) + ', ' + Field("Designation");


else result = copyfit("", Field("Name"), "Helvetica 55 Bold", 11, 131, 8, false);


else result = name;


return result;


I'm sure I'm making a silly error here. Can someone show me the error of my ways, please?

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...