COMException when trying to start Ms Word through COM Interop

This forum is meant for questions and discussions about the X# language and tools
User avatar
robert
Posts: 4302
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

COMException when trying to start Ms Word through COM Interop

Post by robert »

Peter,

A quick workaround would be (for the document load):

Code: Select all

LOCAL oDoc := docxPfad AS OBJECT
wdApp:Documents:Open( REF oDoc ) 

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
robert
Posts: 4302
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

COMException when trying to start Ms Word through COM Interop

Post by robert »

Peter,
The issue is found and fixed in the next build.
When running in a non core dialect we are handling default parameters a bit different, since VO and Vulcan allowed to define default parameter values "in the middle", such as

Code: Select all

FUNCTION Test(par1 AS  STRING, par2 := "test" AS STRING,  par3 as LONG) AS LONG
..
RETURN 123

FUNCTION Start AS VOID
? Test("Foo",,345)

This is not allowed in C# / Roslyn.
And the code in which we take care of replacing missing parameters was somehow messing things up for "COM calls".

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
pemo18
Posts: 81
Joined: Fri Apr 27, 2018 10:38 am
Location: Germany

COMException when trying to start Ms Word through COM Interop

Post by pemo18 »

Hello Robert,

That is very good.

I know from my past as a VB- and C++ developer in the 90ties that COM interfaces ara ugly (to many pointers) and that the Office interop assemblies and the C# compiler do some tricks to make method calls with many default parameters as simple as possible.

In the meantime wil we use a C# class lib as a workaround.

Kind regards,
Peter
Post Reply