Spread 8.0 Documentation
SSSearchCol Function
Support Options
DLL Reference > DLL Functions > SSSearchCol Function

Glossary Item Box

SSSearchCol Function


See Also    ActiveX

Applies To

fpSpread DLL control

Description

Searches a column for a specified value or string.

Syntax

C

SS_COORD SSSearchCol(HWND hWnd, SS_COORD lCol, SS_COORD lRowStart, SS_COORD lRowEnd, LPCTSTR lpszText, WORD wSearchFlags);

C++

SS_COORD TSpread::SearchCol(SS_COORD lCol, SS_COORD lRowStart, SS_COORD lRowEnd, LPCTSTR lpszText, WORD wSearchFlags);

Parameters

The following parameters are available:

Parameter Description
hWnd Window handle of the fpSpread control
lCol Column in which to search
lRowStart Row at which to start searching (row is not included in search)
lRowEnd Row at which to end searching
Set to SS_ALLROWS to search all rows.
lpszText Pointer to text for which to search
Search for an empty string to find empty cells.
wSearchFlags Specify how the search is performed
Use the (|) OR operator and combine the following values as indicated:
Constant
Description
SS_SEARCHFLAGS_NONE
Searches for exact match to complete text in cell, but ignores cases
SS_SEARCHFLAGS_GREATEROREQUAL
Search for text or a value greater than or equal to the specified text or value
SS_SEARCHFLAGS_PARTIALMATCH
Search for text that matches or partially matches the specified text
SS_SEARCHFLAGS_VALUE
Searches for text as if the text provided is equivalent to calling the SSGetValue function
SS_SEARCHFLAGS_CASESENSITIVE
Search for text that exactly matches the text and case specified
Use one of the following values:
SS_SEARCHFLAGS_SORTEDASCENDING
Use for searching in columns that are sorted in ascending order. The method works more rapidly on a sorted column if you specify this setting.
SS_SEARCHFLAGS_SORTEDDESCENDING
Use for searching in columns that are sorted in descending order. The method works more rapidly on a sorted column if you specify this setting.

Remarks

This function is applied to the current sheet setting unless you first call the SSSetSheet function to specify the sheet for which you are calling this function.

Call the SSSearchCol function to search for specified text or values in a column. To search for each occurrence of the text or value, call the SSSearchCol function and set the lRowStart parameter to –1. Then, call the SSSearchCol function again, specifying the returned row from the previous call as the value of the lRowStart parameter for each succeeding call. When the function returns –1, you have returned all occurrences of the text or value.

Note: Column headers are not searched.

Setting SS_SEARCHFLAGS_VALUE for the wSearchFlags parameter lets you search for a value using the unformatted value of the data. For example, suppose the sheet had a currency value such as "i 4,451,493.00" in a cell. If you wanted to search for the unformatted value, 4451493.00, you could specify that unformatted value as the search string, and set the wSearchFlags parameter to SS_SEARCHFLAGS_VALUE to find the currency value without specifying any formatting. This might be useful if you are unsure of the currency symbol or some other formatting character that will be used in the data.

Call the SSSearchRow function to search for text or a value in a particular row.

Return Value

Number of row containing the search text. Returns –1 if search text is not found.

See Also

Searching for Data

SSGetValue, SSSearchRow, SSSetSheet functions

ActiveX Correspondence

SearchCol method

Copyright © GrapeCity, inc. All rights reserved.