How to embed Excel in .Net form ?

Posted by jjgomez on 06-Oct-2011 09:42

How can I embed a Excel document in .Net form ?

Regards,

Juanjo

All Replies

Posted by jquerijero on 10-Oct-2011 14:20

This is not supported by MS Office. However, you can use the Microsoft WebBrowser in your form and Navigate to the Excel file.

Posted by jjgomez on 11-Oct-2011 02:35

Thanks Joseph but I have already tried this and don´t works for me. Microsoft WebBrowser control opens the Excel document in another window (Excel Application), not in the control. Is there any way to avoid this or another way to solve the problem?

Regards,

Juanjo

Posted by Admin on 11-Oct-2011 05:27

You can embed Office applications/documents in Active X Controls. These Active X Controls can be used on ABL windows embedded in .NET Forms.

When done properly, the user won't know the difference (of underlying technology)

Posted by jjgomez on 11-Oct-2011 06:22

What activex can be used?

The .Net Form needs to use other .Net controls. How can I use .Net controls and ActiveX in the same Form?

Regards,

Juanjo

Posted by Admin on 11-Oct-2011 06:27

The .Net Form needs to use other .Net controls. How can I use .Net controls and ActiveX in the same Form?

Check the GUI for .NET documentation for embedded windows. Basically you'll place a Progress.Windows.WindowContainer control anywhere on your Form. That Control will host an ABL window and in that ABL window you can have an Active X Control. You'll have other .NET Controls around or on top of that.

The coolest feature of GUI for .NET

Posted by jjgomez on 11-Oct-2011 08:49

Check the GUI for .NET documentation for embedded windows. Basically you'll place a Progress.Windows.WindowContainer control anywhere on your Form. That Control will host an ABL window and in that ABL window you can have an Active X Control. You'll have other .NET Controls around or on top of that.

Ok.

What activex can be used? Do you know any?

Juanjo

Posted by jquerijero on 11-Oct-2011 10:18

There is no more ActiveX integration support from Office product. Looks like starting with Vista no more embedding is allowed including through the IE plug-in.

Posted by jjgomez on 13-Oct-2011 03:21

Then, there is no solution to this problem with ActiveX?

Posted by Admin on 13-Oct-2011 03:32

Then, there is no solution to this problem with ActiveX?

http://www.edrawsoft.com/officeviewer.php

Works on Windows 7 and with Office 2000 ... Office 2010

Posted by jquerijero on 13-Oct-2011 09:25

You can still use third party ActiveX.

Posted by Haikarainen on 03-Apr-2012 06:55

If you don't want to pay for a control/want writeaccess to the files, I actually created a solution to embedding Excel into an ABL form.

Steps:

  1. Import functions from the Win32-API assembled User32.dll-file.(GetWindowLong, SetWindowLong, SetParent etc)
  2. Create a Interop.Excel.Application, Set the parent of that windowhandle to the panels handle(where you want it implemented, or even better, the custom excel-controls panels windowhandle).
  3. Play around with Get/SetWindowLong etc to remove the borders, ribbons. Jail the rest of the ugly remains out of it with hardcore tweaks
  4. ?????
  5. Profit!

Made right, this will actually implement a workbook, with a minimal macroeditor, splitscreen-capabilities, several sheets etc. The code behind it might be pretty farfetched and ugly, but as long as it delivers robust results im happy

Posted by nidk on 03-Apr-2012 07:12

Hi,

   I try this solution, it work . And you don't need Excel .

You DL this library in MSDN

    http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=5124

And Now , you may read and write excel with ABL code (without excel installation) but it's just (xslx format , excel 2010).

Tip : A make Class Factory in C#  , for my easy use in ABL code.

This SDK have reverse engineering tool. You create Excel File with Excel Application And it creat C# code for create same document.

Posted by jjgomez on 04-Apr-2012 02:29

Thanks Adrien but I need to show the Excel document in the .Net form.

Posted by jjgomez on 04-Apr-2012 02:31

Thanks Fredrik, I wil try it.

Posted by nidk on 04-Apr-2012 03:27

You use this ocx : DSOFramer.ocx , but microsoft stop this developpement of this ocx, or try make in C++ your own Activx hosting

   And make a wrapper for C# form width this .net commande : aximp.exe (ex : http://www.c-sharpcorner.com/uploadfile/yougerthen/host-an-ocx-control-within-a-net-windows-application-net-and-com-part-iv/)

exemple :

   http://blogs.msdn.com/b/erikaehrli/archive/2005/08/26/hostofficeinnet.aspx

Posted by jjgomez on 04-Apr-2012 04:21

Ok. I will do some tests.

This thread is closed