Fetch all the smart markers in the excel template

Is there any way to fetch all the smart-markers in my excel template?

Hi,


Well, Smart Markers normally starts with “&=” chars, so, the best way is to find those cells which contains the value “&=” chars as their starting characters. I have written a sample code for your reference. The sample code loops through each sheet to find those cells which contains the smart markers, I have added them to List to store them. Please refer to the code sample code so you may update or create your own code accordingly for your requirements.

Sample code:

Workbook workbook = new Workbook(“e:\test2\SmartMarkerDesigner.xls”);
WorksheetCollection worksheets = workbook.Worksheets;
var list = new List();


for (int i = 0; i < worksheets.Count; i++)
{

Worksheet worksheet = workbook.Worksheets[i];
Cells cells = worksheet.Cells;
Cell cell;
Cell prevcell = null;
string origval;
string partstring;


do
{
//A smart markers starts with “&=” chars so, you got to find those cells.
cell = cells.Find("&=", prevcell, new FindOptions { LookAtType = LookAtType.StartWith });
if (cell == null)
break;
list.Add(cell.StringValue);

prevcell = cell;

} while (cell != null);

}

Console.WriteLine(list.Count.ToString());

string [] arr = list.ToArray();

for(int i = 0 ; i< arr.Length; i++)
{
Debug.WriteLine(arr[i].ToString());
}


Hope, this helps a bit.

Thank you.

Thanks for the quick response and the code.

Hi,


Good to know that it suits your needs. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

Thank you.