logo       

Re: Word: Documents.Add and Arrays: msg#00024

windows.devel.jawin

Subject: Re: Word: Documents.Add and Arrays

sorry, wrong COMException. That's the correct one:

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 org.jawin.msword.stubs.Documents.Add(Documents.java:279)
...


-------- Original-Nachricht --------
Datum: Tue, 25 Jul 2006 10:15:37 -0400
Von: Florian Schmitt <florian.schmitt@xxxxxxx>
An: JAWIN@xxxxxxxxxxxxxxxxxxx
Betreff: [JAWIN] Word: Documents.Add and Arrays

> Hi,
>
> sorry if this question is a faq, but i'm in trouble with invoking the
> Function Word.Documents.Add. That function takes four arguments, all of
> them
> optional and all of them of Type Variant[]. How do i set these arguments
> (important for me is only the first one, taking the document template)?
>
> _Document oDocument;
> Documents docs = app.getDocuments();
>
> Variant[] varVorlage = new Variant[1];
> varVorlage[1] = new Variant();
> varVorlage[1].vt = VarTypes.VT_BSTR;
> varVorlage[1].bstrVal = VORBLVORL;
>
> Variant[] varTempl = new Variant[1];
> varTempl[0] = new Variant();
> varTempl[0].vt = VarTypes.VT_BOOL;
> varTempl[0].boolVal = false;
>
> Variant[] varTyp = new Variant[1];
> varTyp[0] = new Variant();
> varTyp[0].vt = VarTypes.VT_INT;
> varTyp[0].intVal = WdNewDocumentType.wdNewBlankDocument;
>
> Variant[] varTempl2 = new Variant[1];
> varTempl2[0] = new Variant();
> varTempl2[0].vt = VarTypes.VT_BOOL;
> varTempl2[0].boolVal = true;
>
> oDocument = docs.Add(varVorlage, varTempl, varTyp , varTempl2);
>
> leads to a COMException:Unable to serialize variant.
>
> Any hints or any working example?
>
>
> Thank you
> Florian
>

--
http://www.florian-schmitt.net



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise