Reference |
COM interfaces are declared using an automation language. Because that language is neutral to the entire set of programming languages that support automation-enabled components, the syntax details are left apart.
Because of this, a VB developer for instance may find it rather difficult to get the most of those interfaces because they are not expressed with the VB language syntax.
As a matter of simplifying the readability and the use of those interfaces, below are simple rules that apply according to your preferred programming language.
1) VB developer
propput
not propget
, then it's a method callable using the regular VB function call mechanism (parenthesis must be used if there is more than one parameter)
propget
, then it behaves like a regular VB property
propput
and has only one parameter, then it behaves like a regular VB property
propput
and has more than one parameters, then it behaves like an extended VB property. To use it, parenthesis must enclose the n-1
first parameters as in myproperty(param_1, param_2, ...) = param_n
. If you read HRESULT Label([in]int row, [in]int col, [in]BSTR label);
then you should write Label(row, col) = label;
[in]
is an input parameter. It must be passed in, unless it is explicitely declared [optional]
[out, retval]
is a return value. If you see HRESULT NewStyle([out, retval] IXlsStyle** style);
then you should write code like :
Dim style As IXlsStyle Set style = NewStyle
2) C# developer
propput
nor propget
, then it's a method callable using the regular C# method call mechanism
propget
, then it behaves like a regular C# property. The get_
prefix must be used. For instance, if you read [propget] Label()
then you should write get_Label()
propput
and has only one parameter, then it behaves like a regular C# property
propput
and has more than one parameters, then it behaves like a regular C# method with a set_
prefix. If you read HRESULT Label([in]int row, [in]int col, [in]BSTR label);
then you should write set_Label(row, col, label);
style.Pattern.BackgroundColor = 0xFFFFBB;
[in]
is an input parameter. It must be passed in, unless it is explicitely declared [optional]
[out, retval]
is a return value. If you see HRESULT NewStyle([out, retval] IXlsStyle** style);
then you should write IXlsStyle style = wksht.NewStyle();
enumColorPalette
type, just type xlsgen.enumColorPalette.
and let intellisense drive you
3) C/C++ developer
If you use raw C/C++ code then you can skip this section. The rules apply to a C/C++ developer using smart pointers.
propput
nor propget
, then it's a method callable using the regular C/C++ method call mechanism
propget
, then it behaves like a regular C/C++ property.
propput
and has only one parameter, then it behaves like a regular C/C++ property
propput
and has more than one parameters, then it behaves like an extended C/C++ property. Use closed brackets to enclose the first n-1
parameters. If you read HRESULT Label([in]int row, [in]int col, [in]BSTR label);
then you should write Label[row][col] = label;
style->Pattern->BackgroundColor = 0xFFFFBB;
[in]
is an input parameter. It must be passed in, unless it is explicitely declared [optional]
[out, retval]
is a return value. If you see HRESULT NewStyle([out, retval] IXlsStyle** style);
then you should write xlsgen::IXlsStylePtr style = wksht->NewStyle();
L
as, in L"hello world!"
. If the string is dynamically constructed and is initially not unicode, then you must convert it using either the _bstr_t
helper, or the WIN32 API function call ::MultiByteToWideChar(...)
.
All HRESULT error values returned by xlsgen are standard Win32 error values (see winerror.h from the Platform SDK) : a value of 0 means OK, a non-zero value means an error occured. xlsgen however creates five additional HRESULT values :
Description | Value | Comment |
HRESULT_ERROR_EXCEL95 | 0x80072000 | Excel 95 files are not supported. The file format is different than the format in Excel 97/2000/XP/2003/2007. |
HRESULT_ERROR_PASSWORDPROTECTED | 0x80072001 | The file cannot be opened because it's password-protected. |
HRESULT_ERROR_ISO29500 | 0x80072002 | The file cannot be opened because it uses the strict ISO29500 file format. |
HRESULT_ERROR_UNEXPECTEDFILEFORMAT | 0x80072003 | The file cannot be opened because it uses an unknown file format. |
HRESULT_ERROR_MALFORMEDXLSXFILE | 0x80072004 | The file cannot be opened because it uses a malformed XLSX file. |