Can you italicize part of a word

I am wondering if I can or should take a bit of stylistic license and italicize just part of a word:

He took a sharp turn back into a side street, and collided hard with something that sent him sprawling to the ground. He scrambled to his feet as he realized that the it wasn’t something he had collided with, it was someone.

Maybe there is a better way to do this. Thoughts?

Lauren-Clear-Monica-Ipsum's user avatar

asked Oct 7, 2011 at 14:44

Tim Chaves's user avatar

4

Yes, this is OK, as it allows you to emphasise certain things, that you want the readers to notice. In your example, that the character has collided with another person. By putting it in Italics, you are also letting the reader know this person is important, and may play a role later.

A word of warning- don’t overuse this technique( as with any technique). It can get tiring soon, and loses it’s effect.

answered Oct 7, 2011 at 15:15

Shantnu Tiwari's user avatar

Shantnu TiwariShantnu Tiwari

6,8833 gold badges26 silver badges57 bronze badges

I believe this is perfectly acceptable and does a good job of emphasising your point. I’ve seen this done before and it works stylistically.

answered Oct 7, 2011 at 14:51

Steven Drennon's user avatar

Steven DrennonSteven Drennon

10.6k3 gold badges34 silver badges73 bronze badges

Yep, works for me. You’re reproducing a speech pattern in which part of the word is emphasized.

answered Oct 7, 2011 at 15:15

Lauren-Clear-Monica-Ipsum's user avatar

Salinger does it a ton in Catcher in the Rye — hence the very reason I found my way to this site/link discussion this matter — as I wanted to know more about it….

answered Sep 21, 2013 at 17:19

Troy's user avatar

Last Update: Jan 03, 2023

This is a question our experts keep getting from time to time. Now, we have got the complete detailed explanation and answer for everyone, who is interested!


Asked by: Prof. Mackenzie Rice

Score: 4.5/5
(62 votes)

You italicize text most often to call attention to it. Literally to emphasize a word, so that someone reading the sentence will give that word or phrase some extra oomph, as you might intend as the writer.

Can you italicize in text messages?

While you can’t italicize text when sending messages on an iPhone, you can add italics in Mail, Notes, and Pages.

How do I make text italicized?

To make your selected text italic or start writing text in italic, press the Ctrl + I keys on your keyboard. To make your selected text underlined or start writing underlined text, press the Ctrl + U keys on your keyboard.

Can you italicize text messages on Android?

Add text to your message. Double tap the text you want to format. Tap Format, then choose a formatting option like bolding, italics, or changing the font color.

What does it mean to italicize a text?

Italics are used primarily to denote titles and names of particular works or objects in order to allow that title or name to stand out from the surrounding sentence. Italics may also be used for emphasis in writing, but only rarely.

38 related questions found

When should I use italics in writing?

When to Use Italics in Your Writing

  1. To emphasize something.
  2. For titles of standalone works, such as books and movies.
  3. For vehicle names, such as ships.
  4. To show that a word is borrowed from another language.
  5. For the Latin “scientific” names of plant and animal species.

What are italics examples?

Italics can emphasize a single word or phrase. For example: “Are you going to eat that?” or “I never said I wanted to go. I said I would consider it.”

How do you make text bold?

Make text bold

  1. Move your pointer to the Mini toolbar above your selection and click Bold .
  2. Click Bold in the Font group on the Home tab.
  3. Type the keyboard shortcut: CTRL+B.

How do I make text bold on Android?

the android:textStyle attribute allow us to set the text style to normal, bold or italic. we can combine this style by separated them using keyboard pipe | symbol. so if we want to render TextView text as bold and italic then we need to set the android:textStyle attribute value as android:textStyle=»blod|italic».

How do you make text bold on Android?

Android: Tap and hold the text you’re entering in the text field, then choose Bold, Italic, or More . Tap More to choose Strikethrough or Monospace. iPhone: Tap the text you’re entering in the text field > Select or Select All > B_I_U. Then, choose Bold, Italic, Strikethrough, or Monospace.

How do you italicize text on a Mac?

