Jump to content

Multiple text alignments within one text frame


Ryan_B

Recommended Posts

Is there a way to assign multiple text alignments within one text frame?

 

I am looking to have 3 “address blocks” (address, city, state, zip) in one field, however I need the first one to be left aligned, the second one centered, and the third right aligned. Is there a way to do this?

 

Thank you

Link to comment
Share on other sites

Hey dreimer, thanks for your response.

 

It is a field driven thing that dictates which style to use. However if I create formatted text resources, I'll still need to individually set each "address block's" alignment.

Link to comment
Share on other sites

Is there a way to assign multiple text alignments within one text frame?

 

I am looking to have 3 “address blocks” (address, city, state, zip) in one field, however I need the first one to be left aligned, the second one centered, and the third right aligned. Is there a way to do this?

 

Thank you

 

Check out the "Tags Reference Guide." There's some good information about the "paragraph" tag in there (starting on page 41) that I think is what you're looking for. You can set a "quad" attribute that will specify a paragraphs alignment. Here's an example:

var addressBlock = "123 Sample Dr. <br> City, ST 12345";
var result = '';
for (var i=0; i<3; i++)
   result += '<p quad=' + ['L', 'C', 'R'][i] + '>' + addressBlock;

return result;

 

If you want them aligned vertically, create a 3 column text frame and add the "verticalstart" attribute:

var addressBlock = "123 Sample Dr. <br> City, ST 12345";
var result = '';
for (var i=0; i<3; i++)
   result += '<p quad=' + ['L', 'C', 'R'][i] + (i? ' verticalstart=topofcolumn>' : ' br=false>') + addressBlock;

return result;

 

If you have a field that returns which alignment to use (Left, Right, Center) you could something like this:

var addressBlock = "123 Sample Dr. <br> City, ST 12345";
var alignment = "Center";

return '<p br=false quad=' + Left(alignment,1) + '>' + addressBlock;

Link to comment
Share on other sites

I currently do have three separate text frames. The problem is when one of the text frames copyfits, and the other two don't. I wish there was a way to "link" frames together where if one copyfitted, the others would too.

 

I'd try a table, but I need more than one row. I need it to look something like this:

Capture.PNG.4555de1cf6fe0aca4e82035ee233e165.PNG

 

Obviously the data entered will be longer or shorter than what I've entered here, and the lines will need to adjust and keep their alignment based on the entered data. Maybe I can still do this with a table? Create three columns and put a center alignment on each column? Can multiple fields be placed in one cell? I'm a complete noob when it comes to tables.

Link to comment
Share on other sites

I currently do have three separate text frames. The problem is when one of the text frames copyfits, and the other two don't. I wish there was a way to "link" frames together where if one copyfitted, the others would too.

You can link text frames but you'll get the same result by using a three column text frame and the second block of code from my post above.

I'd try a table, but I need more than one row.

I'm unsure of what you're getting at here. Obviously you can have multiple rows in a table but you can also have multiple lines in one cell. So I think you'll be fine with which avenue you chose in that regard.

 

Obviously the data entered will be longer or shorter than what I've entered here, and the lines will need to adjust and keep their alignment based on the entered data. Maybe I can still do this with a table? Create three columns and put a center alignment on each column? Can multiple fields be placed in one cell? I'm a complete noob when it comes to tables.

Yes, you can put multiple fields in a cell. But again, I think a table is overkill for what you are trying to do. After seeing your screenshot, it doesn't look like you want to align each address differently – it looks like you want 3 different addresses centered across 3 columns:

return [
   'Addr1, Suite 1<br>City, ST 11111',
   'Addr2, Suite 2<br>City, ST 222222',
   'Longer Address3<br>Some City, ST 33333'
].join('<p verticalstart=topofcolumn>');

Link to comment
Share on other sites

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.

Guest
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...