Re: Optional Variant
Cyril <[email protected]>
| Newsgroups | gmane.comp.windows.devel.jawin |
|---|---|
| Message-ID | <[email protected]> |
Hi, look at COM wrappers, which are genereted by MS C++ Visual Studio when in CPP code you include "#import" statement. These are TLH and TLI files where you find a number of usefull classes used like: _variant_t, _bstr_t, vtMissing, etc. The object vtMissing is a placeholder for a missing parameter. When I redesigned JAWIN code I have entered vtMissing object to my clone of JAWIN project (called NJAWIN). This is the solution. Vitaly "Rick Stoyle" <[email protected]> wrote in message news:LISTSERV%[email protected]... > The Microsoft documentation for the Excel.Workbook object lists the method > SaveAs as the following: > > SaveAs(Filename, FileFormat, Password, WriteResPassword, > ReadOnlyRecommended, CreateBackup, AddToMru, TextCodePage, > TextVisualLayout) > > All the parameters except Filename are listed as "Optional Variants" > meaning that if nothing is passed, a default value is assigned. I think a > better description would be a variant of the "No Parameter" type > or "Missing" like you specified. The _Workbook stub generated by jawin is > as follows: > > public void saveAs(Object Filename, Object FileFormat, Object Password, > Object WriteResPassword, Object ReadOnlyRecommended, Object CreateBackup, > int AddToMru, Object TextCodePage) throws COMException { } > > I have tried a few different things but keep getting errors back from the > COM object about the passed parameters. With another bridge I have used, > the following code worked: > > ... > wbook = new _Workbook("Excel.Sheet"); > Variant missing = new Variant(); > missing.noParam(); > wbook.saveAs(new String("C:\MyExcelFile.xls"), missing, missing, missing, > missing, missing, 1, missing); > > But, jawin does not have this type of method for the Variant Object. What > would the code look like to do the same with jawin. > > Rick >