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
close icon

Change Totals formula with Template Marker

I have a spreadsheet where I am using Template Markers. It is being populated correctly. However I have a Summary Total cell that I want to sum values of all the rows. I need this to be dynamically set by the Template Markers. Eg: If there are three rows in the data table used to populate Template Markers I need the totals formula to be set to =SUM(H6:H8). If there are 5 rows on the data table I need the totals formula to be set to =SUM(H6:H10). Row 6 is the start row. That is the one with all the marker variables such as %MediaSchedule.PlanCode. Is there anyway to do this with Template Markers? That is dynamically set the end row of the totals formula based on the number of rows in the data table. Attached is a results spreadsheet. The cell H11 has the totals formula. It is =SUM(H6:H6). I need it to be =SUM(H6:H8) for this example.


Attachment: MarkerFile635321162330426863_b9dcd64a.zip

1 Reply

PM Prasanth M Syncfusion Team April 3, 2014 01:17 PM UTC

Hi Benjamin,

Thank you for using Syncfusion products.

Currently our XlsIO does not support to dynamically change formula with Template Marker. However you can work around by using UsedRange property after the ApplyMarker method invocation. We have shared the code snippet for your reference.


Code Snippet:

marker.ApplyMarker();

int lastRow=sheet.UsedRange.LastRow;

sheet["H11"].Formula = string.Format("SUM(H6:H{0})",(lastRow - 3));


Please let us know if you need any clarification.

Regards,
Prasanth


Loader.
Live Chat Icon For mobile
Up arrow icon