Megosztás a következőn keresztül:


Working with Text in Documents

Applies to

The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.

Project type

  • Document-level projects

  • Application-level projects

Microsoft Office version

  • Word 2003

  • Word 2007

For more information, see Features Available by Application and Project Type.

The topics in this section provide step-by-step procedures and code examples for using the object model of Microsoft Office Word to work with text in Visual Studio Tools for Office projects.

In some cases, the ways that you perform these tasks in application-level add-ins is different from the ways that you perform them in document-level customizations.

Task

Procedure

Define ranges based on various criteria and select them.

How to: Define and Select Ranges in Documents

Get the characters that begin and end a range.

How to: Retrieve Start and End Characters in Ranges

Select a paragraph without including the paragraph mark, and move the text.

How to: Exclude Paragraph Marks When Creating Ranges

Make a range larger or smaller.

How to: Extend Ranges in Documents

Move a range to a different location and size.

How to: Reset Ranges in Word Documents

Reduce a range or section to consist of only the insertion point.

How to: Collapse Ranges or Selections in Documents

Insert text into a document.

How to: Insert Text into Word Documents

Format the text in a range.

How to: Format Text in Documents

Add or replace text in a bookmark.

How to: Update Bookmark Text

Find specific text by using a selection or a range.

How to: Search for Text in Documents

Find specific text and replace it.

How to: Search for and Replace Text in Documents

Specify how Word searches for text.

How to: Set Search Options in Word

Iterate through search results.

How to: Loop Through Found Items in Documents

Save the current selection and restore it after a search.

How to: Restore Selections After Searches

Get the number of characters in a document, including hidden characters.

How to: Count Characters in Documents

Hide the text in a bookmark before printing a document.

How to: Hide Text in Documents

Add a comment to text.

How to: Add Comments to Text in Documents

See Also

Concepts

Word Object Model Overview

Office Solutions Development Overview