passing optional parameters

Amardeep Singh <[email protected]>
Newsgroups gmane.comp.windows.devel.jawin
Message-ID <[email protected]>
Hi,

I am using jawin type browser for generating interface to excel type library.

How do i pass optional parameters in method calls?

For eg., It generated the following signature for Workbooks.open()

public Workbook Open(String Filename,Variant UpdateLinks,Variant ReadOnly,
                 Variant Format,Variant Password,Variant WriteResPassword,
                 Variant IgnoreReadOnlyRecommended,Variant Origin,
                 Variant Delimiter,Variant Editable,Variant Notify,
                 Variant Converter,Variant AddToMru) throws COMException
{
  Workbook res = new Workbook();
  DispatchPtr dispPtr = (DispatchPtr)invokeN("Open", new Object[]
{Filename, UpdateLinks,
    ReadOnly, Format, Password, WriteResPassword, IgnoreReadOnlyRecommended,
    Origin, Delimiter, Editable, Notify, Converter, AddToMru});
  res.stealUnknown(dispPtr);
  return res;
}

Now suppose, i want to invoke this method passing only the filename.
What should i pass as the value of other variant parameters?

I tried passing empty = new Variant() and setting empty.vt =
vartypes.VT_NULL or VT_EMPTY. It didn't work. I received the following
COMException:

org.jawin.COMException: 8000ffff: A VT_VARIANT must be combined with
VT_BYREF (base vartype 12)
        at org.jawin.marshal.GenericStub.dispatchInvoke0(Native Method)
        at org.jawin.marshal.GenericStub.dispatchInvoke(GenericStub.java:201)
        at org.jawin.DispatchPtr.invokeN(DispatchPtr.java:587)
        at org.jawin.DispatchPtr.invokeN(DispatchPtr.java:555)
        at com.t.Workbooks.Open(Workbooks.java:267)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.