public IAnnBatesElement[] ReadFromString(
string elementsExpression
)
elementsExpression
A string containing the text expression to be read from the Bates stamp elements. This value must not be null.
An array of IAnnBatesElement objects.
This method can only load Bates stamp elements previously saved with the same (starting, ending, and separating) symbols for the expression
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"
}