Programmatically reset ranges in Word documents
Use the SetRange method to resize an existing range in a Microsoft Office Word document.
Applies to: The information in this topic applies to document-level projects and VSTO Add-in projects for Word. For more information, see Features available by Office application and project type.
To reset an existing range
Set an initial range starting with the first seven characters in the document.
The following code example can be used in a document-level customization.
The following code example can be used in a VSTO Add-in. This code uses the active document.
Use SetRange to start the range at the second sentence and end it at the end of the fifth sentence.
Document-Level Customization Example
To reset an existing range in a document-level customization
The following example shows the complete example for a document-level customization. To use this code, run it from the
ThisDocument
class in your project.
VSTO Add-in example
To reset an existing range in a VSTO Add-in
The following example shows the complete example for a VSTO Add-in. To use this code, run it from the
ThisAddIn
class in your project.
Related content
Povratne informacije
https://aka.ms/ContentUserFeedback.
Stiže uskoro: Tijekom 2024. postupno ćemo ukinuti servis Problemi sa servisom GitHub kao mehanizam za povratne informacije za sadržaj i zamijeniti ga novim sustavom za povratne informacije. Dodatne informacije potražite u članku:Pošaljite i pogledajte povratne informacije za