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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to generate reports in PowerPoint presentations for data from database?

Platform: ASP.NET Web Forms |
Control: Presentation |
.NET Framework: 4.5.1

You can generate reports in PowerPoint presentations for the data from database, using Presentation and XlsIO libraries. This can be done in Windows Forms, WPF, ASP.NET, ASP.NET MVC, UWP and Xamarin platforms. For more information about the platform-wise required assemblies, please refer the UG documentation here.

Step 1: Import data from database to an excel file using XlsIO library


The below links demonstrates importing data from a database to an excel file.


KB link: https://help.syncfusion.com/file-formats/xlsio/working-with-data#import-data-from-datatable



Excel file using XlsIO library


Step 2: Create charts and tables in a PowerPoint presentation for the data in excel sheet

The following screenshot and code example demonstrates importing data from an excel work sheet as charts and tables in a PowerPoint slide.


Data Excel sheet



The below code example demonstrates creating tables and charts in a PowerPoint slide, for the data from different data-ranges of an excel sheet.


// Open presentation by using Essential Presentation.
IPresentation presentation = Presentation.Open("Sample.pptx");
int count = 0;
//Export the date from excel to Presentation
foreach (DataTable splittedDataTable in dataTables)
if (count == 1)
ExportToPresentation(presentation, splittedDataTable);
//Add slide to the PowerPoint presentation
ISlide slide = presentation.Slides[0];
//Get the excel file as stream
Stream stream = new FileStream("Microsoft_Excel_Worksheet.xlsx", FileMode.Open);
stream.Position = 0;
//Create a chart for the date in excel file within A1:F6 data range
IPresentationChart columnChart = slide.Charts.AddChart(stream, 1, "A1:F6", new RectangleF(30.96F, 15.12F, 350.64F, 227.52F));
stream.Position = 0;
//Create a chart for the date in excel file within A7:D12 data range
IPresentationChart pieChart = slide.Charts.AddChart(stream, 1, "A7:D12", new RectangleF(30.96F, 289.44F, 350.64F, 227.52F));
//Set the chart type as Pie.
pieChart.ChartType = Syncfusion.OfficeChart.OfficeChartType.Pie;
//Dispose the stream
//Save the presentation
///Exports the values in data table to PowerPoint tables.
private static void ExportToPresentation(IPresentation presentation, DataTable dataTable)
//Add slide to the presentation document.
ISlide slide = presentation.Slides[0];
//Add table to the slide. The height of the table will grow per the content height by default
ITable table = slide.Tables.AddTable(dataTable.Rows.Count, dataTable.Columns.Count 1, 416.16, 101.28, 500.2, 165.36);
//Disable the header row property
table.HasHeaderRow = true;
int rowIndex = 0;
int colIndex = 0;
//Add data to the table in presentation from the DataTable instance
foreach (DataRow row in dataTable.Rows)
foreach (object val in row.ItemArray)
ICell cell = table[rowIndex, colIndex];
if (colIndex == 5)
colIndex = 0;


Sample Link:




2X faster development

The ultimate ASP.NET Web Forms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

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

Live Chat Icon For mobile