Reads a single value from an array into a number or string
[C++]
template< class T >
BOOL ReadGroupItem(
T& result,
const char* pszArgName,
long lItem,
const char* pszItemName,
CString& strError,
bool bStrict = false
) const;
template< class T >
BOOL ReadGroupItem(
T& result,
const char* pszArgName,
long lItem,
const char* pszItemName,
CXlOper& xloError,
bool bStrict = false
) const;
A buffer for the extracted value (if any).
The following types are directly supported for T:
The name of the argument that is being read. This will be used in any error strings that are generated.
The zero-based index of the item that is being extracted from the argument. If the argument is presented as a vector, then this value determines which item is extracted.
The name of the item that is being extracted from the argument. If the argument is presented as two-column array of labeled values, then this value will be used to search the left-hand column. It will also be used in any error strings that are generated.
Reference to an error string buffer. If the function fails for any reason, a useful error string will be placed here, e.g. "MyArgName: expected number in cell 3".
Flag controlling the conversion. If bStrict is false, then the function will attempt to convert the input cell to the type of result. If bStrict is true, then no conversion will be attempted.
If any error occurs, a description will be put into xloError. It can then conveniently be returned as the result of the add-in function.
The function returns TRUE if the conversion was successful,
FALSE if it failed for any reason. If it fails, an explanatory error string will be written
to strError or xloError.
This should be returned to the user.
This function is used (particularly in generated code) to extract
the various items from a compressed group argument. The user may present the grouped argument in one of two forms:
If the argument cannot be found, then an error string will be set and FALSE will be returned.
If the argument is found, then the function will attempt to convert it to the required type. If this conversion fails, then the function will return FALSE and set the error string.
See Compressed Groups in the User Guide for more information about the permitted layouts of the input argument.
This function should be used in preference to the deprecated function
ReadVectorItem().
Header: xllplus.h
COper Class
| COper Methods
| COper::ReadVectorItem()
| Compressed Groups