Lighthouse Builder

I'm just now "finding my feet" with Windows forms application development and I'm wondering if a specific task is possible within the Forms application architecture.

I would like to control Excel for custom purposes from within a Forms application that is deployed using ClickOnce.

I've searched and found some posts about exporting data to Excel through a database interface, but this is inadequate for what I would like to do. I want to use Excel for rich presentation (perhaps even a chart) and want to allow users to cut-and-paste into Excel, and save the resutls.

My needs suggest that I would want to use the Excel Automation Object model but I'm stumbling in the dark about whether this is possible using a Windows forms application.

Can anyone share a hint pointing in this direction, -- ie. a link to an article or a code sample, or a "no way you can't do that."

Thank you !



Re: Windows Forms General Excel Automation from within Forms application deployed with ClickOnce

nobugz

Use the classes in the Microsoft.Office.Interop.Excel namespace.





Re: Windows Forms General Excel Automation from within Forms application deployed with ClickOnce

Bob zhu-MSFT

if your requirement is to write something to an Excel file
My suggestion is using XML, InterOP also work but speed may be slow as I tried.
and you can first save an Excel file to XML formate using "Excel", than you can see how to write its schema,
than you can use streamwriter in .net to write an XML file using the Excel schema, save it as .xsl file, an Excel file finished:)






Re: Windows Forms General Excel Automation from within Forms application deployed with ClickOnce

Lighthouse Builder

Hello Bob,

Thank you for your reply. In this case, my requirement has not been to write something to Excel readable file.

Instead, my direction has been to develop a solution in which Excel is relied upon for user interface of the solution.