Excel Chart in C#
-
I want to programmatically create Excel charts in my c# application. Is there a way I can get the chart into a Panel control in my application? I do not want the Excel grid or cells to be part, just the chart output that is inserted in the worksheet. Thanks.
-
I want to programmatically create Excel charts in my c# application. Is there a way I can get the chart into a Panel control in my application? I do not want the Excel grid or cells to be part, just the chart output that is inserted in the worksheet. Thanks.
Dan_K wrote:
I do not want the Excel grid or cells to be part, just the chart output that is inserted in the worksheet. Thanks.
A lot of those formula's are calculated at runtime, and are not exactly "inserted" in the physical file. We got quite some articles on reading Excel-files and getting their content - check them out.
Bastard Programmer from Hell :suss:
-
Dan_K wrote:
I do not want the Excel grid or cells to be part, just the chart output that is inserted in the worksheet. Thanks.
A lot of those formula's are calculated at runtime, and are not exactly "inserted" in the physical file. We got quite some articles on reading Excel-files and getting their content - check them out.
Bastard Programmer from Hell :suss:
-
-
Thanks Eddy, I think the charts are inserted in the worksheet. I don't know if there is a way to send only the chart into my application. Any way to do that?
What do you mean with "send into my application"? Excel does not store a chart, but a description of a chart - one that's usually based on values within the same document. You can probably copy the contents to a bitmap and store that in your database.
Bastard Programmer from Hell :suss:
-
Thanks Eddy, I think the charts are inserted in the worksheet. I don't know if there is a way to send only the chart into my application. Any way to do that?
The short answer is no, there isn't any way to redirect the chart output to a control in your application. The long answer is kind of, but it is so over the top complicated as to make it not worth the effort at all. Excel can provide data, but it's horrible at providing graphics. The best solution is to just get a graphing library and setup the chart in your own application.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
I want to programmatically create Excel charts in my c# application. Is there a way I can get the chart into a Panel control in my application? I do not want the Excel grid or cells to be part, just the chart output that is inserted in the worksheet. Thanks.
When you copy an Excel chart to the ClipBoard, it gets stored in the ClipBoard using a dozen different formats, including PNG, GIF, Bitmap, and EnhancedMetafile; which means any .NET app can retrieve it as an Image or Bitmap and work with that. So start by using Office Interop (don't ask me for details, I don't know; Google and CodeProject do know) and have it copy the chart for you. Then write some code to paint the image where you need it. :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
-
I want to programmatically create Excel charts in my c# application. Is there a way I can get the chart into a Panel control in my application? I do not want the Excel grid or cells to be part, just the chart output that is inserted in the worksheet. Thanks.
I you intention is to display graphs/charts then you can achieve this by using the free library shipped with .Net 4.0. have look Happy Coding :-D