0

from Excel File

from PDF Export From Excel

This Code export Pie Chart

    //Pie Chart
    var pieChart = worksheet.Charts.Add(ChartType.Pie, "A27", "G45");
    pieChart.SelectData(worksheet.Cells.GetSubrange("G2:G6"), true, true);
    pieChart.DataLabels.LabelContainsValue = true;
    pieChart.DataLabels.LabelContainsPercentage = true;
    pieChart.DataLabels.ShowLeaderLines = true;
    pieChart.DataLabels.Separator = ", ";
    pieChart.Legend.IsVisible = true;
    pieChart.Legend.Position = ChartLegendPosition.Bottom;

    var printOptions = worksheet.PrintOptions;
    printOptions.FitWorksheetWidthToPages = 1;
    printOptions.FitWorksheetHeightToPages = 1;
    workbook.Save(ms, SaveOptions.PdfDefault);`enter code here`
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jun 15 '22 at 08:19
  • Unfortunately, the problem is with [`LabelContainsPercentage`](https://www.gemboxsoftware.com/spreadsheet/docs/GemBox.Spreadsheet.Charts.ChartDataLabels.html#GemBox_Spreadsheet_Charts_ChartDataLabels_LabelContainsPercentage) which is currently not supported in output PDF., see the property's remarks. This will be added in the future, but for now, you'll need to use those percentage values in the chart series so that you have them with `LabelContainsValue`. – Mario Z Jun 16 '22 at 05:11

0 Answers0