SearchContextChars

文本与提取

描述

SearchContextChars 控制 SearchTextSearchTextEachSearchTextBatch 和有状态的 BeginTextSearch / NextTextSearchHit 对围绕每个匹配项捕获的周围块文本字符数

当为 0(默认值)或负数时,每个返回的 ContextBeforeContextAfter 字段,以及 TPDFlibSearchHit 均保持为空

为正值时,每个命中的 ContextBefore 最多保留 SearchContextChars 个紧邻 MatchText 内匹配项之前的字符,ContextAfter 最多保留其后的 SearchContextChars 个字符,两者都会限制为可用块文本,因此靠近块开始或结束处的匹配会产生较短的上下文字符串

语法

Delphi

Property TPDFlib.SearchContextChars: Integer Read FSearchContextChars Write FSearchContextChars;

备注

请在调用搜索方法前设置此属性;在构建每个命中项时,每个匹配项仅读取一次,改变它不会影响较早调用已返回的命中项

另请参阅

TPDFlibSearchHit, SearchText, SearchTextEach, SearchTextBatch, BeginTextSearch