[]
Use this class to configure how IRange.find(Object,IRange,FindOptions) and IRange.find(Object,FindOptions) search a range, including where to search, how to match content, the search order and direction, case sensitivity, byte matching, and an optional display format filter.
worksheet.getRange("A1").setValue("Total");
worksheet.getRange("A2").setFormula("=A1");
FindOptions options = new FindOptions();
options.setLookIn(FindLookIn.Formulas);
options.setLookAt(LookAt.Part);
IRange found = worksheet.getRange("A1:A2").find("A1", options);
final LookAtIRange.find(Object,IRange,FindOptions) or IRange.find(Object,FindOptions).final FindLookInfinal booleanIRange.find(Object,IRange,FindOptions) or IRange.find(Object,FindOptions).final booleanfinal SearchDirectionIRange.find(Object,IRange,FindOptions).final IDisplayFormatfinal SearchOrderIRange.find(Object,IRange,FindOptions) or IRange.find(Object,FindOptions).final voidIRange.find(Object,IRange,FindOptions) or IRange.find(Object,FindOptions).final voidsetLookIn(FindLookIn value) final voidsetMatchByte(boolean value) IRange.find(Object,IRange,FindOptions) or IRange.find(Object,FindOptions).final voidsetMatchCase(boolean value) final voidfinal voidsetSearchFormat(IDisplayFormat value) final voidsetSearchOrder(SearchOrder value) IRange.find(Object,IRange,FindOptions) or IRange.find(Object,FindOptions).This property returns the current FindLookIn setting used by IRange.find(Object,IRange,FindOptions) to determine whether the search targets values, formulas, comments, or other supported content types.
worksheet.getRange("A1").setValue("Hello World");
worksheet.getRange("A2").setFormula("=\"Hello\"&\" World\"");
FindOptions options = new FindOptions();
options.setLookIn(FindLookIn.Formulas);
FindLookIn lookIn = options.getLookIn();
worksheet.getRange("A1:A2").find("Hello", null, options);
FindLookIn setting. Returns null if no search target has been specified.Use this property to control where IRange.find(Object,IRange,FindOptions) or IRange.find(Object,FindOptions) searches, such as formulas, displayed text, values, or comments. The specified FindLookIn value is stored on this FindOptions instance and is later used by the range search operation.
worksheet.getRange("A1").setValue("Hello World");
worksheet.getRange("A2").setFormula("=\"Hello\"&\" World\"");
FindOptions options = new FindOptions();
options.setLookIn(FindLookIn.Formulas);
worksheet.getRange("A1:A2").find("Hello", null, options);
value - The FindLookIn value that specifies the type of data to search in.IRange.find(Object,IRange,FindOptions) or IRange.find(Object,FindOptions). The returned LookAt value controls whether a find operation matches the whole cell content or only part of it. This method returns the current value configured by setLookAt(LookAt).
worksheet.getRange("A1").setValue("Hello World");
FindOptions options = new FindOptions();
options.setLookAt(LookAt.Whole);
LookAt lookAt = options.getLookAt();
worksheet.getRange("A1:A1").find("Hello World", options);
LookAt setting. Returns null if no value has been specified.IRange.find(Object,IRange,FindOptions) or IRange.find(Object,FindOptions). Use this property to control whether a find operation matches the whole cell content or only part of it. The specified LookAt value is stored on this FindOptions instance and is later used by the range search operation.
worksheet.getRange("A1").setValue("Hello World");
worksheet.getRange("A2").setValue("Hello");
FindOptions options = new FindOptions();
options.setLookAt(LookAt.Whole);
worksheet.getRange("A1:A2").find("Hello", null, options);
value - The LookAt setting that controls whole-content or partial-content matching. Specify LookAt.Whole to match the entire cell content or LookAt.Part to match part of it; null clears the current setting.IRange.find(Object,IRange,FindOptions) or IRange.find(Object,FindOptions). The returned SearchOrder value determines whether the search scans across rows first( SearchOrder.ByRows) or down columns first ( SearchOrder.ByColumns). This method returns the current value configured by setSearchOrder(SearchOrder).
worksheet.getRange("A1:B2").setValue(new Object[][] {
{"Name", "Value"},
{"Test", "Value"}
});
FindOptions options = new FindOptions();
options.setSearchOrder(SearchOrder.ByColumns);
SearchOrder searchOrder = options.getSearchOrder();
worksheet.getRange("A1:B2").find("Value", options);
SearchOrder setting. Returns null if no value has been specified.IRange.find(Object,IRange,FindOptions) or IRange.find(Object,FindOptions). Use this property to control whether a find operation scans across rows first or down columns first. Specify SearchOrder.ByRows to search across each row before moving to the next row, or SearchOrder.ByColumns to search down each column before moving to the next column. The specified SearchOrder value is stored on this FindOptions instance and is later used by the range search operation.
worksheet.getRange("A1").setValue("Hello");
worksheet.getRange("B1").setValue("Hello");
FindOptions options = new FindOptions();
options.setSearchOrder(SearchOrder.ByColumns);
worksheet.getRange("A1:B1").find("Hello", null, options);
value - The SearchOrder setting that controls the search traversal order. Specify SearchOrder.ByRows to search by rows or SearchOrder.ByColumns to search by columns; null clears the current setting.IRange.find(Object,IRange,FindOptions). The returned value determines whether the search proceeds forward ( SearchDirection.Next) or backward ( SearchDirection.Previous) through the range.
worksheet.getRange("A1").setValue("Hello World");
FindOptions options = new FindOptions();
options.setSearchDirection(SearchDirection.Previous);
SearchDirection searchDirection = options.getSearchDirection();
worksheet.getRange("A1:A1").find("Hello", null, options);
null if no search direction has been set.This option determines whether IRange.find(Object,IRange,FindOptions) searches forward or backward through the target range. If the after argument is not specified when calling find, the search starts at the upper-left cell for SearchDirection.Next and at the bottom-right cell for SearchDirection.Previous.
worksheet.getRange("A1").setValue("Hello");
worksheet.getRange("A2").setValue("Hello");
FindOptions options = new FindOptions();
options.setSearchDirection(SearchDirection.Previous);
worksheet.getRange("A1:A2").find("Hello", null, options);
value - The search direction to use. Must be a valid SearchDirection value.This property returns the current setting used by IRange.find(Object,IRange,FindOptions) and IRange.find(Object,FindOptions) to determine whether uppercase and lowercase letters are treated as different characters. The default value is false.
worksheet.getRange("A1").setValue("Hello World");
FindOptions options = new FindOptions();
options.setMatchCase(true);
boolean matchCase = options.getMatchCase();
worksheet.getRange("A1:A1").find("Hello", options);
true if searches are case-sensitive; otherwise, false.This property sets the current setting used by IRange.find(Object,IRange,FindOptions) and IRange.find(Object,FindOptions) to determine whether uppercase and lowercase letters are treated as different characters. The default value is false.
worksheet.getRange("A1").setValue("Hello World");
FindOptions options = new FindOptions();
options.setMatchCase(true);
worksheet.getRange("A1:A1").find("Hello", options);
value - true if searches are case-sensitive; otherwise, false.IRange.find(Object,IRange,FindOptions) or IRange.find(Object,FindOptions). If this property is true, double-byte characters match only double-byte characters. If this property is false, double-byte characters can match their single-byte equivalents. This method returns the current value configured by setMatchByte(boolean).
worksheet.getRange("A1").setValue("A");
worksheet.getRange("A2").setValue("A");
FindOptions options = new FindOptions();
options.setMatchByte(true);
boolean matchByte = options.getMatchByte();
worksheet.getRange("A1:A2").find("A", options);
true if double-byte characters match only double-byte characters; false if they can match their single-byte equivalents.IRange.find(Object,IRange,FindOptions) or IRange.find(Object,FindOptions).
worksheet.getRange("A1").setValue("A");
worksheet.getRange("A2").setValue("A");
FindOptions options = new FindOptions();
options.setMatchByte(true);
worksheet.getRange("A1:A2").find("A", options);
value - true if double-byte characters match only double-byte characters; false if they can match their single-byte equivalents.Returns the IDisplayFormat used to match cell formatting during a find operation. The default value is null.
worksheet.getRange("A1").setValue(100);
worksheet.getRange("A1").setNumberFormat("$0.00");
FindOptions options = new FindOptions();
options.setSearchFormat(worksheet.getRange("A1").getDisplayFormat());
IDisplayFormat searchFormat = options.getSearchFormat();
null if no format criteria has been set.Use this method to limit a find operation to cells whose displayed formatting matches the specified IDisplayFormat. The default search format is null.
worksheet.getRange("A1").setValue("Text");
worksheet.getRange("A2").setValue("Text");
worksheet.getRange("A2").getInterior().setColor(Color.GetRed());
FindOptions options = new FindOptions();
options.setSearchFormat(worksheet.getRange("A2").getDisplayFormat());
worksheet.getRange("A1:A2").find("*", null, options);
value - The display format to match during the search, typically obtained from IRange.getDisplayFormat(); null clears the search format criterion.