Class FindResult
java.lang.Object
com.independentsoft.office.spreadsheet.FindResult
A single match of a find operation. A result knows the objects holding the matched
text, so the text can be replaced in place.
-
Method Summary
Modifier and TypeMethodDescriptionbooleandelete()Deletes the matched text.getCell()Gets the cell the match belongs to or null if the match does not belong to a cell.Gets the comment the match belongs to or null if the match does not belong to a comment.Gets the whole text of the cell, comment, header, footer or shape paragraph the match belongs to.intGets the number of matched characters.getRun()Gets the first run of the match or null if the matched text is not stored in runs.getRuns()Gets all runs the match spans.getSheet()Gets the sheet the match belongs to.intgetStart()Gets the index of the match in the text of the cell, comment, header, footer or shape paragraph.getStory()Gets the part of the workbook the match was found in.getText()Gets the matched text.Gets the worksheet the match belongs to or null if the match does not belong to a worksheet.booleanReplaces the matched text with the specified run.booleanReplaces the matched text with the specified text.booleanReplaces the matched text with the specified runs.toString()Returns a string that represents the currentFindResult.
-
Method Details
-
replace
Replaces the matched text with the specified text. The format of the cell and the properties of all runs remain unchanged.- Parameters:
newText- the replacement text- Returns:
- true if the text was replaced
-
replace
Replaces the matched text with the specified run. A cell which holds plain text is converted into a rich text cell, the text before and after the match keeps its format.- Parameters:
run- theRunthat replaces the matched text- Returns:
- true if the text was replaced
-
replace
Replaces the matched text with the specified runs.- Parameters:
runs- theRunobjects that replace the matched text- Returns:
- true if the text was replaced
-
delete
public boolean delete()Deletes the matched text.- Returns:
- true if the text was deleted
-
toString
Returns a string that represents the currentFindResult.- Overrides:
toStringin classObject- Returns:
- a string that represents the current
FindResult
-
getElement
- Returns:
- the object holding the matched text
-
getText
Gets the matched text.- Returns:
- the matched text
-
getHostText
Gets the whole text of the cell, comment, header, footer or shape paragraph the match belongs to.- Returns:
- the whole text of the cell, comment, header, footer or shape paragraph
-
getSheet
Gets the sheet the match belongs to.- Returns:
- the sheet the match belongs to
-
getWorksheet
Gets the worksheet the match belongs to or null if the match does not belong to a worksheet.- Returns:
- the worksheet the match belongs to or null
-
getCell
Gets the cell the match belongs to or null if the match does not belong to a cell.- Returns:
- the cell the match belongs to or null
-
getComment
Gets the comment the match belongs to or null if the match does not belong to a comment.- Returns:
- the comment the match belongs to or null
-
getRun
Gets the first run of the match or null if the matched text is not stored in runs.- Returns:
- the first run of the match or null
-
getRuns
Gets all runs the match spans.- Returns:
- all runs the match spans
-
getStart
public int getStart()Gets the index of the match in the text of the cell, comment, header, footer or shape paragraph.- Returns:
- the index of the match
-
getLength
public int getLength()Gets the number of matched characters.- Returns:
- the number of matched characters
-
getStory
Gets the part of the workbook the match was found in.- Returns:
- the part of the workbook the match was found in
-