Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

HELP! Automating text formatting and GREP questions

Return to Member Forum

  • Author
    Posts
    • #56930
      hammond
      Member

      Hello all. Got a few tricky text formatting problems that I hope someone would be kind enough to help me with.

      • I have a table with a linked excel file. The first cell of each column contains price information. As I have designed the table, the price looks very large which is intentional (see below). However, I cannot predict how many numbers the price text will contain – 2,3 or 4. For example $25 or $2,500. If the price for example is $25, then it look nicer if the font size is larger so the price doesn't look lonely in the cell. If the price is $2,500 then it must be smaller to fit inside the cell space correctly. Is there a script/rule/style/way that I can automatically change the size of the text depending on the number of numbers given by the linked excel file?

      Price

      • Second question. Some of the data contains “yes” to indicate a product feature. Instead of “yes” I would like to replace this text with a tick image. Can this be done automatically when the excel file is updated? There will be many instances of “yes”. How can I replace text with an image efficiently?

      Any advice / suggestions?

      Thanks!

    • #56933

      Hello,

      For the first question, style grep is the solution. For example, you can create a “normal” character style for 2 digits ; create another style with a smaler size for 3 digits, etc.

    • #56934

      1. Basically, what Laurent said, but in a more expansive way:

      * Apply default formatting to, say, “$” with 3 digits.

      * Adjust font, size, and/or tracking for 2 digits. Then make this a character style named “Wide”.

      * The same, for 4 digits. Make this a character style “Narrow”.

      In the paragraph style for this text, add 2 GREP styles:

      * Apply “Wide” to the text “$ddb”

      * Apply “Narrow” to the text “$ddddb”

      2. Short of replacing the text 'yes' with an image, as explained in the Adobe forum, no easy way.

      You can search for 'yes', case sensitive and 'whole word', and replace it with the character ? — that's that tick mark from Zapf Dingbats. Insert it once in your document, using the Glyphs panel; then copy and paste it into the Replace field. Create a character style with the font Zapf Dingbats, and select that in the Replace With formatting field.

      You could try this, and see if it works for you:

      * Replace each occurrence of 'yes' with 'yes?'. Remember to select both 'case sensitive' and 'whole word' when replacing.)

      * Add two more character styles: 'Checkmark Hide' (set the Horizontal width in Advanced Type to 1%, and the text color to [None]) and 'Checkmark Show' (have it only apply the font Zapf Dingbats).

      * Add two more GREP styles to the paragraph style. Apply “Checkmark Hide” to this:

      yes(?=?)

      so the characters 'yes' followed by a checkmark are hidden.

      * Apply 'Checkmark Show' to this

      (?<=yes)?

      so the correct font is applied to every checkmark which is preceded by the text 'yes'.

    • #56935

      (The easiest way would be if someone can name a font where either character 'y', 'e', 's', 'Y', 'E', or 'S' looks like a check mark … Now that would make it totally automatic and transparent!)

    • #56936
      hammond
      Member

      In the end i used √ character from the source data and then change it within inDesign to Berlins Sans FB bold so it looks like a tick.

      Thanks.

    • #56937

      @Jongware. thanks for the “expansive way”

    • #56979

      You can change text by image:

      1/ Place the image in your document (in the pasteboard for example)

      2/ Manipulate the image so it looks the way you want (size, rotation, fill, stroke…)

      3/ Cut it

      4/ Open the Find/Change dialog box and choose the text tab

      5/ In the search field, type your text, here “yes”

      6/ In the replace field, click on the @ then Other/Pasteboard content (not sure of the wording, I'm working on a french version). So you must see “^c” (sure for that)

      7/ Click Replace All

      8/ Done

      Don't forget you may not see the images if the height of the rows are too small!

      As it is NOT a grep style, this is not automatic :(

      But as you can save this request, you can reapply it as many times as your client will update the excel file.

      Hope it will help you

Viewing 6 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads