Intro

Populate a template with ExcelTemplate and then programmatically manipulate or 'post process' the workbook with ExcelApplication.

This demo begins with an ExcelTemplate workbook with data markers.  First, the ExcelTemplate object binds data to the data markers while preserving all existing Excel formats that were in the original template.  Then, the populated workbook is opened as an ExcelApplication Workbook where it can be programmatically manipulated.  ExcelApplication adds a chart.

Code

private ExcelTemplate xlt;
private ExcelApplication xlw;
private Workbook wb;


/// <summary>
        /// Build the report with ExcelApplication
        /// </summary>
        public void GenerateReport()
        {
            
            PopulateTemplate();
            AddChart();

            /* Save the report to specified folder */
            xlw.Save(wb, @"..\..\Output\TempToApp_output.xlsx");
        }




Downloads

Sample Template File: TemplateToAppTemplate.xlsx

Sample Output File: TempToApp_output.xlsx