Mac keyboard shortcuts for text formatting

  1. Bold text: Command + B.
  2. Underline text: Command + U.
  3. Italicize text: Command + i.
  4. Add superscript: Ctrl + Shift + Command + +
  5. Add subscript: Ctrl + Command + —
  6. Make highlighted text larger or smaller: Command + Shift + > or Command + Shift + <
  7. Insert line break: Command + Return.

How do you make text bold on iPhone?

Open the Settings app . In the Settings app, select Accessibility from the list. On the Accessibility screen, select Display & Text Size. On the Display & Text Size screen, select Bold Text to set the toggle switch to On.

Can you make text bold in Imessage?

You can’t freely bold text in an iPhone text message, but you can give each of your texts a bold subject line. Giving your iPhone texts a bold subject line can be a great way to help your messages stand out.

How do you bold and italicize in Imessage?

How do you bold and italicize and underline text on iPhone and iPad?

  1. Select the text you want to be bold.
  2. Tap the arrow on the menu bar.
  3. Tap on the BIU button.
  4. Tap on the Bold button.

How do you emphasize a word in a text message?

Here we have discussed 5 common ways to emphasize text:

  1. Italicize. Italics are a nice improvement from the days of the typewriter when underlining was the norm. …
  2. Bold. Using bold text is more dramatic and easily recognizable than italics. …
  3. Change Size. …
  4. Use Space. …
  5. Add Color.

How do you bold and italicize on Android?

On Android smartphones, tap and hold the text, then choose Bold, Italic, or More. Tap More to choose Strikethrough or Monospace. On iPhone, tap the text > Select or Select All > B_I_U. Then, choose Bold, Italic, Strikethrough, or Monospace.

How do you make text bold on flutter?

“how to make font bold in flutter” Code Answer’s

  1. Text(
  2. ‘Some text’,
  3. style: TextStyle(
  4. fontSize: 24,
  5. fontWeight: FontWeight. bold),
  6. )

What do bold letters mean?

B. A set of type characters that are darker and heavier than normal. A bold font implies that each character was originally designed with a heavier appearance rather than created on the fly from a normal character. See boldface attribute.

How do you make text bold on Facebook?

You can also add bullets, create header text, and more.

  1. Go to a supporting Facebook group or community and begin creating a post.
  2. Select the text you want to bold and you should see a popup come up that allows you to bold text.
  3. Click “B” for bold.
  4. Post!

Why would you format text before you start typing?

Formatting is the fine art of making your documents effective and attractive. Good formatting distinguishes different parts of your text and helps your readers take in your message. You can apply formatting to just about every element of your document, from a single character to entire paragraphs.

What does italic font look like?

An italic font is a cursive, slanted typeface. A font is a specific size, style, and weight of a typeface used in printing and writing. When we keyboard text, we typically use a roman font, where the text is upright. By comparison, an italic font is slightly slanted to the right.

What does italics mean in English?

When you italicize your writing, you print or type in the slanted letters called «italics.» You can italicize a word in a sentence when you want to emphasize it. People italicize for various reasons: they might italicize the title of a book, or a section of dialogue that’s yelled by a character in a story.

What does bold text mean on iPhone?

Created November 2018. ‘Bold Text’ will make the font appear thicker and richer in either black or white. This feature also works well alongside other accessibility settings such as ‘Increase Contrast’. Open the ‘Accessibility Settings’: Settings > General > Accessibility.


Download Article


Download Article

  • Using a Word Processor
  • |

  • Using HTML Tags
  • |

  • Using Latex Commands
  • |

  • Editing Wikipedia Articles
  • |

  • Italicizing Wisely
  • |

  • Warnings

