OLEAutoObject

We encourage new members to introduce themselves here. Get to know one another and share your interests.
Post Reply
User avatar
AlessandroV
Posts: 65
Joined: Tue Oct 31, 2017 9:07 am
Location: Italy

OLEAutoObject

Post by AlessandroV »

Hi to all, i have ported from VO:
oExcel := OLEAutoObject{"Excel.Application"}

it work until <<== ERROR

        oExcel:Caption := cFileName
        oExcel:visible := FALSE
        oWorkbooks := oExcel:Workbooks
        oWorkbook := oWorkbooks:Add() 
        
        oWorksheet := oWorkbook:Worksheets[1]    <<== ERROR
        oWorksheet:Name := "Tabella"

I got this error:
value in USUAL does not support indexed operations. The value needs to be an X# Array or implement the interface 'XSharp.IIndexedProperties'.

How is it possible to fix up and recover this code (i hope so) ? Or i have to rewrite all as C# interop ?

Thanks a lot Alessandro
User avatar
robert
Posts: 4243
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

OLEAutoObject

Post by robert »

Alessandro,
There is an Excel example in the Helpfile.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
AlessandroV
Posts: 65
Joined: Tue Oct 31, 2017 9:07 am
Location: Italy

OLEAutoObject

Post by AlessandroV »

ok thanks Robert, i have to use interop ....

Alessandro
User avatar
robert
Posts: 4243
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

OLEAutoObject

Post by robert »

Alessandro,
Yes, the interop DLLs are the way to go.
That will also provide you with code completion in the editor, compiler warnings for incorrect code and faster execution.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Post Reply