Hello,
I am trying to change the Text of a cell with the Microstation C++ Api.
The Code I am using is working well on normal Text Elements. But in a Cell the "ReplaceInModel" returns an Error (69645)
void TextTool::textChange(EditElementHandleP eehIn) { int result=0; switch (eehIn->GetElementType()) { case CELL_HEADER_ELM: { for (ChildEditElemIter eehChild(*eehIn); eehChild.IsValid(); eehChild=eehChild.ToNext()) { textChangeTest(&eehChild); } break; } case TEXT_ELM: { TextBlockPtr textBlock = TextHandlerBase::GetFirstTextPartValue(*eehIn); ITextEditP textEdit = eehIn->GetITextEdit(); // Extract the TextBlock from the Text element. if (!textBlock.IsNull() && !textBlock->IsEmpty()) { //Replace Text CaretPtr startCaret = textBlock->CreateStartCaret(); CaretPtr endCaret = textBlock->CreateEndCaret(); textBlock->ReplaceText(L"newText", *textBlock->CreateStartCaret(), *textBlock->CreateEndCaret()); //create new Element and replace in Model EditElementHandle newEeh; ElementHandle templateEh(eehIn->GetElementP(), ACTIVEMODEL); TextHandlerBase::CreateElement(newEeh, &templateEh, *textBlock); //Replace in model. Working on single textelements but not in cells...? result =newEeh.ReplaceInModel(eehIn->GetElementRef()); wprintf(L"Result replaceInModel: %d\n", result); } break; } } }
Can somebody help me?
Regards
Manuel Höger