fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: How to connect with Excel (via OLE)

How to connect with Excel (via OLE) 7 months 12 hours ago #21

  Karl-Heinz's Avatar Karl-Heinz Offline Posts: 211
Hi Robert,

you are right !

the "SDK Tools Dir" setting ( see: XIDE "Tools" -> "Preferences" -> "Folders" Tabpage ) pointed to the 2.0 SDK Tools ... Now it points to the 4.6.1 dir and the created excel.dll shows CLR4.

very nice :-)


BTW. The tlbimp.exe throws this warning:

TlbImp : warning TI3002 : Importing a type library into a platform agnostic assembly. This can cause errors if the type library is not truly platform agnostic.

not sure how to interpret this ?


regards
Karl-Heinz

Please Log in or Create an account to join the conversation.

How to connect with Excel (via OLE) 7 months 11 hours ago #22

  Chris's Avatar Chris Offline Posts: 1056
Hi Karl-Heinz,

I assume it means that it is creating an AnyCPU assembly, but not sure. Maybe it means that if you try to use it under Mono or other platform it will possibly not work.

Chris
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

How to connect with Excel (via OLE) 7 months 10 hours ago #23

  Karl-Heinz's Avatar Karl-Heinz Offline Posts: 211
Hi Chris,

when i fill the "Arguments:" sle with "/machine:x86" the TI3002 warning is gone, and ilspy shows correctly:

// Architecture: x86

instead of:

// Architecture: AnyCPU (64-bit preferred)


when i try "/machine:x64"

TlbImp : error TI2010 : A single valid machine type compatible with the input type library must be specified.

is thrown. Makes sense, as i do have a 32bit office only.


regards
Karl-Heinz

Please Log in or Create an account to join the conversation.

How to connect with Excel (via OLE) 7 months 8 hours ago #24

  Chris's Avatar Chris Offline Posts: 1056
Very good point!
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

How to connect with Excel (via OLE) 7 months 8 hours ago #25

  FFF's Avatar FFF Offline Posts: 532
Motivated by this thread, i had a look on my machine - and i find TEN tlbimp.exe files 5 each in a \64 subnode, one each for "Windows", FX4.0, 4.5.1, 4.6, 4.6.1. Great godness... All of them below program(x86).
What a mess....

Please Log in or Create an account to join the conversation.

How to connect with Excel (via OLE) 7 months 8 hours ago #26

  wriedmann's Avatar wriedmann Offline Posts: 1491
Hi Karl,

I have 14 of them, 2 for every version of the SDK (x86 and x64, I think).

Maybe everyone of them creates different code for different versions of the .NET Framework.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

How to connect with Excel (via OLE) 7 months 5 hours ago #27

  FFF's Avatar FFF Offline Posts: 532
Brrr.
@Chris, for now i entered in the "Tools" folder: C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\x64", do you think that's a "good" idea?

Karl

Please Log in or Create an account to join the conversation.

How to connect with Excel (via OLE) 7 months 3 hours ago #28

  Chris's Avatar Chris Offline Posts: 1056
Yeah, I think it should be fine, actually probably all versions >=4.5 should be fine anyway I think. But in case there's any problem, it's easy to change it, this is why I made it a user's choice to select the SDK tools folder he want to use, than having the IDE decide this automatically...
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

How to connect with Excel (via OLE) 6 months 4 weeks ago #29

  softdevo@tiscali.it's Avatar softdevo@tiscali.it Offline Posts: 80
I use NPOI.dll, it is not necessary that Excel is installed on the machine, until today I have always done everything I need: create Excel files, add sheets, insert data and formulas, set properties of cells etcc.

Danilo

Please Log in or Create an account to join the conversation.

How to connect with Excel (via OLE) 6 months 4 weeks ago #30

  Karl-Heinz's Avatar Karl-Heinz Offline Posts: 211
and

4.7
4.7.1
4.7.2

brings 3 x 2 more ;-)

Please Log in or Create an account to join the conversation.

How to connect with Excel (via OLE) 6 months 4 weeks ago #31

  Karl-Heinz's Avatar Karl-Heinz Offline Posts: 211
