OLEDBSimpleProvider::setVariant
Sets the value of the cell at the row and column indicated to the value of the variant supplied in pVar in the type requested by the value of fFormatted.
setVariant uses the following enumeration:
typedef enum OSPFORMAT {
OSPFORMAT_RAW = 0,
OSPFORMAT_DEFAULT = 0,
OSPFORMAT_FORMATTED = 1,
OSPFORMAT_HTML = 2,
};
where
Value |
Meaning |
OSPFORMAT_RAW
OSPFORMAT_DEFAULT |
Underlying column type should be used to set or get the value (the default). |
OSPFORMAT_FORMATTED |
Underlying column type should be converted to a string, and the string returned as a BSTR within the variant. |
OSPFORMAT_HTML |
Underlying column type should be converted to an HTML string. |
HRESULT setVariant (
LONGiRow,
LONGiColumn,
OSPFORMATfFormatted,
VARIANT*pVar);
Parameters
iRow
[in]
Position of the specified row.
iColumn
[in]
Position of the specified column.
fFormatted
[in]
Enumerated value that determines the format in which to return the cell value's underlying column type (see above table).
pVar
[in/out]
Based on the value specified in the pVar parameter, pVar will contain either:
-
A value with the underlying type of the column.
-
A string corresponding to the underlying type of the column.
-
An HTML fragment corresponding to the underlying type of the column.
Return Codes
S_OK
The method succeeded.
E_FAIL
The value could not be set, or the provider was read-only.
Notes
-
setVariant does not support references.
-
setVariant requires the following notifications: aboutToChangeCell and cellChanged.
-
With any formatting option, it is the provider's responsibility to perform the appropriate coercion to the underlying type of the column. In cases where the coercion cannot be successfully completed, an appropriate error code should be returned.
-
With the value OSPFORMAT_FORMATTED, the provider is free to interpret the input string however it sees fit. Alternatively, the provider may attempt to parse the input string and heuristically determine an appropriate data type and value to place into the cell; for example, when updating formatted spreadsheet cells.
-
When OSPFORMAT_HTML is requested, the provider may, at its option, return a plain string (for example, unadorned with HTML tags).
-
A data value of NULL is indicated by passing a Variant of type VT_NULL in pVar for any of the fFormatted types.
-
Do not use a value of -1 as an argument with the iRow and iColumn arguments of setVariant. You must set table cells individually; they cannot be set a row or column at a time.