Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| scripting:examples:text-highlight [2017/04/03 01:26] – created admin | scripting:examples:text-highlight [2018/01/10 20:36] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| <file javascript highlighting.hejs> | <file javascript highlighting.hejs> | ||
| + | var doc = ActiveDocument; | ||
| + | var sel = new Range(0, 0, doc.LineCount - 1, doc.GetLineLength(doc.LineCount - 1)); | ||
| + | var output = Application.Output(" | ||
| + | var results = doc.FindAll(" | ||
| + | var styleHigligh = new Style(" | ||
| + | styleHigligh.BoxColor = " | ||
| + | styleHigligh.BoxStyle = eBoxStyleRoundRect; | ||
| + | output.writeln(" | ||
| + | for (var i = 1, len = results.length; | ||
| + | output.writeln(" | ||
| + | doc.AddStyleRange(results[i], | ||
| + | } | ||
| + | doc.RemoveStyleRanges(null, | ||
| + | </ | ||
| + | |||
| + | <file javascript highlighting2.hejs> | ||
| // create the highlighting style, remember, it is alive whole editor session | // create the highlighting style, remember, it is alive whole editor session | ||
| var styleHighlight = new Style(" | var styleHighlight = new Style(" | ||