I have a bunch of text that needs to change its font size. The text block I want is in the middle of a document.
So right now, what I do is below. I keep getting some bunches of text not changing font size. Is there a better way to do this? I tried going word by word but that takes visibly long time to complete. Also trying the find whole text via TxControlObj.Find
method gets Out Of Memory Errors.
// processedText is the block that needs to have the changed font size
while (processedText != String.Empty)
{
if (processedText.Length > 50)
processRange = 50;
else
processRange = processedText.Length;
startPos = TxControlObj.Find(processedText.Substring(0, processRange), startPos, TXTextControl.FindOptions.NoMessageBox);
TxControlObj.Selection.FontSize = fontSize;
processedText = processedText.Remove(0, processRange);
}
//This last bit here is because, I get highlighted text at the end of the loop otherwise.
startPos = TxControlObj.Find("", startPos, TXTextControl.FindOptions.NoMessageBox);
TxControl.Update();