is now part of CreativePro.com!

Free Scripts Help Fix Word Formatting

7

At the InDesign Conference in Washington, D.C. (which is about to begin Day 2 as I write this), I presented a seminar on tips and techniques for successful Word/ID workflows. I started to run out of time as I got to the topic of useful scripts, and promised the attendees I’d post here to recap what I said and to link to them.

Faithful blog readers will recognize a couple of these being mentioned in a comment or two in the past, but I think you’d agree they deserve to get top billing  in an actual post. ;-)

Convert Local Formatting to Character Styles

If you’re having difficulty getting what you want when you apply paragraph styles to imported Word files, the problem is most likely the local formatting (style overrides) that came along for the ride. After you place the Word file but before you start applying styles, try downloading and running one of these free Javascript (cross-platform) scripts.

  • Preserve Local Formatting.jsx is by Dave Saunders and works for InDesign CS1 (change the script’s extension to .js), CS2, and CS3. Preserve Local Formatting can run through a selection of text (or the whole document, if nothing is selected) and replace locally-formatted bolds and italics, among others, with equivalent character styles. The script adds the styles to the Character Styles palettes on its own – no need to create them yourself.
  • PrepText.zip is by Jongware, and works with CS4 only. It unzips to a .jsx script. It works just like Dave’s script, or you can read the InDesign Forum thread on Adobe.com where Jongware first posted a link to the script and gave some tips on how to best use it, if you like.

In the screen shot below, I started with a paragraph full of various text styles, all created with local (manual) formatting, and an empty Character Styles panel. I opened my Scripts panel (Windows > Automation) and double-clicked the PrepText.jsx script, which created and applied all the character styles you see below.

The ability to convert local formatting into Character Styles is also available with David’s upcoming BlatnerTools plug-in for InDesign CS3 or CS4, along with dozens of other functions. You can download a free public beta of the cross-platform plug-in from the Blatner Tools page on the DTP Tools site.

Convert GREP and Nested Styles to Manual Character Styles

Let’s say you’re a clever gal or guy and you’ve tweaked certain paragraph styles to automatically apply character styles according to your specs, either via the Nested Styles pane (CS3 and CS4) or the GREP Styles pane (CS4). Everything works perfectly … until you need to export text formatted with those automatically-applied character styles, such as exporting to RTF to share with a Word user. The character style formatting gets lost, and the text reverts to its base formatting defined by the paragraph style.

To retain the formatting, you need to manually apply the character style to every instance of styled text. But why waste your time doing that tedious work when two wonderful people have come up with scripts that do that for you?

  • ApplyNestedStyles.zip (CS3 and CS4) is a cross-platform script written by our friend Harbs (owner of In-Tools) that takes care of the Nested Styles problem. It doesn’t change the paragraph style definition at all, the paragraph style is still applying its Nested Styles as defined. It’s just that, when you run the script, the affected text also gets the same character style applied to it manually, meaning it will be correctly formatted when you export it.
  • TurnGrepStyles2CharStyles.zip (CS4) is a cross-platform script written by an Adobe guru from Israel named Adi Ravid. Like ApplyNestedStyle, the script manually applies the same character style to text that is styled that way because of a GREP Style defined in the parent paragraph style, and doesn’t touch the paragraph style definition. Unfortunately I didn’t bookmark the page where I learned about it – probably from a forum – and can’t find much on Google other than Adi’s mac.com public download folder where I first got the script.

The two paragraphs below are formatted with a paragraph style that uses Nested Styles to make the first word red (character style: Red text) and the next three words bold (character style: Bold lead-in).  Running Harbs’ ApplyNestedStyles.jsx script doesn’t change how the text looks, but I can tell it’s done its job by selecting some of the styled text and looking at the Character Styles panel.

The style entry “Bold lead-in” is highlighted, indicating the style has been manually applied (and so the text will export with the correct formatting). But notice how you still see the notation “Bold lead-in” in the bottom status area of the panel, next to a paragraph symbol, which is InDesign’s way of telling us the character style is being applied via a paragraph style.

Converting Nested and GREP’d styles to manually-applied Character Styles is also useful when you export a layout to INX (CS3 would lose CS4’s GREP Style formatting, for example); and when exporting text to ePub, XHTML, and XML.

I recommend you run these scripts on a copy of the file, though, because you really can’t do any major editing of the text without having to be careful to watch for and remove the manually-applied character styles when necessary. For example, if you add a word before the first word in either of the paragraphs in the above screen shot, you’re going to end up with two words that are red, since the existing one has the style manually applied to it.

Anne-Marie “Her Geekness” Concepción is the co-founder (with David Blatner) and CEO of Creative Publishing Network, which produces InDesignSecrets, InDesign Magazine, and other resources for creative professionals. Through her cross-media design studio, Seneca Design & Training, Anne-Marie develops ebooks and trains and consults with companies who want to master the tools and workflows of digital publishing. She has authored over 20 courses on lynda.com on these topics and others. Keep up with Anne-Marie by subscribing to her ezine, HerGeekness Gazette, and contact her by email at [email protected] or on Twitter @amarie
  • Many Thanks Anne Marie for the information and for taking the time explaining what each does and in which situations they will be extremely useful.

  • James Fritz says:

    Great Scripts!

    thanks AM

  • Harbs says:

    I could have sworn that Adi wrote about his script on this site, but I can’t find it now.

    BTW, My script will apply the style to any text which has it applied in any way — with either nested styles, GREP styles, or line styles.

  • Eugene says:

    Cool list, AM.

    Don’t forget to read AM’s post on degunkifying word files https://www.senecadesign.com/designgeek/dgarchives/designgeek65.php#degunk_word

    I do a lot of importing of Word documents on a daily basis, long documents to brochures to magazines.

    The above scripts, especially the first one mentioned, has saved me hours of work in formatting and proofing time.

    Can’t thank those guys enough for all the hard work they do and letting people have it for free.

    Thanks guys.

  • Adi Ravid says:

    Yep, Harbs is correct.
    The script emerged from within the pages of this site, and you can find it here.
    Actually, it was written to the request of Nye Hughes, who fathered the Applescript version of it (one comment above), and raised the challenge for a Javascript version.
    The rest is history.

    As Apple recently closed the curtain over the .mac sites, there’s no way to update my public folder, so I’m currently in the process of constructing my “Scripting Fair” site, where you’ll be able to download free scripts, order custom scripts, and even use an innovative web tool to construct your own script.

  • Thank you for the info Adi! And for the script too. ;-)

  • Many many thanks for these useful script.

    :)

  • >