Jump to content

linebreak with long email adresses


Recommended Posts

This is for a business card VDP that will be published using Digital Store Front.


I have a large international client that has decided if their employees email addresses is too long for the designated line on a business card, a linebreak should be inserted after the '@'.


Example, short address:




Example, long address:





This is what they want.


Is there a way to implement this using Javascript, say if the characters exceed a value of 30?


I'm using Fusion Pro Desktop (I have several versions).

Publishing on Digital Store Front

Link to comment
Share on other sites

This looks like another job for Text Measurement:

function WrapEmailAtAtSymbol(text, font, pointSize, width) // width and pointSize in hundredths of points
   var TM = new FusionProTextMeasure;
   TM.useTags = false;
   TM.maxWidth = width;
   TM.font = font;
   TM.pointSize = pointSize;

   if (TM.textLines <= 1)
     return TaggedTextFromRaw(text);

   return TaggedTextFromRaw(text).replace(/(.*)(\@)(.+)$/, "$1@<br>$3");

return WrapEmailAtAtSymbol(Field("email"), "Arial", 1800, FindTextFrame("title").GetSettableTextWidth());

Make sure to check "Treat returned strings as tagged text."


If you're not using FusionPro 6.0 or newer, you'll have to hard-code the frame width in the last paramater instead of calling FindTextFrame and GetSettableTextWidth.

Link to comment
Share on other sites

  • 3 months later...


This topic is now archived and is closed to further replies.

  • Create New...