Jump to content

copyfitting within a formatted text resource


CSemrau

Recommended Posts

I was needing to know if there is any way to copyfit individual paragraphs within formatted text resources. These paragraphs are different copy from text resource to text resource and none of it is contained within a variable data field. I have multiple formatted text resources which contain paragraphs which include multiple variable fields within them. These variable fields may contain anywhere from 4 characters to 165 max characters. There is a paragraph in the middle that needs to copyfit independently from a paragraph below it (which also needs to copyfit separately) separated by a horizontal line. There are two lines at the beginning of the formatted text resources that must maintain their size and placement, therefore copyfitting the entire text box is not an option.

See PDF files for examples.

Example1.pdf

Example2.pdf

Example3.pdf

Link to comment
Share on other sites

Could the text between the rules be broken out into it's own text resource(s)? You could then set up a unique copyediting rule for the center frame versus the top and bottom frames (which don't appear to change between versions).
Link to comment
Share on other sites

I only included 3 different examples of the text resources that we need to format. The issue is there are over 2000 total different text resources, in which the horizontal lines are placed differently among them. Some may be similar, but there are many different ones as well. If I were to create a different resource for each section, there will be 3 times more text resources that will need to be created. This is why I was requesting your help to see if there were a more efficient solution.
Link to comment
Share on other sites

Here is a working portion, with examples setup, of the FusionPro template we are working from. Also included is a sample data file. There are 5 formatted text resources setup which include examples of different placements of horizontal lines, rules etc. (Some using static graphics for the horizontal lines, some using the floating horizontal line graphics called up from a rule placed within the formatted text itself.) We have tried several ways of setting this up - hoping you could give some advice - as I said - to make this the most efficient setup.

Trial.zip

Link to comment
Share on other sites

OK, so briefly digging through the sample files, it appears as though each formatted text resource has several <p> tags. If it is true that -- say -- the first two <p> tags of every resource were for the text above the first horizontal rule and the last <p> tag was the only paragraph to appear below the 2nd horizontal rule, then you could create a JS rule which would pull the correct resource for the current record, yank out all the copy (tags included) from that resource, replace any variable callouts with the correct data, and return that chunk of information in a rule which could be placed into a separate box on your template page with copyfitting applied.

 

The original resource (including the tagged copy above and below horizontal rules) could either be placed "as is" beneath the frame with the custom copyfitting and knocked out by the rule's frame (using a fill if the background template is just white), or you could create additional rules to extract the necessary parts of the resource for the top portion and bottom portion of text.

 

You would not need to create triple the number of resources, nor would you need to edit the resources you already have. However, you would need something constant in the resource to determine where the actual break was between top, center, and bottom "text blocks." If my original example (top = 2 <p>; bottom = 1 <p>) is not consistent, then some other consistent element would need to be present throughout all 2,000 resources.

 

Perhaps a little confusing for an explanation, but the only way I can think of to copyfit a portion of your resource with minimal extra work on your part.

Link to comment
Share on other sites

Here's a sample rule (heavily commented) showing what I'm thinking:

// taken (and modified) from your FOffer RULE
if (Field("FOfferId")!="Var") {
   return "";
   }
else if (Field("FOffer") != "") {
   var origRes = Resource(Field("FOffer")).content;

   // convert resource into array with separate element for each <p>
   var centerBlock = origRes.split("<p");

   // assuming first two <p> are reserved for top text block, remove them,
   // and assuming last <p> is reserved for bottom text block, remove it
   centerBlock = centerBlock.slice(3,centerBlock.length-1);

   // join resulting array into one long text file again, adding "<p" between
   // elements to reaplce the ones originally removed when creating the array
   centerBlock = centerBlock.join("<p");

   // add "<p" to front of result
   centerBlock = "<p" + centerBlock;

   // at this point, you would replace all variable placeholders with actual
   // data from your input file

   // this is the point at which you could apply copyfitting rules manually,
   // or you could place the results of this rule in it's own text frame and
   // apply copyfitting via the variable dialog box

   return centerBlock;
   }
else ReportWarning ("THE FOffer IS MISSING IN THE DATA, PLEASE STOP AND NOTIFY THE DATA DEPARTMENT" );

HTH. :D

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...