2013-08-09

Word 2010: How to create a style where spell checking is disabled for CLI or code?

Don't you hate it if Word always underlines all the code or console commands you paste into it?

I did, but there's an easy way out.

I prefer to use 2 styles for my copy paste from the console. One style is for the commands usually bold and the output of the commands.

Now the only thing to make sure the output is not underlined because of the spell checker, just do the following:

  • Select one paragraph that is already using style "command" (my custom style based on "plain text" style)
  • Click Review tab, select Language, set Proofing Language and then check the box "do not check spelling or grammar"
  • Right click your style in the quick style gallery (I always add the ones I frequently use) and select update "command" to match selection.
Yep, that's it.

Update: not really, for some reason not all underlines disappear immediately, and even if you click your style from the gallery again. But they do if I save and close and reopen the document. There must be a better way.


http://office.microsoft.com/en-001/word-help/spelling-or-grammar-checker-flags-text-i-don-t-want-or-expect-it-to-flag-HA010354285.aspx

Word

  1. Select the text that you want the spelling and grammar checker to ignore.
  2. On the Review tab, in the Language group, click Language, and then click Set Proofing Language.
  3. Select the Do not check spelling or grammar check box.
You can also create a special style that is based on the selected text:

  1. Right-click the selection, and then click Save Selection as a New Quick Style.
  2. Give the style a name—for example, code—and then click OK.

No comments: