Programmatically Generating Excel Line Charts using C#

A

andriy155

I am trying to programmatically generate an Excel file on the server side
and fill it in with the values from the database. After that, I would like to
graph the data using a simple Line Chart. Finally, I want to place the chart
into the spreadsheet, save the spreadsheet on the server and send it to the
client.

I got all of this working except the Linechart that I create has markers in
it (i.e. dots indicating datapoints). I want to get rid of them, leaving only
connecting lines. In Excel 11 (2003) this is really easy - you simply have to
choose the right type of graph in the chart wizard. But how do I use C# for
this? Here is how I use the ChartWizard:

crt.ChartWizard(sourceRange, XlChartType.xlLine, Type.Missing,
XlRowCol.xlColumns, 1, 1, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing);

Also, the final Excel spreadhseet that has been downloaded by users contains
the resulting chart with markers, however, the chart is not editable. What
more, the Chart button in the Excel panel is dimmed out. Strange...


Your thoughts and suggestions are more than welcome!!!
 
A

andriy155

Hi everyone,

I actually solved the issue. The solution is to use the chartwizard like so:
crt.ChartWizard(sourceRange, XlChartType.xlLine, 2, XlRowCol.xlColumns, 1,
1, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);

Sorry about buggin you with this. Hopefully, this post will be useful to
somebody else.

Andriy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top