Skip to content

Search_and_change_font_attributes

Jochen Staerk edited this page Dec 21, 2015 · 1 revision

Source http://ubion.ion.ag/mainForumFolder/noa_forum/0073

       SearchDescriptor searchDescriptor = new SearchDescriptor("YourWord");
       searchDescriptor.setIsCaseSensitive(true);
       ISearchResult searchResult = textDocument.getSearchService().findFirst(searchDescriptor);
       ITextRange textRanges = null;
       if(!searchResult.isEmpty()) {
            textRanges = searchResult.getTextRanges();
            ITextCursor cursor = textDocument.getTextService().getText().getTextCursorService().getTextCursor();
            cursor.gotoRange(textRanges[0],false);
            cursor.getCharacterProperties().setFontBold(false);
            cursor.getCharacterProperties().setFontItalic(true);
            cursor.getCharacterProperties().setFontSize(6);
       }                
Clone this wiki locally