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

TemplateMarkers

Thread ID:

Created:

Updated:

Platform:

Replies:

64487 Jul 21,2007 05:48 AM UTC Jul 24,2007 12:17 PM UTC WinForms 1
loading
Tags: XlsIO
Tim Stevens
Asked On July 21, 2007 05:48 AM UTC

I have looked at the sample for Windows Forms using TemplateMarkers and cannot figure it out. I have both looked at the VB.NET code and run the sample. I fail to see how the end user "gets the flexibility of designing the Excel report" as mentioned in the sample. I was told that this feature of Syncfusion would facilitate end-user report creation, which is very exciting to me and my company. I would appreciate any help understanding how this sample works and how an end user can design their own reports.

Thanks.

Tim

Ramya R [Syncfusion]
Replied On July 24, 2007 12:17 PM UTC

Hi Tim,

Thank you for your interest in Syncfusion Products.

This sample shows how the TemplateMarkers created by the enduser can be replaced with data at the runtime.

The basic idea is that the template will have markers like %Customers.ContactName inside cells and when we provide the data source (customers DataTable) , the contents of ContactName column will get inserted into the template document. For example, the end user of an application can format a template like he wants and then put the markers inside as specified and then have the data from the DataTable exported with the desired look.

There could be several arguments after variable they are delimited by some character (by default it is ; character)

Possible arguments:
--------------------

1) horizontal or vertical - specifies direction of the data import for complex variables (arrays, collections, data tables, etc.), vertical is default value.

2) insert - specifies that new row or column (depends on direction argument) for each new cell.

3) insert:copystyles - the same but also copies style from the above row or left column

4) jump: - specifies position of the next cell. This argument also can be appended by ":copystyles" then style of the single cell will be copied.

5) copyrange:: - copies specified cells after each cell import. Aslo can be appended by ":copystyles". There can be more than one copyrange argument for single template marker.


The TemplateMarkers sample does the following,

1. Opens the TemplateMarker xls file created by the end user. For this sample the TemplateMarker.xls file is placed in the location "Syncfusion\EssentialStudio\5.1.0.51\Windows\XlsIO.Windows\Samples\2.0\Data"

2. Replaces each TemplateMarker in that file with desired data using the code snippet below,

ITemplateMarkersProcessor marker = workbook.CreateTemplateMarkersProcessor();
marker.AddVariable("Customers",northwindDt);

//Insert Array Horizontally
string[] names = new string[]{"Mickey","Donald","Tom","Jerry"};
string[] descriptions = new string[]{"Mouse","Duck","Cat","Mouse"};
marker.AddVariable("Names",names);
marker.AddVariable("Descriptions",descriptions);

//Stretch Formula
marker.AddVariable("NumbersTable",numbersDt);

3. Processes the markers in the template using the code snippet below,
marker.ApplyMarkers();

4. Saves the workbook with these changes.

Please let me know if you have any queries.

Thanks & Regards,
Ramya.


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.

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

;