SmartTagRecognizeContext.PersistTag(Int32, Int32, ISmartTagProperties) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Stores information about the smart tag. This type or member is intended to be used only in projects for the 2007 Microsoft Office system. Smart tags are deprecated in Office 2010..
public void PersistTag (int startIndex, int length, Microsoft.Office.Interop.SmartTag.ISmartTagProperties propertyBag = default);
abstract member PersistTag : int * int * Microsoft.Office.Interop.SmartTag.ISmartTagProperties -> unit
Public Sub PersistTag (startIndex As Integer, length As Integer, Optional propertyBag As ISmartTagProperties = Nothing)
Parameters
- startIndex
- Int32
The position in the paragraph where the smart tag begins.
- length
- Int32
The length of the smart tag.
- propertyBag
- ISmartTagProperties
A property bag containing key and value pairs for the token. Can be null
.
Exceptions
PersistTag(Int32, Int32, ISmartTagProperties) was not called from the Recognize(String, ISmartTagRecognizerSite, ISmartTagTokenList, SmartTagRecognizeContext) method.
Examples
The following code example demonstrates how to call PersistTag from an implementation of the Recognize method. This implementation compares each smart tag term to the contents of the paragraph. For each smart tag term in the paragraph, the code adds a custom smart tag property and then uses the PersistTag method to recognize the smart tag. This example assumes that you have added a reference to Microsoft.Office.Interop.SmartTag from the .NET tab of the Add Reference dialog box. This code example is part of a larger example provided for the ISmartTagExtension interface.
Remarks
Call PersistTag from an implementation of the Recognize method to indicate that the smart tag was found in the text. Use the propertyBag
parameter to commit any custom properties for the smart tag. You can use these properties to customize the action taken when an item from the smart tag shortcut menu is selected.