Excel to Power Point Creation

Dear Team,
I am totally new to aspose. kindly help me to achieve below requirement.
Requirement:- I am trying to make a application which can process an excel file and based on the excel data application will generate a output file( ppt extension).

Special instruction:- Please make a note I will provide ppt template and that template will have certain placeholder where data will be inserted from uploaded excel.

Work In Progress:-
I have added both Aspose.Cells and Aspose.Slides dll to my project and wrote below PoC.

private void button1_Click(object sender, EventArgs e){
Workbook wb = new Workbook(@“C:\Users\Nilanjan\Desktop\Incident.xlsx”);
Worksheet ws = wb.Worksheets[0];
Cells cells = ws.Cells;
int col = CellsHelper.ColumnNameToIndex(“N”);
int last_row = ws.Cells.GetLastDataRow(col);
DataTable dt = wb.Worksheets[0].Cells.ExportDataTable(0, 0,
wb.Worksheets[0].Cells.MaxDataRow + 1, wb.Worksheets[0].Cells.MaxDataColumn + 1);
Presentation ps = new Presentation();
ISlide slide=ps.Slides[0];
slide=ps.Slides[1];
ps.Save(@“C:\Users\Nilanjan\Desktop\CocoonIncident1.pptx”,Aspose.Slides.Export.SaveFormat.Pptx );
}

Till now I have tried to upload the excel into my code and after processing it I was able to fill a DataTable with the excel data, now next step is fill the ppt-template with that DataTable data. Please help me to achieve this functionality or please suggest suitable workaround. Let me know if ppt template or excel file is required.

@npandey9,

Please accept our apologies for delayed response. I have observed your requirements for adding DataTable to PowerPoint slides. There is no direct way available to add DataTable in PowerPoint slides. You need to access every cell in DataTable and add that in PowerPoint slides by following mechanism supported by PowerPoint or Aspose.Slides. I suggest you to please try using following sample code on your end.

    public static void DataTableToSlides()
    {
        String path = @"C:\Aspose Data\";

        System.Data.DataTable table = new System.Data.DataTable();
        table.Columns.Add("Term", typeof(string));
        table.Columns.Add("Value", typeof(float));

        table.Rows.Add(@"Term 16", 1.5);
        table.Rows.Add(@"Term 15", 0.7);
        table.Rows.Add(@"Term 14", 0.7);
        table.Rows.Add(@"Term 13", 0.6);
        table.Rows.Add(@"Term 12", 0.6);


        Presentation pres = new Presentation();
        ISlide slide = pres.Slides[0];
        double[] colWidth = { 100, 100 };
        double[] rowHeight = { 40};// 40, 40,40,40,40 };//1 row additional to hold the headers

        ITable slidesTable = slide.Shapes.AddTable(100, 10, colWidth, rowHeight);
        slidesTable[0, 0].TextFrame.Text = table.Columns[0].ColumnName;
        slidesTable[1, 0].TextFrame.Text = table.Columns[1].ColumnName;

        for (int i=0;i<table.Rows.Count;i++)
        {
            DataRow row = table.Rows[i];
            slidesTable.Rows.AddClone(slidesTable.Rows[0], false);
            slidesTable[0, i + 1].TextFrame.Text = row[0].ToString();
            slidesTable[1, i + 1].TextFrame.Text = row[1].ToString();
        }
 
        pres.Save(path + "Saved.pptx",Aspose.Slides.Export.SaveFormat.Pptx);
    }