Italicized text is text that is slanted to the right. Italicizing draws emphasis to certain text within a document, whether it is a file created with a software application, a website page created in HTML, a document with LaTeX, or a Wikipedia page. Each application has its own method for italicizing text.

  1. Image titled Italicize Step 1

    1

    Decide what portion of the text should be italicized. Most software applications let you choose which text you wish to italicize in one of two ways:

    • Select existing text to be italicized. Place your cursor in front of the first letter in a block of text to be italicized. Hold down your left mouse button and drag your cursor over the block of text to highlight it, then release your mouse button.
    • Italicize new text. Place your cursor at the location within the body of text where you want to type new, italicized text. In most cases, this will be at the end of the text.
  2. Image titled Italicize Step 2

    2

    Use the appropriate control. Within a software application, you can italicize text using either the software’s graphic user interface or with a keystroke command.

    • The applications in Microsoft Office and many similar applications feature either a toolbar or ribbon interface that includes a set of text formatting button controls. Among these controls is a button showing a capital “I” slanted to the right. This is the Italics button.
    • Press the CTRL and I keys on your keyboard at the same time to enable italics in Windows.[1]
    • In MacOS, you can also enable italics by pressing the COMMAND (also called the “Open Apple”) and I keys on your keyboard at the same time.[2]
      [3]

    Advertisement

  3. Image titled Italicize Step 3

    3

    Italicize your text. Which way you use the software interface or keystroke commands depends on whether you are italicizing selected text or typing italicized text.

    • To italicize selected text, either click the Italics button or use the appropriate italics keystroke command. The selected text will be italicized, and the highlighting around the text will disappear.
    • To italicize as you type, either click the Italics button or use the appropriate italics keystroke command. Begin typing. As you type, your text will be displayed in italics. To turn off italics, click the Italics button or use the appropriate keystroke command again. Your text will no longer appear in italics.
  4. Advertisement

  1. Image titled Italicize Step 4

    1

    Place an italics tag in front of the text you wish to italicize. The italics tag is an upper- or lowercase “I” bracketed by a less than (<) and a greater than (>) sign: <I> or <i>.

    • You can place the tag in front of text you’ve already typed or type the tag and then type text you want to italicize.
  2. Image titled Italicize Step 5

    2

    Place a close italics tag after the text you wish to italicize. The close italics tag looks like the italics tag, except that it has a forward slash between the less than sign and the “I”: </I> or </i>.

    • If you do not place a close italics tag after the text you wish to italicize, all the text following the italics tag will be italicized.
    • A number of websites allow you to enable HTML to support bolded, italicized, and underlined text. They may or may not support other HTML features, however.[4]
  3. Advertisement

  1. Image titled Italicize Step 6

    1

    Write the text file using a text editor. LaTeX (pronounced “LAY-tech” or “LAH-tech”) is a typesetting application that converts text files into formatted documents. To use LaTeX, you must first create a document in a text editor program with instructions telling LaTeX what type of document you have and where the actual document text begins. These instructions are command that begin with the backslash () character.

    • Specify the type of document with the “documentclass” command, with the type of document specified in braces. For an article, the command would read “documentclass {article}”. (Do not include the quotation marks; they are used here to set off the example.)
    • Specify where the text portion begins with the command “begin {document}”.
  2. Image titled Italicize Step 7

    2

    Enclose the text to be italicized in braces ({}). The braces indicate the starting and stopping places for formatting the text as specified by the formatting command.

    • You can nest several formatting commands, such as having a large block of italicized text with a portion within it in boldface. If you do nest commands, be sure to use as many close braces as you do open braces to ensure that the text is formatted the way you want.
  3. Image titled Italicize Step 8

    3

    Precede the text to be italicized with the “textit” command. A sentence with the last word italicized would read as follows: “One of the first TV shows to realistically depict the routine of patrol officers was textit {Adam-12}.”[5]

  4. Advertisement

  1. Image titled Italicize Step 9

    1

    Enclose the text to be italicized in pairs of single quotes. Two single quotes (apostrophes), placed in front of and behind the text to be italicized, signal Wikipedia’s text editor that the text between them should be displayed in italics.[6]
    You may type your text first and go back and place single quotes around the text, or type the first pair of single quotes, your text, and then the second pair of single quotes.

    • Paired single quotes can be distinguished from double quotes by the greater amount of space between them.
    • If your text editor has a “smart quotes” feature, you may need to turn it off for Wikipedia’s text editor to recognize the single quotes as formatting signals.
    • If you have a hyperlink that includes italicized text, the italics flags must be outside the hyperlink bracket indicators if all the hyperlink text is to be italicized. If only part of the hyperlink text is to be italicized, you may place the italics flags around only the text to be italicized.[7]
  1. Image titled Italicize Step 10

    1

    Italicize words you want to give particular emphasis to. In simplest terms, this means that any word you would underline in a handwritten letter to emphasize, or would say more forcefully than others when speaking, you would italicize in a word processing document or on a website. For example, “I am the only living only child among my first cousins.”

  2. Image titled Italicize Step 11

    2

    Italicize foreign words that have not been fully adopted into English. Foreign words and phrases used in English writing for effect are italicized, such as using the German Turnverein in place of the common American term “athletic club.” Foreign words that have become part of the English language through common usage, such as “kindergarten,” are not italicized.

    • The Latin words for the genus and species of an organism are also italicized, as in Homo sapiens.
  3. Image titled Italicize Step 12

    3

    Italicize technical terms. This is normally done when the terms are first introduced, particularly if they have a meaning different from what the reader is used to.

    • Physical constants, such as c for the speed of light, and variables in algebra, as in “ n = 2,” are also rendered in italics.[8]
  4. Image titled Italicize Step 13

    4

    Italicize block quotations. A block quotation is a lengthy quotation (typically 100 words or more, or at least 5 to 8 lines of text) set off from the rest of the text and indented. Block quotations are often rendered in italics, or in a different font or point size.[9]

    • When an item in a block quote would be italicized, and the rest of the block quote is already in italics, the item is commonly rendered in normal text to set it off from the block quote.
    • Large blocks of italicized text can be hard to read on some computer screens. In such cases, you may want to render block quotes in a different font than the surrounding text.[10]
  5. Image titled Italicize Step 14

    5

    Italicize the names of named major transportation vehicles. While you do not italicize the make, model, or military designation of a vehicle, vessel, or craft, you do italicize the following named vessels:

    • Trains (The Golden State Limited), but not the names of individual cars.
    • Ships, either military or passenger vessels (USS Lexington, Queen Elizabeth II).
    • Aircraft names or nicknames not based on construction or performance characteristics (Memphis Belle or Cutter’s Goose from the TV show Tales of the Gold Monkey, but not the Batplane).
    • Spacecraft, either real or fictional (the Space Shuttle Challenger, the starship Enterprise, the Millennium Falcon). Space missions, such as Apollo 11, are not italicized.
  6. Image titled Italicize Step 15

    6

    Italicize the titles of certain major creative works. The following works have their titles rendered in italics, unless a particular style manual (such as AP or MLA) dictates otherwise:

    • Books (Harry Potter and the Sorcerer’s Stone), except for the titles of religious books such as the Bible or the Koran. Titles of chapters, sections, and short stories within anthologies are enclosed in double quotes.
    • Magazines (Collier’s, Reader’s Digest). Titles of articles (“I Am Joe’s Kidney”) are enclosed in double quotes.
    • Newspapers (USA Today, The Wall Street Journal).
    • Plays (Romeo and Juliet, Who’s Afraid of Virginia Woolf?).
    • Court cases (Brown v. Board of Education of Topeka).
    • Television and radio programs (Star Trek, The Shadow). Titles of episodes (“Amok Time,” “Temple Bells of Neban”) are enclosed in double quotes.
    • Record albums (Mandatory Fun, Red). Titles of album tracks (“Word Crimes,” “I Knew You Were Trouble”) are enclosed in double quotes.
    • Artwork (Mona Lisa, The Last Supper).
    • Punctuation marks that are part of the title are italicized with the rest of the title.[11]
  7. Image titled Italicize Step 16

    7

    Italicize a character’s internal dialog. In fiction, when a character’s thoughts are put into words for the sake of the reader, they are commonly rendered in italics, as in “Kate regarded her husband with apprehension. That’s funny, Joe never asks for a second cup of my coffee.

  8. Image titled Italicize Step 17

    8

    Italicize onomatopoeia (word sounds). If you’re attempting to render a sound with a word the way the reader would hear it, italicize the word: “The startled cat gave out an angry Meeeowwwrr!” If you’re using a word to describe a general sound, you don’t italicize it: “The cat meowed.”[12]

  9. Advertisement

