Copy link to clipboard
Copied
How to align names?
for example:
I saw that others said there was alignment to the grid, but I didn't realize it.
The method I'm using now is to adjust the word spacing to align. What better method do you have? It's better to demonstrate with examples.
Thank you~
--------------Sample text-----------------
ABCD Piter
AB Lucy
ABCDE Riker
-------------------------------------------
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
It's a good idea.
But here, forms are not suitable
Because the information provided by the customer is non form, there is no need to add form
Copy link to clipboard
Copied
what you mean by forms?
Copy link to clipboard
Copied
I don’t see how you could do this with tabbed text because you are trying to mix justifications within the same paragraph—Full Justification on the left and Left Justification on the right.
If by forms you mean tables, you can convert tabbed text into a table where you can mix justifications. You could create Table and Cell Styles to automate the conversion:
Similar to Scott’s table, but with 2-columns and Cell Styles to handle the different justifications and insets:
Copy link to clipboard
Copied
You can do it with tabs IF you don't use fully justified alignment. If you're doing left, centered, right, or align to decimal, you can use tabs. So if you're ok with having just right aligned not fully justified for the name on the left, tabs will work like my reply below. If you do want to keep with fully justified, then I stand corrected that tabs will not work in this case, as Rob said. Apologies for assuming it would work with fully justified; I forgot that the final option was to align by decimal not fully justified.
Copy link to clipboard
Copied
If you are looking for scripting help, try this below sample snippet:
var myDoc = app.documents[0];
var textFrame = myDoc.pages[0].textFrames[0];
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
app.findChangeGrepOptions.includeFootnotes = false;
app.findChangeGrepOptions.includeHiddenLayers = false;
app.findChangeGrepOptions.includeLockedLayersForFind = true;
app.findChangeGrepOptions.includeLockedStoriesForFind = true;
app.findChangeGrepOptions.includeMasterPages = false;
app.findGrepPreferences.findWhat = "~>~>";
var allEnSpace = textFrame.insertionPoints[0].parent.findGrep();
var maximumHorizontalDistance = null;
for(var i = 0; i < allEnSpace.length; i++){
if(maximumHorizontalDistance == null){
maximumHorizontalDistance = allEnSpace[i].insertionPoints[0].horizontalOffset;
}
else if(maximumHorizontalDistance < allEnSpace[i].insertionPoints[0].horizontalOffset){
maximumHorizontalDistance = allEnSpace[i].insertionPoints[0].horizontalOffset;
}
}
for(var i = 0; i < allEnSpace.length; i++){
var tempPara = allEnSpace[i].paragraphs[0];
while(maximumHorizontalDistance > allEnSpace[i].insertionPoints[0].horizontalOffset){
var characterLength = allEnSpace[i].insertionPoints[0].index - tempPara.characters[0].index;
var leftSpace = maximumHorizontalDistance - allEnSpace[i].insertionPoints[0].horizontalOffset;
var defaultSpace = allEnSpace[i].insertionPoints[0].paragraphs[0].characters[0].insertionPoints[-1].kerningValue;
for(var c = tempPara.characters[0].index; c < allEnSpace[i].insertionPoints[0].index-1; c++){
allEnSpace[i].insertionPoints[0].parent.characters[c].select();
allEnSpace[i].insertionPoints[0].parent.characters[c].insertionPoints[-1].kerningValue = parseInt(defaultSpace+10);
myDoc.recompose();
}
}
}
Sunil
Copy link to clipboard
Copied
The script doesn't seem to work properly.
Sometimes it's the same position, only the first one is marked, and the last one is not written.
There is no "~ > ~ >" between them
It's with '\ t'
For example:
------------------------
ABCD Piter1
Piter1
Piter3
AB Lucy
ABCDE Riker
Copy link to clipboard
Copied
The script doesn't seem to work properly.
Sometimes it's the same position, only the first one is marked, and the last one is not written.
There is no "~ > ~ >" between them
It's with '\ t'
For example:
------------------------
ABCD Piter1
Piter1
Piter3
AB Lucy
ABCDE Riker
Copy link to clipboard
Copied
There are so many mistakes in Adobe forum that I can't edit my post
It can't be edited for five minutes.
I didn't pop up the menu for a long time.
There is no "~ > ~ >" between them
It's with '\ t'
For example:
Copy link to clipboard
Copied
Try this code snippet :
var myDoc = app.documents[0];
var textFrame = myDoc.pages[0].textFrames[0];
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
app.findChangeGrepOptions.includeFootnotes = false;
app.findChangeGrepOptions.includeHiddenLayers = false;
app.findChangeGrepOptions.includeLockedLayersForFind = true;
app.findChangeGrepOptions.includeLockedStoriesForFind = true;
app.findChangeGrepOptions.includeMasterPages = false;
app.findGrepPreferences.findWhat = "\t";
var allEnSpace = textFrame.insertionPoints[0].parent.findGrep();
var maximumHorizontalDistance = null;
var majorTab = null;
for(var i = 0; i < allEnSpace.length; i++){
if(maximumHorizontalDistance == null){
maximumHorizontalDistance = allEnSpace[i].insertionPoints[-1].horizontalOffset;
}
else if(maximumHorizontalDistance < allEnSpace[i].insertionPoints[-1].horizontalOffset){
maximumHorizontalDistance = allEnSpace[i].insertionPoints[-1].horizontalOffset;
majorTab = allEnSpace[i].characters[0];
}
}
for(var i = 0; i < allEnSpace.length; i++){
var tempPara = allEnSpace[i].paragraphs[0];
if(parseFloat(parseFloat(maximumHorizontalDistance).toFixed(1)) > parseFloat(parseFloat(allEnSpace[i].insertionPoints[-1].horizontalOffset).toFixed(1))){
if(majorTab.tabStops.length > 0){
var tempTabStop = null;
if(allEnSpace[i].characters[0].tabStops.length == 0) tempTabStop = allEnSpace[i].characters[0].tabStops.add();
else tempTabStop = allEnSpace[i].characters[0].tabStops[0];
tempTabStop.alignment = majorTab.tabStops[0].alignment;
tempTabStop.position = majorTab.tabStops[0].position;
}
var characterLength = allEnSpace[i].insertionPoints[0].index - tempPara.characters[0].index;
var leftSpace = maximumHorizontalDistance - allEnSpace[i].insertionPoints[0].horizontalOffset;
var defaultSpace = allEnSpace[i].insertionPoints[0].paragraphs[0].characters[0].insertionPoints[-1].kerningValue;
if(tempPara.characters[0].index < allEnSpace[i].insertionPoints[0].index-1){
var mainHorizontalOffset = majorTab.insertionPoints[0].horizontalOffset;
var leftSpace = mainHorizontalOffset-allEnSpace[i].insertionPoints[0].horizontalOffset;
while(mainHorizontalOffset > allEnSpace[i].insertionPoints[0].horizontalOffset){
var defaultSpace = allEnSpace[i].insertionPoints[0].paragraphs[0].characters[0].insertionPoints[-1].kerningValue;
for(var c = tempPara.characters[0].index; c < allEnSpace[i].insertionPoints[0].index-1; c++){
allEnSpace[i].insertionPoints[0].parent.characters[c].insertionPoints[-1].kerningValue = parseInt(defaultSpace+100);
}
}
while(mainHorizontalOffset < allEnSpace[i].insertionPoints[0].horizontalOffset){
var defaultSpace = allEnSpace[i].insertionPoints[0].paragraphs[0].characters[0].insertionPoints[-1].kerningValue;
for(var c = tempPara.characters[0].index; c < allEnSpace[i].insertionPoints[0].index-1; c++){
allEnSpace[i].insertionPoints[0].parent.characters[c].insertionPoints[-1].kerningValue = parseInt(defaultSpace-50);
}
}
while(mainHorizontalOffset > allEnSpace[i].insertionPoints[0].horizontalOffset){
var defaultSpace = allEnSpace[i].insertionPoints[0].paragraphs[0].characters[0].insertionPoints[-1].kerningValue;
for(var c = tempPara.characters[0].index; c < allEnSpace[i].insertionPoints[0].index-1; c++){
allEnSpace[i].insertionPoints[0].parent.characters[c].insertionPoints[-1].kerningValue = parseInt(defaultSpace+10);
}
}
while(mainHorizontalOffset < allEnSpace[i].insertionPoints[0].horizontalOffset){
var defaultSpace = allEnSpace[i].insertionPoints[0].paragraphs[0].characters[0].insertionPoints[-1].kerningValue;
for(var c = tempPara.characters[0].index; c < allEnSpace[i].insertionPoints[0].index-1; c++){
allEnSpace[i].insertionPoints[0].parent.characters[c].insertionPoints[-1].kerningValue = parseInt(defaultSpace-10);
}
}
if(mainHorizontalOffset > allEnSpace[i].insertionPoints[0].horizontalOffset){
var tempTabStop = null;
if(allEnSpace[i].characters[0].tabStops.length == 0) tempTabStop = allEnSpace[i].characters[0].tabStops.add();
else tempTabStop = allEnSpace[i].characters[0].tabStops[0];
var values = [10, 5, 1, 0.1, 0.01, 0.001];
for(var n = 0; n < values.length; n++){
while(maximumHorizontalDistance > allEnSpace[i].insertionPoints[-1].horizontalOffset) tempTabStop.position = tempTabStop.position+values[n];
while(maximumHorizontalDistance < allEnSpace[i].insertionPoints[-1].horizontalOffset) tempTabStop.position = tempTabStop.position-values[n];
}
}
}
else if(tempPara.characters[0].index == allEnSpace[i].characters[0].index){
var tempTabStop = null;
if(tempPara.characters[0].tabStops.length == 0) tempTabStop = tempPara.characters[0].tabStops.add();
else tempTabStop = tempPara.characters[0].tabStops[0];
var values = [10, 5, 1, 0.1, 0.01, 0.001];
for(var n = 0; n < values.length; n++){
while(maximumHorizontalDistance > allEnSpace[i].insertionPoints[-1].horizontalOffset) tempTabStop.position = tempTabStop.position+values[n];
while(maximumHorizontalDistance < allEnSpace[i].insertionPoints[-1].horizontalOffset) tempTabStop.position = tempTabStop.position-values[n];
}
}
}
}
[Edited]
Sunil
Copy link to clipboard
Copied
Hello, Sunil Yadav
The foot you provided doesn't seem to work.
I clicked, but there was no response.
Copy link to clipboard
Copied
Can you share idnesign file or IDML.
Sunil
Copy link to clipboard
Copied
I would recommend using tabs. Create a paragraph style for this text, then in the options for it, go to Tabs. There you can set places for where you want each name to line up. The example I set up for you below shows the first tab as being right aligned (look very closely at the top of the arrow shortly before the 6) and the second one being left aligned (currently hightlighed in blue because it's selected). So you will need to put a tab character in before the first name and between the first name and the second name to get them to line up at the tab stops you created. You can drag and drop these tab stops to modify them, but I find it easier to do once you have your text on the page and can watch it move. If you want to have dots going between them, that's what the Leader box is for. You can just do a "." or you can do " ." (space then period) to have it spaced out more, etc.
Hope this helps!
Copy link to clipboard
Copied
Sorry, if you're new to tabs, you click on the gray arrows above the ruler to pick which alignment you want (see the example above) and then click where you want it on the ruler. You can adjust the alignment of whichever tab you have highlighted in blue by clicking on a different grey arrow. You can adjust the tab position by dragging and dropping it elsewhere on the ruler. And if you no longer want that tab, drag it off the ruler and it will go away.
Copy link to clipboard
Copied
Just 2 para styles and 2 Grep Find/Replace!
(^/) The Jedi
Copy link to clipboard
Copied
Great point on the GREP!
Ok, so I will amend my statement in that tabs will work for left, centered, right, or decimal alignments, but not fully justified for the name on the left. If you decide just right aligned will work for the one on the left, here's an example of how you can do it. Otherwise, you will need a table as mentioned above.
Copy link to clipboard
Copied
"… , you will need a table as mentioned above."
Absolutely not! Did you see something that looks like a "table" in my screenshots? 😉
(^/)
Copy link to clipboard
Copied
Haha! 🙂 Thank you! I meant an earlier reply. I appreciated you chiming in on the GREP find/replace! I love being able to automate it.
Copy link to clipboard
Copied
Hello FRIdNGE~
Sorry, the language is different. It's difficult to understand.
I want to know what your character style is?
The content may be:
AB Piter
Davi
bily
ABC lucy
ABCD majia
ABCDEF gulaly
All to align the longest position ABCDEF
Is there a sample?
Copy link to clipboard
Copied
And what's the picture?
Is it a form?
I don't want to use a form?
I think the best is paragraph style + grep, calling character style
Copy link to clipboard
Copied
The line is two paragraphs with a baseline shift applied to the second paragraph to align it with the first paragraph. You could do it but I think a table is going to be easier to edit:
Set the first paragraph to fully justify with a Right Indent to clear the width of the second paragraph:
Set the 2nd paragraph to Align Left with a Baseline Shift equal to the Leading, and a Left Indent large enough to clear the first paragraph:
Copy link to clipboard
Copied
Rob, thanks for the explanation of the way I show!
… You forgot the "0 pt" leading setting for the second para style! 😉
(^/)
Copy link to clipboard
Copied
It also works if the Leadings and the 2nd paragraph’s Baseline Shift are all the same:
12pt: