none
Best way to implement interaction beetween .Net application with Excel (office 365) RRS feed

  • Question

  • Hello community,

    I'm in charge to investigate a way to interact with Excel within my .Net (WPF or Winform desktop application).

    The goal here is to have the full or almost full capabilities of an Excel document Embedded within my .Net application.

    Some researches lead me that Com object, automation, or tierce library (most of them with
    charge licenses like spreadsheetGear). is not the god approach since the goal here is not to copy Excel behavior but use it directly. the COM object does not have the visualize part of Excel but only the backend.

    OLE approach is absolutely out of the question, totally obsolete nowadays. (DSO Frame and the like)

    The best approach for me is to use the Restfull API for Excel that will permit me to manipulate range, cells, worksheet within my application.

    My first question is that I couldn’t Embedded the Excel Online (office 365) version in a webBrowser Control Embedded into my WPF/Winform Application. It gets stuck in the loading state. May be it is not the purpose here, and only have to create
    my Restful communication layer to communicate with my Excel Document apart.

    What is the best way to communicate with Excel within a desktop application, to have both visualization, and edition?

    We are not looking neither into the VSTO approach, it is not the purpose here since the mother application should remain the .Net application and not Excel.

    Any help is much welcome.

    Thanks in advance,

    Antoine L.


    • Edited by antonio La Thursday, January 15, 2015 4:48 PM change subject
    • Moved by CoolDadTx Wednesday, January 21, 2015 3:10 PM Office related
    Thursday, January 15, 2015 4:36 PM

Answers

  • Hello, of course the Interop object was my first option, it works very well since a lot of time now, it works very well to manipulate workbook range and cells, to modify or generate new ones. But of course you are loosing all the advantage that Excel is offering that is to say its UI power.

    Thank you anyway, I think this approach to have an embedded excel within your app is not really possible.

    Generate and modify your excel, use Interop or other library like open xml etc. If you want to take advantage of Excel, just use it directly, write some VBA script or others plugin sytem (VSTO looks powefull to add the fully capability of .Net within your excel application) and make it communicate with your DB system or via WCF directly with your app (JSON messages or other protocols that proved very well in the past)

    Thank you all for your help.

    Tuesday, January 20, 2015 9:13 PM
  • Hi Antoine,

    >> The best approach for me is to use the Restfull API for Excel that will permit me to manipulate range, cells, worksheet within my application.

    I’m not sure if I understand your question correctly. But if you want to manipulate the Excel document only, I will suggest you using OpenXML SDK, especially for the server side automation.  

    Considerations for server-side Automation of Office

    >> What is the best way to communicate with Excel within a desktop application, to have both visualization, and edition?

    For the Office desktop side automation, I recommend you using the Excel Object Model (Office Interop).

    Microsoft.Office.Interop.Excel namespace

    Hope it will help.

    Regards,

    Jeffrey


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, February 4, 2015 6:51 AM
    Moderator

All replies

  • Hi Antonio,

    I have made a lot of research and found that if you want to add excel to winform, it seemed that you could use webbrowser. Based on your description, you have tried it in a webbrowser control, I am not sure why it did not work. The link below shows the details how to integrate excel in a winform:

    #How to Integrate Excel in a Windows Form Application using the WebBrowser
    http://www.codeproject.com/Articles/15760/How-to-Integrate-Excel-in-a-Windows-Form-Applicati

    In addition, if you decide to use webbrowser and still have the problem, it would be helpful if you could share us more information about your issue.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, January 16, 2015 5:28 AM
  • I found ExcelDNA library from codeplex very helpful and flexible to use.

    http://exceldna.codeplex.com/

    Friday, January 16, 2015 7:56 AM
  • Hello Edward,

    It seems that the webbrowser control is pretty old technilogy, it seems it is not compatible for now with the office 365 online (like excel online). Furthermore, since the 2010 version of office, the behavior when opening a local excel document, it won't open it into the webbreowser, but will prompt you to open it with the actual excel.

    My goal here, is to interact with excel within my wpf application. For example, set a cell in the embedded excel, validate it into my wpf application, and save it to a local DB for instance.

    I think, Excel DNA will be an option, but Excel will remain the mother application.

    Thank you

    Monday, January 19, 2015 7:11 PM
  • Hi Antonio,

    I made a research and found the link below which is related to spreadsheet might be useful to you:

    # Free .NET Spreadsheet Control
    http://www.codeproject.com/Articles/691749/Free-NET-Spreadsheet-Control

    In addition, this forum is to discuss problems about C# development. If you have issues about wpf, I would recommend you to go to the wpf forum for help. If you have any issue about excel dna, I would recommend you to go to the excel dna office site for help.

    Thanks for your understanding.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, January 20, 2015 3:34 AM
  • Hi antonio La,

    Why not use the Microsoft Office Interop assemblies?  Did you mention this in your OP?

    Best of luck.

    Tuesday, January 20, 2015 7:07 PM
  • Thank you for the advise, The project you are referring to seems very interesting. It is a free control.

    But, it looks like that this control will imitate the behavior and features of Excel. Like the spreadSheetGeer, that's does it very well (not free this one) and very powerfull tool.

    My goal is to use Excel, and communicate with it within the Application. I had posted this question also in the WPF part as well as the Excel part of community.

    Thank you for your feedback.

    Tuesday, January 20, 2015 9:04 PM
  • Hello, of course the Interop object was my first option, it works very well since a lot of time now, it works very well to manipulate workbook range and cells, to modify or generate new ones. But of course you are loosing all the advantage that Excel is offering that is to say its UI power.

    Thank you anyway, I think this approach to have an embedded excel within your app is not really possible.

    Generate and modify your excel, use Interop or other library like open xml etc. If you want to take advantage of Excel, just use it directly, write some VBA script or others plugin sytem (VSTO looks powefull to add the fully capability of .Net within your excel application) and make it communicate with your DB system or via WCF directly with your app (JSON messages or other protocols that proved very well in the past)

    Thank you all for your help.

    Tuesday, January 20, 2015 9:13 PM
  • Hi Antoine,

    >> The best approach for me is to use the Restfull API for Excel that will permit me to manipulate range, cells, worksheet within my application.

    I’m not sure if I understand your question correctly. But if you want to manipulate the Excel document only, I will suggest you using OpenXML SDK, especially for the server side automation.  

    Considerations for server-side Automation of Office

    >> What is the best way to communicate with Excel within a desktop application, to have both visualization, and edition?

    For the Office desktop side automation, I recommend you using the Excel Object Model (Office Interop).

    Microsoft.Office.Interop.Excel namespace

    Hope it will help.

    Regards,

    Jeffrey


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, February 4, 2015 6:51 AM
    Moderator