Ryan_B Posted March 21, 2016 Share Posted March 21, 2016 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 Quote Link to comment Share on other sites More sharing options...
dreimer Posted March 21, 2016 Share Posted March 21, 2016 What dictates which style to use? If it is a field driven thing, I would create three text resources for your different alignments and then use switch rules to pull in the resource needed for each instance in your data. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted March 21, 2016 Share Posted March 21, 2016 I would just create three separate text frames. The other alternative is to create a table with three columns (cells) and one row. Quote Link to comment Share on other sites More sharing options...
Ryan_B Posted March 21, 2016 Author Share Posted March 21, 2016 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. Quote Link to comment Share on other sites More sharing options...
step Posted March 21, 2016 Share Posted March 21, 2016 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; Quote Link to comment Share on other sites More sharing options...
Ryan_B Posted March 21, 2016 Author Share Posted March 21, 2016 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: 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. Quote Link to comment Share on other sites More sharing options...
Ryan_B Posted March 21, 2016 Author Share Posted March 21, 2016 Thank you Step. I'll look into these suggestions. Quote Link to comment Share on other sites More sharing options...
step Posted March 22, 2016 Share Posted March 22, 2016 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>'); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.