How to avoid spell checking of source code in MS Word?
Asked Answered
B

5

37

When I copy source code to a word document or email, it would be nice if spell check could ignore source code token.

Is there an option to ignore blocks of text?

Banneret answered 5/2, 2009 at 2:21 Comment(1)
Tempted to mark for close since it's a Word question. But I think I'll let this one go.Docile
A
35

This one's easy. Select the code you pasted, go to Tools -> Language (or in the latest version of Word, the equivalent on the ribbon) and select the checkbox "Don't check."

Allianora answered 5/2, 2009 at 2:29 Comment(1)
For word 2016+, go to Review -> Language -> Set Proofing Language.Trella
C
31

To only turn off spell check for blocks of text, create a style called "Code".

Next, modify the style. In the Style editor, go to the Format sub-menu, then Language, then tick "Do not check spelling or grammar".

The Language sub-menu when editing the style Turning off spelling and grammar

Now, wherever you apply that style, Word will ignore spelling and grammar. Perfect for source code! While you're editing the style, set a light-gray background, and set the font to Courier New.

This prevents you from having to set the language (and font, etc.) everywhere you have source code in your Word doc.

The final result looks like this:

enter image description here

Cherrylchersonese answered 6/12, 2013 at 22:21 Comment(4)
I like this idea for MS Word 2010, since the other idea for "Don't Check" requires it to be done for each section. But when I create a new style "Code", it either makes everything bold or not-bold.Authors
I think a better font to use is ConsolasVeterinary
That's the nice thing about using styles - you can reformat all your code at once.Marcel
See answers.microsoft.com/en-us/msoffice/forum/all/… for instructions / macros to create no proofing styles.Grenade
P
5

Highlight the code/text in the document go to the Tools Menu>Language>Set Language. There will be a "Do not check spelling or grammar" checkbox

this will mark the area so that the spellchecker skips over it

Posen answered 5/2, 2009 at 2:29 Comment(0)
T
2

This is my solution to word plastering my design docs with distracting red-underlines. It's not exactly what you're asking for, but you might find it sufficient.

Basically, one day I was thinking - "Why can't word make the mispelling markings SUBTLE like IntelliJ does?"

Well, it can - just change the wavy underline color to light gray instead of red.

http://support.microsoft.com/kb/925597

So much less distracting.

One other thing that the spell checker in IntelliJ does is detect camelcaps and treat each subword in a camel capped word as a separate word... So it considers myWordDocument spelled correctly, but flags myWerdDocument. Be nice if word did that!

Travel answered 20/1, 2011 at 22:56 Comment(1)
Because spelling mistakes are something you want to be made very aware of. You don't want to accidentally miss something because the programme tried not to offend you with red underlines.Timeserver
S
0

To avoid MS Word checking for any spelling or grammar in languages, go to Review> Language> Set proofing language

  • Uncheck 'Detect language automatically'
  • Select any language (double click any from list of languages)
  • Uncheck 'Do not check spelling or grammar'
Stakhanovism answered 26/10, 2022 at 11:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.