Ask a Question

200 characters left

Include your email address to get a message when this question is answered.

Submit

Advertisement

Thanks for submitting a tip for review!

  • Italics work best when used sparingly. The more words you italicize, the less impact each italicized word has.

Advertisement

About This Article

Thanks to all authors for creating a page that has been read 44,251 times.

Is this article up to date?


Asked by: Prof. Adrian Doyle IV

Score: 4.1/5
(60 votes)

The History Behind Italics

Italics is when a typeface is slanted to the right. … Italics are used to distinguish words from other parts of the text and draw attention. Like underlining, it can create emphasis; therefore, you wouldn’t want to both underline and italicize the same word.

What does italicizing text mean?

Italics have several uses. Most commonly, italics are used for emphasis or contrast — that is, to draw attention to some particular part of a text. … This is the standard way of representing emphasis or contrast; you should not try to use quotation marks or other punctuation marks for this purpose.

What does Italicizing a word do?

When you italicize your writing, you print or type in the slanted letters called «italics.» You can italicize a word in a sentence when you want to emphasize it. … Print that you italicize usually slopes from left to right, and it resembles script or cursive writing.

What is italic example?

Italics are typically used to show emphasis (For example: “I don’t care what he thinks. I do what I want!”) or to indicate titles of stand-alone works (Black Panther, Lost in Translation). Different style guides have different rules about what to italicize.

