Jump to content

Business Card Alignment Question


Crineman

Recommended Posts

I have a business card with two text frames side-by-side below the company logo. Attached is a sample for reference.

 

  • The left frame contains 6 fields for the user's name, title, division, etc. Not all of the fields are required and are suppressed if blank.
  • The right frame contains 7 fields w/ address, telephone, fax, etc. Not all of the fields are required and are suppressed if blank.

  • The left frame is right justified and aligns to the top of the frame.
  • The right frame is left justified and aligns to the bottom of the frame.

The question is how do I get the first line of type in the left frame to align with the first line of type in the right frame when the number of lines of type in the right frame can vary? In other words, if the right frame has only 5 lines then the left frame's 1st line of type needs to move down two lines to align properly.

 

Any help with this would be appreciated.

SampleOutput.pdf

Link to comment
Share on other sites

In other words, if the right frame has only 5 lines then the left frame's 1st line of type needs to move down two lines to align properly.

 

 

Any help with this would be appreciated.

 

Are the 2 lines that it needs to move down populated or blank? If they are blank don't suppress them.

 

Do you have data to go along with your sample?

Link to comment
Share on other sites

Thanks for your responses. Attached is a data file.

 

To answer the responses so far:

 

  • The 1st two lines in the left frame would not be blank. They would normally be populated. I would expect the 4th, 5th, or 6th fields to be potentially blank.
  • I don't think centering will work. 4 lines in the left frame wouldn't align with 5 lines in the right frame. But perhaps I'm missing something.

untitled.txt

Link to comment
Share on other sites

Okay, I misunderstood what you were trying to do on my first read. Here's what I came up with:

First you'll need to name your left and right text boxes "Left" and "Right" respectively. You will also need to set the properties of each text box (i.e. bottom alignment, etc.)

 

Then this code will need to be inserted into an OnRecordStart Rule:

// Create an array with the fields you'd like to show up on the right
var rightFieldArray = [Field("Right1"),Field("Right2"),Field("Right3"),Field("Right4"),Field("Right5"),Field("Right6"),Field("Right7")];
// Create an array with the fields you'd like to show up on the left
var leftFieldArray = [Field("Left1"),Field("Left2"),Field("Left3"),Field("Left4"),Field("Left5"),Field("Left6")];

// Create an array to hold the fields that have a value
var rightArray = [];
var leftArray = [];

// Populate RightArray with only fields that hold a value
for (var i=0; i < rightFieldArray.length; i++){
   (rightFieldArray[i] != "" ) ? rightArray.push(rightFieldArray[i]) : "";
   }

// Determine how many lines the left will need to be indented based on 
// how many lines the rightArray has populated
var indent = rightFieldArray.length - rightArray.length;

// Fill the first positions in the leftArray with blanks to adjust for the 
// difference in array length
for (var z=0; z < indent; z++){
   leftArray.push(" ");
   }

// populate the remaining positions in the leftArray with populated fields held
// within leftFieldArray
for (var n=0; n < leftFieldArray.length; n++){
   (leftFieldArray[n] != "" ) ? leftArray.push(leftFieldArray[n]) : "";
   }

// Populate each text frame with their respective array
FindTextFrame("Right").content = rightArray.join("<br>");
FindTextFrame("Left").content = leftArray.join("<br>");

 

I will say, though, this code will not work when there are more fields populated on the left than there are on the right. But then again, I don't think the card is formatted to work when there are more fields populated on the left than the right.

 

Hope this helps!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...