SearchContextChars
文字與擷取
描述
SearchContextChars 控制周邊區塊文字要擷取多少字元,適用於 SearchText、SearchTextEach、SearchTextBatch 以及有狀態的 BeginTextSearch / NextTextSearchHit 配對
為 0(預設)或負值時,ContextBefore 與 ContextAfter 欄位在每個傳回的 TPDFlibSearchHit 上都保持為空
為正值時,每個命中的 ContextBefore 至多保存 SearchContextChars 個字元,內容是 MatchText 裡緊鄰匹配之前的文字;ContextAfter 則至多保存 SearchContextChars 個緊接其後的字元。兩者都以可用的區塊文字為上限,因此靠近區塊開頭或結尾的命中會得到較短的上下文字串
語法
Delphi
Property TPDFlib.SearchContextChars: Integer Read FSearchContextChars Write FSearchContextChars;備註
呼叫搜尋方法前先設定此屬性;建立每個命中時各讀取一次。之後再改不會影響先前呼叫已傳回的命中
另請參閱
TPDFlibSearchHit, SearchText, SearchTextEach, SearchTextBatch, BeginTextSearch