How do you italicize a text?

To make text italic, select and highlight the text first. Then hold down Ctrl (the control key) on the keyboard and then press the I on the keyboard. To underline text, select and highlight the text first. Then hold down Ctrl (the control key) on the keyboard and then press the U on the keyboard.

27 related questions found

Do you use bold text on iPhone?

You can’t freely bold text in an iPhone text message, but you can give each of your texts a bold subject line. Giving your iPhone texts a bold subject line can be a great way to help your messages stand out.

How do you make text bold?

To make your selected text bold or start writing text in bold, press the Crtl + B keys on your keyboard. To make your selected text italic or start writing text in italic, press the Ctrl + I keys on your keyboard.

What are the italic words?

Italic is a typeface or font style that slants to the right. Most writers use italic type to emphasize certain words or phrases. You can use the word italic as a noun or an adjective, usually in the form «italic type,» or italics. Either way, it describes the kind of cursive-styled typeface that leans at an angle.

What does italic font look like?

An italic font is a cursive, slanted typeface. A font is a specific size, style, and weight of a typeface used in printing and writing. When we keyboard text, we typically use a roman font, where the text is upright. By comparison, an italic font is slightly slanted to the right.

When should I use italics in writing?

When to Use Italics in Your Writing

  1. To emphasize something.
  2. For titles of standalone works, such as books and movies.
  3. For vehicle names, such as ships.
  4. To show that a word is borrowed from another language.
  5. For the Latin “scientific” names of plant and animal species.

Why are words italicized in the Bible?

That is, the italics enable the reader to distinguish between words found in the manuscripts of the Hebrew Old Testament and the Greek New Testament that actually translate into English, and words that were necessarily added to make sense in English.

What is bold used for?

Bold strongly stands out from regular text, and is often used to highlight keywords important to the text’s content. For example, printed dictionaries often use boldface for their keywords, and the names of entries can conventionally be marked in bold.

Do you put quotes in italics in an essay?

Italics are used for large works, names of vehicles, and movie and television show titles. Quotation marks are reserved for sections of works, like the titles of chapters, magazine articles, poems, and short stories. Let’s look at these rules in detail, so you’ll know how to do this in the future when writing.

What is italicized APA?

In APA, use italics for titles of books, scholarly journals, periodicals, films, videos, television shows, and microfilm publications. Quotation marks or italics are not required for articles, webpages, songs, episodes, etc.

Where do you use italic fonts?

Italics are used primarily to denote titles and names of particular works or objects in order to allow that title or name to stand out from the surrounding sentence. Italics may also be used for emphasis in writing, but only rarely.

