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.
Unfortunately, activation email could not send to your email. Please try again.

Combine TemplateMarkers with static content

Thread ID:

Created:

Updated:

Platform:

Replies:

119381 Jun 12,2015 09:34 AM Jun 15,2015 08:09 AM WPF 1
loading
Tags: XlsIO
Okieh
Asked On June 12, 2015 09:34 AM

I want to mix TemplateMarkers with static content, for example (as a template in 4 columns):

                   A                                     B                     C                   D
1   %Customers.Name - %Customers.FirstName - 42 - %Customers.City

And as a result I like to have:

Doe - John - 42 - London
Doe - Jane - 42 - Paris
Smith - William - 42 - New York
... - 42 - ...
... - 42 - ...
... - 42 - ...

In other words I want to have the value in column 3 repeated for each row in my Customers list. How can this be achieved?

Vikas Sekar [Syncfusion]
Replied On June 15, 2015 08:09 AM

Hi Okieh,


Thank you for using Syncfusion products.


XlsIO doen’t support using static variable in template marker. Whereas, this can be achieved by using “copy range” argument in the template, which will copy a value and show it for number of records it contains. To achieve this in template excel file need to allot a column for the variable we like to repeat for each and every record. Add the argument “copyrange:RC[]” in the previous column of the static value column.  Before applying marker need to set the static value in the starting position of the cell, which copy range refers. We have attached the screen shot of the template file, code snippet and simple sample for your reference.


Screen shot of template file:



In column 4 we are going to add the value that should repeat for every record and in the previous column (3rd column) while declaring the property we have added the argument copyrange and refer the range.


Code snippet:

ITemplateMarkersProcessor marker = workbook.CreateTemplateMarkersProcessor();


if (this._customers.Count == 0)

{

   this._customers = GetCustomerAsObjects();

}


marker.AddVariable("Customers", _customers);


worksheet.Range["D2"].Value = Customer.Value;


marker.ApplyMarkers();


Sample: http://www.syncfusion.com/downloads/support/forum/119381/ze/Sample-2100172871


UG Link: http://help.syncfusion.com/ug/windows%20forms/index.html#!Documents/createfromarray.htm


Please lets us know if you need any clarification.



Regards,

Vikas


CONFIRMATION

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.

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.

;