views:

303

answers:

1

Does anyone know if there is a tool that allows you to convert an Excel Chart object to an System.Windows.Forms.DataVisualization.Charting object (aka ASP.NET Charts)

e.g. in C#

using System.Windows.Forms.DataVisualization.Charting;

...

var xlChart = xlWorksheet.ChartObjects.FirstOrDefault();

Chart chart = SomeConverterLibrary.Convert(xlChart);

...

A: 

SpreadsheetGear for .NET enables you to load Excel workbooks, access and modify the charts via the charting API, and render charts images with no dependency on Excel.

You can see some live charting API samples here, chart rendering samples here and download a free trial here.

Disclaimer: I own SpreadsheetGear LLC

Joe Erickson
Joe,We are currently using SG for rendering charts. We have found there are many issues to do with the order you set properties, and that order can be different for different chart and/or series chart types.E.g.If I have a Stock type chart, i need to set that chart type after I have set the properties for the chart, not before and so on... it is quite frustrating not knowing the rules the SG code has in it for dependencies. The other reason we are looking away from SG is that it does not support many of the chart types that Excel supports, e.g. all the 3d charts.Any thoughts?
James Summerton
James, our API has been built to work like the Excel API, so the behavior regarding the order you must set things should be compatible with Excel in most cases. We did this intentionally even though the behavior is often not the way we might have designed it because there are so many resources available for Excel. On 3d charts - we intend to support them over time...
Joe Erickson
James, I asked Terry Erickson, our charting developer, if he anything to add and he did: Setting the ChartType property can reset many properties related to the plot area, including ChartGroups, Series, Axes, and DataPoints. Specifically, setting the ChartType to one of the Stock chart types can alter series fills, linestyles, markers, high-low lines, up-down bars, as well as others. A Stock chart is really just a Line chart with a lot of special formatting applied. It would be typical to set the ChartType to a Stock type first and then format the rest of your chart as desired.
Joe Erickson