.Net 4.0 Assemblies and VB 2010

May 30, 2011 at 9:13 AM

Hi,

first - thank you for this really great tool! It works really amazing and help me a lot.

But now my questions ;-)

  1. You have changed the signitures for the functions/subs to have optional values. This seems not work with VB 2010. Your Vb examples in the 4.0 folders are not working too. Is this correct?
  2. Is Excel already complete? I am missing the Application.ActiveWindow.ToggleRibbon Method?

I am trying to create 'ViewerControls' for the Office formats in my app. Until now this works really great with your NetOffice!!!

 

Thanks for your work, and keep on going!!

 

Michael

Coordinator
May 30, 2011 at 1:51 PM

Hello Michael,

1. Yes i see now VB.NET in 4.0 has problems(damn it). many thanks for request. will be fixed today! 2 registered problems. optional params conflict and corrupt project files.

2. I'm suprised. Application.ActiveWindow is from type Window. Window has no method ToggleRibbon. i take a look in the Excel 14.0 Type Library with OLE/COM Viewer from Microsoft and i can't find  them.
   can you tell me more about? your excel version and development environment (interop, pia, customwrapper or vsto,...) 

Sebastian

May 30, 2011 at 2:03 PM

Hi Sebastian,

shame on me, I thought MS will do it equal in each application. But Excel lacks this function :-((

Why on Earth must it be different in Word and Excel. So in Excel I have to use:

Application.ExecuteExcel4Macro "Show.ToolBar(""Ribbon"", False)" or Application.ExecuteExcel4Macro "Show.ToolBar(""Ribbon"", True)" to hide and show the Ribbon.

 

Sorry for the wrong alert!!

 

Thanks for fixing the bugs with .Net 40 and VB!

 

Michael

Coordinator
May 30, 2011 at 6:07 PM
Edited May 30, 2011 at 6:08 PM

Okay now i see the problem with optional parameters in VB.Net. The language has a very bad optional support. c# does it much better.

SupportByLibrary("Excel", 9,10,11,12)]
object BorderAround(object lineStyle, NetOffice.ExcelApi.Enums.XlBorderWeight weight, NetOffice.ExcelApi.Enums.XlColorIndex colorIndex, object color=null)

SupportByLibrary("Excel", 14)] 
object BorderAround(object lineStyle, NetOffice.ExcelApi.Enums.XlBorderWeight weight, NetOffice.ExcelApi.Enums.XlColorIndex colorIndex, object color=null, object themeColor=null)


The same function 2 times but in the second prototype with one more optional parameter. Visual Basic can't handle this. no problem for c# of course.
visual basic hide the function in IDE and tolds you function is not unique. i see no other way as remove the optional parameter support in netoffice :(

May 30, 2011 at 7:40 PM

I think this seems to be the reason. Maybe you can leave the 4.0 path and create just one path as copy from 3.5 targetting 4.0?

Maybe in the Next version vb is able to use functions with optional parameters that are the same ;-)

Coordinator
May 30, 2011 at 7:59 PM

i have removed the optional attribute in .NET4 Api source now and commit is currently in progress(more than 4200 files).
tonight i do release 0.8 with fixed .net 4 source and vb.net examples and some minor improvements.
looks good at the moment!