SmartTagRecognizeContext.PersistTag(Int32, Int32, ISmartTagProperties) 方法


儲存智慧標籤的相關資訊。Stores information about the smart tag. 此類型或成員僅適用於 2007 Microsoft Office 系統的專案。This type or member is intended to be used only in projects for the 2007 Microsoft Office system. 智慧標籤在 Office 2010 中已被取代。Smart tags are deprecated in Office 2010...

public void PersistTag (int startIndex, int length, Microsoft.Office.Interop.SmartTag.ISmartTagProperties propertyBag = null);



段落中智慧標籤開始的位置。The position in the paragraph where the smart tag begins.


智慧標籤的長度。The length of the smart tag.


屬性包包含權杖的索引鍵和值組。A property bag containing key and value pairs for the token. 可以是 nullCan be null.



下列程式碼範例示範如何 PersistTag 從方法的實作為呼叫 RecognizeThe 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. 針對段落中的每個智慧標籤詞彙,程式碼會加入自訂智慧標籤屬性,然後使用 PersistTag 方法來辨識智慧標籤。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. 這個範例假設您已從 [加入參考] 對話方塊的 [ .net ] 索引標籤中,新增智慧標籤的參考。This example assumes that you have added a reference to Microsoft.Office.Interop.SmartTag from the .NET tab of the Add Reference dialog box. 這個程式碼範例是針對介面提供之較大範例的一部分 ISmartTagExtensionThis code example is part of a larger example provided for the ISmartTagExtension interface.


PersistTag從方法的實作為呼叫 Recognize ,表示在文字中找到智慧標籤。Call PersistTag from an implementation of the Recognize method to indicate that the smart tag was found in the text. 使用 propertyBag 參數來認可智慧標籤的任何自訂屬性。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.