Hi Chris,

i´m wondering what the "Namespace:" sle content is used for ? The "Name:" content is the name of the subdir to create, and the assembly name to create is always "excel.dll". The "Namespace:" sle may not be empty, but i don´t see where a content like "dfhjjkhhlkkk" is used. Neither becomes the name of the dll "dfhjjkhhlkkk.dll" nor do i see anywhere in the created dll a reference to "dfhjjkhhlkkk" ?

regards
Karl-Heinz

Please Log in or Create an account to join the conversation.

How to connect with Excel (via OLE) 6 months 4 weeks ago #32

  Chris's Avatar Chris Offline Posts: 1056
Hi Karl-Heinz,

Karl-Heinz wrote: i´m wondering what the "Namespace:" sle content is used for ? The "Name:" content is the name of the subdir to create, and the assembly name to create is always "excel.dll". The "Namespace:" sle may not be empty, but i don´t see where a content like "dfhjjkhhlkkk" is used. Neither becomes the name of the dll "dfhjjkhhlkkk.dll" nor do i see anywhere in the created dll a reference to "dfhjjkhhlkkk" ?


I was wondering the same thing during my tests in the last couple days! :)

What the IDE does, is to supply tlbimp.exe with a parameter /namespace:<namespace> command line option when calling it, I am pretty sure this worked at some time in the past and I think it was actually mandatory to specify the namespace. But indeed, I see now it gets ignored...

Or maybe it's just specific to the Office interop libraries, maybe because those are already created somewhere in the machine (hence the warning), the tool does not really generate a new one, but just makes a copy of the existing one. Pure speculation, but I am saying that because I just tested it with other COM libs, and I see the namespace parameter is being respected with them..

Chris
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

How to connect with Excel (via OLE) 6 months 4 weeks ago #33

  Karl-Heinz's Avatar Karl-Heinz Offline Posts: 211
Hi Chris,

i´ve tried it with a com dll that i´m using to read/write excel files in VO, and the given Namespace is correctly written to the dll.

BTW. Til now i ignored this warning if a excel.dll is created:

TlbImp : warning TI3001 : Primary interop assembly 'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C' is already registered for type library 'C:\Program Files\Microsoft Office 15\Root\Office15\EXCEL.EXE'.

I didn´t dive in deeper, but maybe indicates such a warning that a given namespace is ignored ?

regards
Karl-Heinz

Please Log in or Create an account to join the conversation.

How to connect with Excel (via OLE) 6 months 4 weeks ago #34

  Karl-Heinz's Avatar Karl-Heinz Offline Posts: 211
Hi Chris,

I think it's not necessary to open a new thread, because my question about "using and alias names" fits well with Excel.

In a earlier thread i found the hint how to give a namespace an alias

www.xsharp.info/forum/public-product/338...ting-vo-code?start=0

but i can´t get it to work.


// USING Excel := Microsoft.Office.Interop.Excel
USING ExcelAlias := Microsoft.Office.Interop.Excel
  

FUNCTION Start() AS VOID 
	
// LOCAL oWorkbooks AS Excel.Workbooks   // error
LOCAL oWorkbooks AS ExcelAlias.Workbooks  // error


// This compiles 
// LOCAL oWorkbooks AS Microsoft.Office.Interop.Excel.Workbooks

wait


RETURN 


It ends up that the namespace "ExcelAlias" or "Excel" can´t be found. Must i set e.g. any specific compiler switches to make it work ?

regards
Karl-Heinz

Please Log in or Create an account to join the conversation.

How to connect with Excel (via OLE) 6 months 4 weeks ago #35

  Chris's Avatar Chris Offline Posts: 1056
Hi Karl-Heinz,

Thanks, this looks like a bug to me, will log a report about this. Can't think of a workaround unfortunately, unless Robert has an idea.

About tlbimp, yeah, that was my thought, too, that the warning implies that actually no real new dll is created, it just copies the already existing one with the original namepsace, so your namespace gets ignored as well.

Chris
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2