PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WD20] .Net Control (Gembox)
[WD20] .Net Control (Gembox)
Iniciado por guest, 30,ago. 2015 22:08 - 8 respuestas
Publicado el 30,agosto 2015 - 22:08
Hi
I'm trying to add the Gembox spreadsheet to a window.

I added the .Net control and added the DLLs to the project. In the parameters Windev requires 2 items, the assembly name & the Winform class & that is where I come unstuck! All the documentation for the object simply suggests the assembly is all that is required but Windev won't allow that.

No matter what I assign as the Winform I get 2 errors displayed in the control when I try to run it; "Unable to build object" and "Unable to invoke <.ctor()> method of type. (The part varies depending on the Winform class selected). From testing I am certain these errors are propagated when the control is initilaised and before any license checking is done.

It's probably something very simple I've missed (first attempt at .Net control on a window).

Thanks

David
Publicado el 31,agosto 2015 - 23:36
Hello David

I haven't used the Excel Gembox but The Word one works peferctly so I imagine that the setup would bethe same so have you copied the Gembox dll into the Windows assembly folder ?

Mario at Gembox is really helpful so an email to him may also be useful to try.

Regards
Al
Publicado el 01,septiembre 2015 - 06:08
Hi Al
Thanks,the dll is there. I just tried the WP one & I have the same problem with it. I'm sure it's something I'm missing. What control type did you use, .Net or XAML?

With .Net it asks for the assembly (Gembox.Document.dll) & the .Net 2.0 class (Winform). What have you used for that?

If you've used XAML what code have you used to start it up?

Thanks

David
Publicado el 01,septiembre 2015 - 11:53
Hello David

I bring the dll into my project using the .NetAssemblies option in the Windev Project Explorer pane. I just right click on it and select the Gembox dll from the list of assemblies. It doesn't ask me for any other .Net assembly
On the client side I had to add the wd190net2.dll and wd190net4.dll to existing installations
On my PC I have version .Net v4.0.30319 so maybe you need to be running a later verison of .Net ?

I hope this helps

Regards
Al
Publicado el 02,septiembre 2015 - 00:44
Hi Al
Tried loading it that way & I'm getting a little bit further (no errors) but I still don't get anything displayed to the screen. What control type did you place on the window?

Cheers

David
Publicado el 02,septiembre 2015 - 04:38
Hello David

Sorry David I just use the document version, so there is no control onscreen just code to handle the documents.

Regards
Al
Publicado el 03,septiembre 2015 - 00:56
Aah well, that explains that!

Thanks anyway

David
Publicado el 04,septiembre 2015 - 16:49
My first question would be whether the end user will have excel installed on their machine or not.
Publicado el 04,septiembre 2015 - 18:33
Bear in mind I've only used WinDev for a couple of months and am not familiar with GemBox. That being said it appears that GemBox doesn't have a good way to view files unless the box has Excel installed. To accomplish what you want you need to set your .Net 2.0 control CLASS to point to:

System.Windows.Forms.DataGridView

It will autofill the .dll (System.Windows.Forms.dll)

From there I added a button and in its click event I added:

ef is "GemBox.Spreadsheet.ExcelFile" xlsLO is XlsxOptions dgvOpt is ExportToDataGridViewOptions dgvOpt:set_ColumnHeaders(True) ssPath is UNICODE string ssPath = "C:\Users\mwgreen\Desktop\WinFormsUtilitiesSample.xlsx" ef:LoadXlsx(ssPath,xlsLO) DataGridViewConverter.ExportToDataGridView(ef.Worksheets.ActiveWorksheet, excelshow, dgvOpt)
my sources were:

MSDN

GemBox Examples

and the compiled help provided with the software. I hope this helps you.