Page 1 of 1
How to get newly inserted item
Posted: Mon Feb 27, 2017 12:02 pm
by cychia_n2n
Right after call AddNLTag() how can I get the correct ItemInfo? rve.GetCurrentItem?
Thanks
Re: How to get newly inserted item
Posted: Mon Feb 27, 2017 12:48 pm
by Sergey Tkachenko
Add*** methods add items to the end of the document. So the index of the new item is rve.ItemCount - 1, and you can use rve.GetItem(rve.ItemCount - 1).
You cannot use GetCurrent*** methods. They work with the item at the position of the caret. This position is undefined until you format the document.
Note: AddText*** methods may add multiple items, if string contains line breaks, tabs, or page break characters. To calculate how many items are added, you can compare values of rve.ItemCount before and after the call.