We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Multiple Pie Chart in one sheet

Thread ID:

Created:

Updated:

Platform:

Replies:

107582 Mar 7,2013 02:26 PM UTC Mar 11,2013 12:11 PM UTC ASP.NET Web Forms (Classic) 1
loading
Tags: Chart
theodrows
Asked On March 7, 2013 02:26 PM UTC

Hi,

How can I create multiple pie chart in one excel sheet(without chart web control) all in code behind. I found one sample which only creates a single piechart. I have attached the sample chart I want to create, It would be great if I can get code example

Thank you

Theo


6734b1fe2eab4b8aa090b245ca965630_f36ac932.zip

Vijayabharathi K [Syncfusion]
Replied On March 11, 2013 12:11 PM UTC

Hi Theo,

 

Thanks for using Syncfusion products.

We can draw the chart control as bitmap image and add it to the sheet of excel file for your requirements. Since, we don’t have built-in functionality to export the multiple chart to excel. Kindly refer the below code snippet to achieve this,

[C#]

 

            string exportFileName = "Chart.xls";

            //A new workbook with a worksheet is created.

            IWorkbook chartBook = ExcelUtils.CreateWorkbook(1);

            IWorksheet sheet = chartBook.Worksheets[0];

            int toprow = 4, topcolumn = 5, bottomrow = 20, bottomcolumn = 12;

 

            for (int i = 0; i < 2; i++)

            {

                Bitmap img = new Bitmap((int)chart[i].Width.Value, (int)chart[i].Height.Value);

                chart[i].Draw(img);

 

                string chartimage = "chartimage" + i + ".Jpg";

                sheet.Pictures.AddPicture(toprow, topcolumn, bottomrow, bottomcolumn, img);

                topcolumn = bottomcolumn + 3;

                bottomcolumn = topcolumn + 7;

            }

 

            sheet.Activate();

            //Save the Chart book.

            chartBook.SaveAs(Server.MapPath(exportFileName));

            chartBook.Close();

            ExcelUtils.Close();

 

Please refer the attached sample for this requirements and let us know if any concerns.

 

Regards,

Vijayabharathi



101880_Sample_350d3301.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;