Are italics a font?

A typeface with letters slanted slightly to the right. Italic type is used to emphasize words as well as for decoration. Most, but not all, fonts have an italic typeface. Many fonts come in normal, bold, italic and bold italic variations.

What is non italic called?

The technical name for non-italic fonts is roman or romanized, so this is probably your best choice from the options you’ve given.

How do I make my iPhone text bold?

Open the Settings app . In the Settings app, select Accessibility from the list. On the Accessibility screen, select Display & Text Size. On the Display & Text Size screen, select Bold Text to set the toggle switch to On.

Why would you format text before you start typing?

Formatting is the fine art of making your documents effective and attractive. Good formatting distinguishes different parts of your text and helps your readers take in your message. You can apply formatting to just about every element of your document, from a single character to entire paragraphs.

How do I make text bold in notepad?

How to change font in Notepad and apply bold/italic styles?

  1. Goto Menu: Format -> Select Font.
  2. Select Differnt Font & Font styles (Regular/Italic/Bold/Bold Italic)
  3. Check the Preview in Sample section:
  4. Click OK.

Can you strikethrough text on iPhone?

Tap and hold the text to select the line in which you wish to strike through. The in-context marking menu will appear. Drag either of the blue bookends to the left or right to narrow or widen your text selection. Tap the strikethrough S icon from the in-context marking menu.

How do you highlight text on an iPhone?

How to quickly select text

  1. While editing text, quickly double tap on the word that you want to select to highlight it.
  2. Swipe left or right along that line, near the beginning or end of the highlighted text, to select more text to the left or right. …
  3. If you want to select a sentence, perform a triple tap on a word.

How do you underline text on iPhone?

Douple-tap to select the text and bring up the context menu, then press the right arrow. You’ll see options to bold, italicize and underline your text.

What’s the most famous quote?

The Most Famous Quotes

  • “Fortune favors the bold.” – Virgil. Life is what happens when you’re busy making other plans. …
  • “Time is money.” – Benjamin Franklin. …
  • “I came, I saw, I conquered.” – Julius Caesar. …
  • “When life gives you lemons, make lemonade.” – Elbert Hubbard. …
  • “If you want to be happy, be.” – Leo Tolstoy.

How do you properly cite a quote?

In-text citations include the last name of the author followed by a page number enclosed in parentheses. «Here’s a direct quote» (Smith 8). If the author’s name is not given, then use the first word or words of the title. Follow the same formatting that was used in the Works Cited list, such as quotation marks.

December 28th, 2009

Bookmark and Share 

Hey, Scripting Guy! Question

Hey, Scripting Guy! I do not know about you, but I hate having to italicize certain words. Actually, I hate italicizing all words because I do not like removing my hands from the keyboard, grabbing the mouse, and then searching for where the text formatting menus have moved in Office 2007. If I could simply type my Microsoft Word document straight, and then have a script italicize the words that my company style guide requires to be italicized, it would be so sweet. Such a script would save me at least an hour a week because the pointy-headed boss is ridiculously obsessed with the company style guide, and I am convinced he never reads my first reports. Instead, he just sends them back to me to be corrected. Help!

— FM

Hey, Scripting Guy! AnswerHello FM,

Microsoft Scripting Guy Ed Wilson here. I have been settling back into the swing of things after having been on holiday for a couple of days—it is amazing how quickly e-mail can pile up. I had a great meeting with the Scripting Manager this afternoon. We were talking about the Weekend Scripter series that we will start in February 2010. That is right; the Scripting Guys will be 7 days a week, 365 days a year! You will never be without the Scripting Guys. For example, while you are sitting around on New Year’s Day, you can pop over to our site and read the latest Hey, Scripting Guy! Blog post (it will be a Quick-Hits Friday article by the way). In February, you will also be able to read our articles with your Saturday morning coffee, or your Sunday afternoon cup of tea (I generally prefer a nice cup of Earl Grey tea in the afternoon, but it is entirely your choice).

