How to set Excel chart area range based on GridView using C#?

AmitymnBime

New Member
I have an Excel Sheet divided into two sides. On the left side I export data from ASP.NET application. On the right side is a chart which is configured to populate based on the data exported.The problem is that I have reserved certain rows and columns for the left side data in the sheet. For example, I am assuming 10 columns and 31 rows for all reports. Reports can be of type Daily/Weekly/Monthly. For daily report, the first column is dates from 1 to 31. I therefore reserved left side of the sheet as max 31 rows and 10 columns.The data is correctly exported from my application to this sheet area and chart is also populated. But the problem is that exported data may be of 5 rows and 3 columns only, but because the chart area is configured for 31 rows and 10 columns, the chart bars visible are very thin in width.Is there a way to programatically control the chart area based on the GridView rows and columns?In my application, I am first displaying results on a GridView. When user clicks Export button, this GridView data is exported to the left-side reserved area of the Excel sheet.How to programatically set the range of the chart area from C# code of the current excel sheet?
 
Back
Top