I've gone through all the threads I could find regarding ReplaceInModel method when it applies to elements within a cell and so far no one has provided any direction. In the code below:
TextElement origElem = (TextElement)Element.GetFromElementRef(elem.GetNativeElementRef()); TextElement t = (TextElement)elem; TextBlock tb = t.GetTextPart(id); tb.Remove(tb.CreateStartCaret(), tb.CreateEndCaret()); tb.InsertText(tb.CreateStartCaret(), newValue); if (TextReplaceStatus.Success == t.ReplaceTextPart(id, tb)) { t.ReplaceInModel(origElem); }
If the TextElement is within CellElement, the t.ReplaceInModel will crash microstation. Do I need to somehow update the CellElement? And if its a multi-level Cell, like Cell within a Cell, do I need to update the top level Cell?
Thanks.