public string WriteElementToString(
IAnnBatesElement element
)
element
The Bates stamp element to convert to a string expression. This value must not be null.
A string expression for this element.
using Leadtools.Annotations.Engine;
using Leadtools.Annotations.BatesStamp;
public void AnnBatesStampTranslator_AnnBatesStampTranslator()
{
//Create Bates stamp translator instance
AnnBatesStampTranslator translator = new AnnBatesStampTranslator();
//Create some Bates stamp elements to test on translator
AnnBatesDateTime batesDateTime = new AnnBatesDateTime();
batesDateTime.CurrentDateTime = DateTime.Now;
AnnBatesNumber batesNumber = new AnnBatesNumber();
batesNumber.AutoIncrement = true;
batesNumber.StartNumber = 3;
batesNumber.NumberOfDigits = 9;
batesNumber.PrefixText = "beforeText";
batesNumber.SuffixText = "afterText";
batesNumber.UseAllDigits = true;
AnnBatesText batesText = AnnBatesText.Create("This is test");
string elementsExpression = translator.WriteElementsToString(new IAnnBatesElement[] { batesDateTime, batesNumber, batesText });
//Print the expression
Debug.WriteLine(elementsExpression); // the output will be "{{BatesDateTime*Local*}}{{BatesNumber*9*1*3*1*beforeText*afterText}}This is test"
//Load the Bates stamp elements from the expression again
IAnnBatesElement[] elements = translator.ReadFromString(elementsExpression);
//Print the count of loaded elements to make sure the load is correct
Debug.WriteLine(elements.Length); // the output will be "3"
}