Jump to content

Business card - too many characters


NPN

Recommended Posts

Hi,

 

We have made a business card VDP for a customer, unfortunately some of the departments in the company have quite long names and doesn't fit into the designated field.

 

I know you can use a rule to change the size of the font to accomodate this, but in some cases that would make the text way to small. So that's not an option this time.

 

The only solution I see that would fit is too break the name into two lines, however, every department name end in a two letter word, and I don't want fusion pro to move only that part down. So I guess my question is, are there different, more 'intelligent' ways of breaking up a text field using rules?

 

Btw, I use Fusion Pro desktop and publish the VDP's to a website that has a compatible Web2print solution.

Link to comment
Share on other sites

The only solution I see that would fit is too break the name into two lines, however, every department name end in a two letter word, and I don't want fusion pro to move only that part down. So I guess my question is, are there different, more 'intelligent' ways of breaking up a text field using rules?

Yes, you can use this code (taken from this post) in a rule to prevent the last word from being on a line by itself:

return TaggedTextFromRaw(Field("YOUR FIELD  NAME")).replace(/(.*)(\s)(.+)$/, "$1 $3"); 

You'll need to check the "Treat returned strings as tagged text" box.

Link to comment
Share on other sites

  • 2 weeks later...

I can't seem to make it work. It probably needs some adjustment as the field in question collects the name itself from a server.

 

Here is the code for the field in question as it is now

 

name = CreateResource("x:\\resources\\company\\department\\"+ Field("department") + ".txt", "tagged text file", true);

 

return name;

 

How do I incorporate your rule into this?

Link to comment
Share on other sites

I can't seem to make it work. It probably needs some adjustment as the field in question collects the name itself from a server.

 

Here is the code for the field in question as it is now

 

name = CreateResource("x:\\resources\\company\\department\\"+ Field("department") + ".txt", "tagged text file", true);

 

return name;

 

How do I incorporate your rule into this?

var name = CreateResource("x:\\resources\\company\\department\\" + Field("department") + ".txt", "tagged text file", true);
return name.content.replace(/(.*)(\s)(.+)$/, "$1 $3");

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...