FM, it’s also your choice to italicize your company’s style words while typing or wait until you have completed writing your document and run a script. That is right: I wrote the ItalicWordsInWord.ps1 script to give you the freedom to clean up your document after you have written it. The complete ItalicWordsInWord.ps1 script is seen here.

ItalicWordsInWord.ps1

$application = New-Object -comobject word.application

$application.visible = $true

$document = $application.documents.open(“C:fsoTest.docx”)

$selection = $application.Selection

$words = “exchange”,”sql”

$matchCase = $false

$matchWholeWord = $true

$matchWildCards = $false

$matchSoundsLike = $false

$matchAllWordForms = $false

$forward = $true

$wrap = 1

$format = $true

$replace = 2

Foreach ($word in $words)

{

 $findText = $word

 $replaceWith = $word

 $selection.find.replacement.font.italic = $true

 $exeRTN = $selection.find.execute($findText,$matchCase,

 $matchWholeWord,$matchWIldCards,$matchSoundsLike,

 $matchAllWordForms,$forward,$wrap,$format,$replaceWith,

 $replace)

 }

The first thing that must be done when working with Microsoft Word’s automation model is to create an instance of the word.application COM object. This is done by using the New-Object cmdlet with the –comobject parameter. The returned application object is stored in the $application variable as shown here:

$application = New-Object -comobject word.application

After the application object is created, the visible property is set to $true. This will make the Microsoft Word application visible and allow you to see the text as it is italicized. If you have multiple documents you wish to process, you will probably want to set the visible property to $false to speed things along. Setting the visible property to $true is seen here:

$application.visible = $true

When you have the application object, you can use the open method from the documents collection to open the Microsoft Word document you wish to process. Store the returned document object in the $document variable, as shown here:

$document = $application.documents.open(“C:fsoTest.docx”)

You can create a selection object directly from the application object by using the selection property. Store the returned Selection object in a variable called $selection to make your script easy to read:

$selection = $application.Selection

When you have created your Selection object, it is time to create the array of words you want to italicize. If you only have a few words, you may want to hard code them directly into your script, as was done here. If you have a large number of words, you may want to store them in a text file and use the Get-Content cmdlet to create your array. In the ItalicWordsInWord.ps1 script, the words “exchange” and “sql” are stored in the array $words, as seen here.

$words = “exchange”,”sql”

It is now necessary to specify the parameters that will be used for the find-and-replace operation. The parameters of the execute method from the find object correspond to the selections available from the find and replace dialog box in Word. The variable names and the values are documented on MSDN but are relatively self-explanatory:

$matchCase = $false

$matchWholeWord = $true

$matchWildCards = $false

$matchSoundsLike = $false

$matchAllWordForms = $false

$forward = $true

$wrap = 1

$format = $true

$replace = 2

After you have assigned all the parameter values to the appropriate variables, use the Foreach statement to walk through the array of words to be italicized, which is stored in the $words variable. You will replace the word you find with the same word, as seen here:

Foreach ($word in $words)

{

 $findText = $word

 $replaceWith = $word

Use the italic property of the font object to italicize the replacement word. You can obtain the font object by using a replacement object from the find object that was obtained from the selection object. This is seen here:

 $selection.find.replacement.font.italic = $true

After you have set the italic property to $true, you can call the execute method from the Find object. This is seen here:

 $exeRTN = $selection.find.execute($findText,$matchCase,

 $matchWholeWord,$matchWIldCards,$matchSoundsLike,

 $matchAllWordForms,$forward,$wrap,$format,$replaceWith,

 $replace)

 }

When the ItalicWordsInWord.ps1 script runs, the following appears:

Image of result of runnig the script

FM, that is all there is to using Microsoft Word to italicize words in a Word document. Word Week will continue tomorrow.

If you want to know exactly what we will be looking at tomorrow, follow us on Twitter or Facebook. If you have any questions, send e-mail to us at scripter@microsoft.com or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

Ed Wilson and Craig Liebendorfer, Scripting Guys

Like this post? Please share to your friends:
  • Can you have microsoft word on ipad
  • Can you have microsoft word on a mac
  • Can you have excel on iphone
  • Can you have bullets in excel
  • Can you have a comma after the word and