Reply To: Remove character at the end of a line of wrapped text

Home Page / Forums / General InDesign Topics (CLOSED) / Remove character at the end of a line of wrapped text / Reply To: Remove character at the end of a line of wrapped text

#85189
Peter Kahrel
Participant

Question #1: Add a discretionary line break after every comma. That’ll keep the digits together.

Question #2: Not automatically. A Grep style won’t work because you can’t find the end of turn lines (except when you add forced line breaks, which you probably don’t want). But a script can do that.

Create a character style Hide (set just the colour to Paper), then click somewhere in the table and run the script.

(function () {
  var i, lines, cells;
  cells = app.selection[0].parent.parent.cells.everyItem().getElements();
  for (i = 0; i < cells.length; i++) {
    cells[i].texts[0].appliedCharacterStyle = app.documents[0].characterStyles[0];
    cells[i].texts[0].clearOverrides (OverrideType.CHARACTER_ONLY);
    lines = cells[i].lines;
    for (j = 0; j < lines.length; j++) {
      if (lines[j].characters[-1].contents == SpecialCharacters.DISCRETIONARY_LINE_BREAK) {
        lines[j].characters[-2].appliedCharacterStyle = 'Hide';
      }
    }
  }
}());

Peter

This article was last modified on May 25, 2016

Comments (0)

Loading comments...