Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

send chart to excel (c#)

send chart to excel (c#)

send chart to excel (c#)

i send the result of search to a radGridView1, and radGridView1 to Excel.
i want to show chart of it in excel. but my code dont work prefectly
below is the code:
thanks very much.

Range range_kol = worksheet.get_Range("A3", Convert.ToChar(65 + radGridView1.RowCount - 1) + (i + 2).ToString());
ChartObjects chartobjects = (ChartObjects)worksheet.ChartObjects(Missing.Value);

ChartObject chartobject = (ChartObject)chartobjects.Add(10, 150, 450, 250); //Left-Top-Width-Height
_Chart chart = (_Chart)chartobject.Chart;

// Call to chart.ChartWizard() is shown using late binding technique solely for the demonstration purposes
Object[] args7 = new Object[11];
args7[0] = range_kol; // Source
args7[1] = Microsoft.Office.Interop.Excel.XlChartType.xl3DColumn; // Gallery
args7[2] = Missing.Value; // Format
args7[3] = Microsoft.Office.Interop.Excel.XlRowCol.xlRows; // PlotBy
args7[4] = 0; // CategoryLabels
args7[5] = 0; // SeriesLabels
args7[6] = true; // HasLegend
args7[7] = "chart"; // Title
args7[8] = "Sample Category Type"; // CategoryTitle
args7[9] = "type data"; // ValueTitle
args7[10] = Missing.Value; // ExtraTitle
chart.GetType().InvokeMember("ChartWizard", BindingFlags.InvokeMethod, null, chart, args7);

RE: send chart to excel (c#)

You'll have a higher chance of getting an answer if you state what isn't working and what errors you get.

"Trying is the first step to failure..." - Homer

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close