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

Dynamic marker

Hi,

Is it possible to dynamicaly add a marker to a sheet ?

Thanks,
Greg

3 Replies

MW Melba Winshia Syncfusion Team May 10, 2007 07:13 AM UTC

Hi Greg,

Thanks for your interest in Essential XlsIO.

Yes, it is possible to dynamically add a marker to a sheet. Please refer the following code snippet to achieve this:

[C#]

sheet.Range["B2"].Text = "%Marker";
sheet.Range["C2"].Text = "%Marker2.Worksheet.Workbook.Author";
sheet.Range["D2"].Text = "%SimpleArrayMarker";
sheet.Range["E2"].Text = "%ComplexArrayMarker.Address";
sheet.Range["F2"].Text = "%Hash.Key";
sheet.Range["G2"].Text = "%Hash.Value";
sheet.Range["H2"].Text = "%ArrayProperty.Cells.Address";

string[] arrValues = new string[] { "Value1", "Value2", "Value3" };
IRange[] arrValues2 = new IRange[] { sheet.Range["A1"], sheet.Range["A2"], sheet.Range["F6"] };
IDictionary hash = new Hashtable();
hash.Add(1, "Value = 1");
hash.Add(5, "Value = 5");
hash.Add(3, "Value = 3");

//Template marker
ITemplateMarkersProcessor marker = book.CreateTemplateMarkersProcessor();
marker.AddVariable("Marker", "First test of markers");
marker.AddVariable("Marker2", sheet.Range["B2"]);
marker.AddVariable("SimpleArrayMarker", arrValues);
marker.AddVariable("ComplexArrayMarker", arrValues2);
marker.AddVariable("Hash", hash);
marker.AddVariable("ArrayProperty", sheet.Range["B2:G2"]);
marker.ApplyMarkers();

Here is the sample for your reference:

http://websamples.syncfusion.com/samples/XlsIO.Web/4.4.0.51/60636/main.htm

Kindly let me know if you have any other questions.

Thanks,
Melba


GD gdo May 10, 2007 01:25 PM UTC

Thank you ! :D


MW Melba Winshia Syncfusion Team May 11, 2007 07:01 AM UTC

Hi Greg,

Thanks for the update.

Kindly let me know if you have any other questions.

Thanks,
Melba

Loader.
Live Chat Icon For mobile
Up arrow icon