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

A Formula for each Row when using Template Markers

Thread ID:





123270 Mar 2,2016 01:11 PM UTC Mar 3,2016 12:45 PM UTC ASP.NET Web Forms 1
Tags: XlsIO
Phil Coe
Asked On March 2, 2016 01:11 PM UTC


I have a template with a bunch of markers across one row, I would like a formula for each row that gets generated by the template markers, I have tried putting the formula in the template on the top row but it only shows for the first row when I generate the new excel file, I hope this makes sense,  can you tell me what I'm doing wrong? 


Ishwarya Narayanan [Syncfusion]
Replied On March 3, 2016 12:45 PM UTC

Hi Phil,


Thank you for contacting Syncfusion support.


In Template Marker, we provide an option to copy a range of values using copyrange property. We prepared a sample in the following link to update the formula in the generated file based on the DataTable row count. Please check the sample and let us confirm whether the sample helps you to achieve your requirement. Also you can refer the UG link for further reference about working with Template Markers.


Sample Link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/XlsIO_Sample549030196


UG Link: http://help.syncfusion.com/file-formats/xlsio/working-with-template-markers


Code Sample:


public static void CreateWorkbook()


ExcelEngine engine = new ExcelEngine();

IApplication application = engine.Excel;

application.DefaultVersion = ExcelVersion.Excel2013;


IWorkbook workbook = application.Workbooks.Open("../../Data/InputTemplate.xlsx");

IWorksheet sheet = workbook.Worksheets[0];


DataTable dt = CreateDataTable();


sheet["C2"].Value = "%products.Desc;copyrange:R2C6:R" + dt.Rows.Count + "C6";


ITemplateMarkersProcessor marker = workbook.CreateTemplateMarkersProcessor();

marker.AddVariable("products", dt);










//DataTable Creation

static DataTable CreateDataTable()


DataTable products = new DataTable();






products.Rows.Add(1000, "Pen", 3, 2);

products.Rows.Add(1001, "Writing Pad", 5, 4);

products.Rows.Add(1002, "Eraser", 10, 1);

products.Rows.Add(1003, "Pencil", 20, 1);

products.Rows.Add(1004, "30CM Scale", 20, 3);


return products;




Ishwarya N


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.

Please sign in to access our forum

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

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